Re-usable list of exporters usually used with Prometheus
Bundled exporters:
Example of usage:
Simple
- {
role: "sa-prometheus-exporters"
}
Each exporter gets configured via OPTIONS specified in environment file located at /etc/prometheus/exporters/exportername_exporter
Additionally, you have possibility to influence systemd service file itself, see advanced section
OPTIONS=" --some-exporter-params --some-exporter-params --some-exporter-params --some-exporter-params"
Advanced
box_prometheus_exporters:
- {
name: some_exporter,
exporter_configuration_template: "/path/to/template/with/console/params/for/exporter",
exporter_user: prometheus,
exporter_group: prometheus,
startup: {
env:
- ENV_VAR1: "ENV_VAR1 value",
- ENV_VAR2: "ENV_VAR1 value"
execstop: "/some/script/to/execute/on/stop",
pidfile: "/if/you/need/pidfile",
extralines:
- "IF YOU WANT"
- "SOME REALLY CUSTOM STUFF"
- "in Service section of the systemd file"
- "(see templates folder)"
}
}
- {
name: blackbox
}
- {
name: elasticsearch
}
- {
name: postgres
}
- {
name: cadvisor
}
- {
name: mongodb
}
- {
name: redis
}
- {
name: sql
}
- {
name: memcached
}
- {
name: mysqld,
parameters: "-config.my-cnf=/etc/prometheus/.mycnf -collect.binlog_size=true -collect.info_schema.processlist=true"
}
- {
name: ecs,
parameters: "--aws.region='us-east-1'"
}
roles:
- {
role: "sa-prometheus-exporters",
prometheus_exporters: "{{box_prometheus_exporters}}"
}
Best served with grafana dashboards from percona https://github.com/percona/grafana-dashboards
For those you need to add parameter
-collect.binlog_size=true -collect.info_schema.processlist=true
additionally create exporter mysql user
CREATE USER 'prometheus_exporter'@'localhost' IDENTIFIED BY 'XXX' WITH MAX_USER_CONNECTIONS 3;
GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'prometheus_exporter'@'localhost';then either ensure environment variable in startup script (see configuration example in advanced)
export DATA_SOURCE_NAME='prometheus_exporter:XXX@(localhost:3306)/'or
create ~/.my.cnf
-config.my-cnf=/etc/prometheus/.mycnf -collect.binlog_size=true -collect.info_schema.processlist=true
[client]
user=prometheus_exporter
password=XXXXXXFor presentation, consider grafana dashboards , like
https://github.com/percona/grafana-dashboards
Recommended approach - is to use dedicated user for stats collecting
create exporter postgres_exporter user
CREATE USER postgres_exporter PASSWORD 'XXXX';
ALTER USER postgres_exporter SET SEARCH_PATH TO postgres_exporter,pg_catalog;As you are running as non postgres user, you would need to create views to read statistics information
-- If deploying as non-superuser (for example in AWS RDS)
-- GRANT postgres_exporter TO :MASTER_USER;
CREATE SCHEMA postgres_exporter AUTHORIZATION postgres_exporter;
CREATE VIEW postgres_exporter.pg_stat_activity
AS
SELECT * from pg_catalog.pg_stat_activity;
GRANT SELECT ON postgres_exporter.pg_stat_activity TO postgres_exporter;
CREATE VIEW postgres_exporter.pg_stat_replication AS
SELECT * from pg_catalog.pg_stat_replication;
GRANT SELECT ON postgres_exporter.pg_stat_replication TO postgres_exporter;in /etc/prometheus/exporters/postgres_exporter
OPTIONS="some parameters"
DATA_SOURCE_NAME="login:password@(hostname:port)/"
Assuming, you provided above exporter is ready to operate.
For presentation, consider grafana dashboards , like
https://grafana.com/dashboards/3300
https://grafana.com/dashboards/3742
If you installed the sa-prometheus-exporters role using the command
ansible-galaxy install softasap.sa-prometheus-exporters
the role will be available in the folder library/softasap.sa-prometheus-exporters
Please adjust the path accordingly.
- {
role: "softasap.sa-nginx"
}
Code is dual licensed under the [BSD 3 clause] (https://opensource.org/licenses/BSD-3-Clause) and the [MIT License] (http://opensource.org/licenses/MIT). Choose the one that suits you best.
Reach us:
Subscribe for roles updates at [FB] (https://www.facebook.com/SoftAsap/)
Join gitter discussion channel at Gitter
Discover other roles at http://www.softasap.com/roles/registry_generated.html
visit our blog at http://www.softasap.com/blog/archive.html