1
mirror of https://github.com/jakejarvis/mastodon-utils.git synced 2025-04-26 09:05:21 -04:00

commit more config files (safely)

This commit is contained in:
Jake Jarvis 2022-12-10 13:09:42 -05:00
parent 22a26e9829
commit a061a510ee
Signed by: jake
GPG Key ID: 2B0C9CF251E69A39
8 changed files with 3758 additions and 5 deletions

51
etc/grafana/grafana.ini Normal file
View File

@ -0,0 +1,51 @@
##################### Grafana Configuration Example #####################
#
# Everything has defaults so you only need to uncomment things you want to
# change
[server]
http_addr =
http_port = 3003
root_url = https://grafana.pipe.fail
[analytics]
reporting_enabled = false
check_for_updates = false
check_for_plugin_updates = false
feedback_links_enabled = false
[security]
disable_initial_admin_creation = true
disable_gravatar = true
cookie_secure = true
[snapshots]
external_enabled = false
[dashboards]
versions_to_keep = 100
[users]
allow_sign_up = false
default_theme = dark
[auth]
disable_login = true
disable_login_form = true
[auth.grafana_com]
enabled = true
allow_sign_up = false
client_id =
client_secret =
scopes = user:email
allowed_organizations =
[metrics]
enabled = false
[live]
max_connections = 10
[feature_toggles]
publicDashboards = true

File diff suppressed because it is too large Load Diff

50
etc/nginx/nginx.conf Normal file
View File

@ -0,0 +1,50 @@
user mastodon; # jake: changed from nginx
worker_processes auto;
pid /run/nginx.pid;
# jake: added
load_module modules/ngx_http_brotli_filter_module.so;
load_module modules/ngx_http_brotli_static_module.so;
events {
worker_connections 768;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# jake: added (prometheus target)
server {
listen 9181;
location /metrics {
stub_status on;
allow 127.0.0.1;
deny all;
}
}
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

View File

@ -155,6 +155,10 @@ server {
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains"; add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
# jake: added (debugging)
add_header Via $proxy_host;
add_header X-Got-Milk "2%";
tcp_nodelay on; tcp_nodelay on;
} }
@ -178,9 +182,10 @@ server {
proxy_cache_valid 200 7d; proxy_cache_valid 200 7d;
proxy_cache_valid 410 24h; proxy_cache_valid 410 24h;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504; proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
add_header X-Cached $upstream_cache_status;
# jake: added :) # jake: added (debugging)
add_header Via $proxy_host;
add_header X-Cache-Status $upstream_cache_status;
add_header X-Got-Milk "2%"; add_header X-Got-Milk "2%";
tcp_nodelay on; tcp_nodelay on;

View File

@ -0,0 +1,28 @@
modules:
linode_bucket:
headers:
# https://cloud.linode.com/profile/tokens
Authorization: "Bearer XXXXXX"
metrics:
- name: json_linode_size
path: "{.size}"
labels:
bucket: "{.label}"
zone: "{.cluster}"
hostname: "{.hostname}"
- name: json_linode_objects
path: "{.objects}"
labels:
bucket: "{.label}"
zone: "{.cluster}"
hostname: "{.hostname}"
linode_transfer:
headers:
# https://cloud.linode.com/profile/tokens
Authorization: "Bearer XXXXXX"
metrics:
- name: json_linode_transfer_used
path: "{.used}"
- name: json_linode_transfer_quota
path: "{.quota}"

View File

@ -0,0 +1,95 @@
## Prometheus Statsd Exporter mapping for Mastodon 4.0+
##
## Version 1.0, November 2022
##
## Documentation: https://ipng.ch/s/articles/2022/11/27/mastodon-3.html
mappings:
## Web collector
- match: Mastodon\.production\.web\.(.+)\.(.+)\.(.+)\.status\.(.+)
match_type: regex
name: "mastodon_controller_status"
labels:
controller: $1
action: $2
format: $3
status: $4
mastodon: "web"
- match: Mastodon\.production\.web\.(.+)\.(.+)\.(.+)\.db_time
match_type: regex
name: "mastodon_controller_db_time"
labels:
controller: $1
action: $2
format: $3
mastodon: "web"
- match: Mastodon\.production\.web\.(.+)\.(.+)\.(.+)\.view_time
match_type: regex
name: "mastodon_controller_view_time"
labels:
controller: $1
action: $2
format: $3
mastodon: "web"
- match: Mastodon\.production\.web\.(.+)\.(.+)\.(.+)\.total_duration
match_type: regex
name: "mastodon_controller_duration"
labels:
controller: $1
action: $2
format: $3
mastodon: "web"
## Database collector
- match: Mastodon\.production\.db\.tables\.(.+)\.queries\.(.+)\.duration
match_type: regex
name: "mastodon_db_operation"
labels:
table: "$1"
operation: "$2"
mastodon: "db"
## Cache collector
- match: Mastodon\.production\.cache\.(.+)\.duration
match_type: regex
name: "mastodon_cache_duration"
labels:
operation: "$1"
mastodon: "cache"
## Sidekiq collector
- match: Mastodon\.production\.sidekiq\.(.+)\.processing_time
match_type: regex
name: "mastodon_sidekiq_worker_processing_time"
labels:
worker: "$1"
mastodon: "sidekiq"
- match: Mastodon\.production\.sidekiq\.(.+)\.success
match_type: regex
name: "mastodon_sidekiq_worker_success_total"
labels:
worker: "$1"
mastodon: "sidekiq"
- match: Mastodon\.production\.sidekiq\.(.+)\.failure
match_type: regex
name: "mastodon_sidekiq_worker_failure_total"
labels:
worker: "$1"
mastodon: "sidekiq"
- match: Mastodon\.production\.sidekiq\.queues\.(.+)\.enqueued
match_type: regex
name: "mastodon_sidekiq_queue_enqueued"
labels:
queue: "$1"
mastodon: "sidekiq"
- match: Mastodon\.production\.sidekiq\.queues\.(.+)\.latency
match_type: regex
name: "mastodon_sidekiq_queue_latency"
labels:
queue: "$1"
mastodon: "sidekiq"
- match: Mastodon\.production\.sidekiq\.(.+)
match_type: regex
name: "mastodon_sidekiq_$1"
labels:
mastodon: "sidekiq"

View File

@ -0,0 +1,80 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
- job_name: "node_exporter_metrics"
static_configs:
- targets: ["localhost:9100"]
- job_name: "redis_exporter_targets"
static_configs:
- targets: ["redis://localhost:6379"]
metrics_path: /scrape
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: localhost:9121
- job_name: "redis_exporter_metrics"
static_configs:
- targets: ["localhost:9121"]
- job_name: "postgres_exporter_metrics"
static_configs:
- targets: ["localhost:9187"]
- job_name: "nginx_exporter_metrics"
static_configs:
- targets: ["localhost:9113"]
- job_name: "statsd_exporter_metrics"
static_configs:
- targets: ["localhost:9102"]
- job_name: "elasticsearch_exporter_metrics"
static_configs:
- targets: ["localhost:9114"]
- job_name: "json_exporter_metrics"
static_configs:
- targets: ["localhost:9079"]
- job_name: "json_exporter_targets"
metrics_path: /probe
scrape_interval: 30s
params:
module: [linode_bucket]
static_configs:
- targets:
- https://api.linode.com/v4/object-storage/buckets/us-east-1/jarvis-mastodon
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: localhost:9079
- job_name: "json_exporter_targets"
metrics_path: /probe
scrape_interval: 30s
params:
module: [linode_transfer]
static_configs:
- targets:
- https://api.linode.com/v4/account/transfer
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: localhost:9079

View File

@ -98,7 +98,7 @@ scrape_configs:
metrics_path: /probe metrics_path: /probe
scrape_interval: 30s scrape_interval: 30s
params: params:
module: [linode] module: [linode_bucket]
static_configs: static_configs:
- targets: - targets:
- https://api.linode.com/v4/object-storage/buckets/us-east-1/jarvis-mastodon - https://api.linode.com/v4/object-storage/buckets/us-east-1/jarvis-mastodon
@ -109,6 +109,22 @@ scrape_configs:
target_label: instance target_label: instance
- target_label: __address__ - target_label: __address__
replacement: localhost:9079 replacement: localhost:9079
- job_name: "json_exporter_targets"
metrics_path: /probe
scrape_interval: 30s
params:
module: [linode_transfer]
static_configs:
- targets:
- https://api.linode.com/v4/account/transfer
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: localhost:9079
``` ```
--- ---
@ -117,7 +133,10 @@ json-config.yml:
```yml ```yml
modules: modules:
linode: linode_bucket:
headers:
# https://cloud.linode.com/profile/tokens
Authorization: "Bearer XXXXXX"
metrics: metrics:
- name: json_linode_size - name: json_linode_size
path: "{.size}" path: "{.size}"
@ -125,7 +144,6 @@ modules:
bucket: "{.label}" bucket: "{.label}"
zone: "{.cluster}" zone: "{.cluster}"
hostname: "{.hostname}" hostname: "{.hostname}"
- name: json_linode_objects - name: json_linode_objects
path: "{.objects}" path: "{.objects}"
labels: labels:
@ -133,9 +151,15 @@ modules:
zone: "{.cluster}" zone: "{.cluster}"
hostname: "{.hostname}" hostname: "{.hostname}"
linode_transfer:
headers: headers:
# https://cloud.linode.com/profile/tokens # https://cloud.linode.com/profile/tokens
Authorization: "Bearer XXXXXX" Authorization: "Bearer XXXXXX"
metrics:
- name: json_linode_transfer_used
path: "{.used}"
- name: json_linode_transfer_quota
path: "{.quota}"
``` ```
--- ---