{"id":13583851,"url":"https://github.com/softasap/sa-prometheus-exporters","last_synced_at":"2025-04-06T21:33:15.099Z","repository":{"id":28278842,"uuid":"116368333","full_name":"softasap/sa-prometheus-exporters","owner":"softasap","description":"Collection of the preselected prometheus exporters to be installed on a target nodes","archived":false,"fork":false,"pushed_at":"2023-02-08T01:20:17.000Z","size":283,"stargazers_count":20,"open_issues_count":12,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-02T15:53:58.570Z","etag":null,"topics":["ansible","blackbox-exporter","cadvisor-exporter","cloudwatch-exporter","ecs-exporter","elasticsearch-exporter","memcached-exporter","mongodb-exporter","monit-exporter","mysql-exporter","node-exporter","phpfpm-exporter","postgres-exporter","prometheus","prometheus-exporter","redis-exporter","sql-exporter","ssl-exporter"],"latest_commit_sha":null,"homepage":null,"language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/softasap.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-01-05T09:38:07.000Z","updated_at":"2023-11-14T22:21:30.000Z","dependencies_parsed_at":"2023-02-14T02:25:16.661Z","dependency_job_id":null,"html_url":"https://github.com/softasap/sa-prometheus-exporters","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softasap%2Fsa-prometheus-exporters","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softasap%2Fsa-prometheus-exporters/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softasap%2Fsa-prometheus-exporters/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softasap%2Fsa-prometheus-exporters/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softasap","download_url":"https://codeload.github.com/softasap/sa-prometheus-exporters/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223264980,"owners_count":17116259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","blackbox-exporter","cadvisor-exporter","cloudwatch-exporter","ecs-exporter","elasticsearch-exporter","memcached-exporter","mongodb-exporter","monit-exporter","mysql-exporter","node-exporter","phpfpm-exporter","postgres-exporter","prometheus","prometheus-exporter","redis-exporter","sql-exporter","ssl-exporter"],"created_at":"2024-08-01T15:03:50.895Z","updated_at":"2024-11-06T00:30:51.635Z","avatar_url":"https://github.com/softasap.png","language":"Jinja","funding_links":[],"categories":["Jinja"],"sub_categories":[],"readme":"sa-prometheus-exporters\n=======================\n\n[![Build Status](https://travis-ci.org/softasap/sa-prometheus-exporters.svg?branch=master)](https://travis-ci.org/softasap/sa-prometheus-exporters)\n\nRe-usable list of exporters usually used with Prometheus\n\nBundled exporters:\n\n| Exporter | Description | Port | Grafana | Example | Github |\n| --- | --- | --- | --- | --- | --- |\n| node | Server params | 9100 | 1860  | http://192.168.2.66:9100/metrics | [prometheus/node_exporter](https://github.com/prometheus/node_exporter/) |\n| mysqld | Prometheus MySQL exporter | 9104 | 7362 | http://192.168.2.66:9104/metrics | [prometheus/mysqld_exporter](https://github.com/prometheus/mysqld_exporter/) |\n| elasticsearch | Elastic search | 9108 | 2322 | http://192.168.2.66:9108/metrics | [justwatchcom/elasticsearch_exporter](https://github.com/justwatchcom/elasticsearch_exporter/) |\n| nginx | Nginx exporter | 9113 | 11199 | http://192.168.2.66:9115/metrics | [nginxinc/nginx-prometheus-exporter](https://github.com/nginxinc/nginx-prometheus-exporter) |\n| blackbox | External services | 9115 | | http://192.168.2.66:9115/metrics | [prometheus/blackbox_exporter](https://github.com/prometheus/blackbox_exporter/) |\n| apache | Apache webserver | 9117 | | http://192.168.2.66:9117/metrics | [Lusitaniae/apache_exporter](https://github.com/Lusitaniae/apache_exporter/) |\n| redis | Redis exporter | 9121 | 763  | http://192.168.2.66:9121/metrics | [oliver006/redis_exporter](https://github.com/oliver006/redis_exporter/) |\n| proxysql | ProxySQL exporter | 42004 | | http://192.168.2.66:42004/metrics | [percona/proxysql_exporter](https://github.com/percona/proxysql_exporter) |\n| memcached | memcached health | 9150 | 37 | http://192.168.2.66:9150/metrics | [prometheus/memcached_exporter](https://github.com/prometheus/memcached_exporter/) |\n| postgres | postgres exporter | 9187 | | http://192.168.2.66:9187/metrics | [wrouesnel/postgres_exporter](https://github.com/wrouesnel/postgres_exporter/) |\n| mongodb | Percona's mongodb exporter | 9216 | | http://192.168.2.66:9216/metrics | [percona/mongodb_exporter](https://github.com/percona/mongodb_exporter/) |\n| ssl | ssl exporter | 9219 | | http://192.168.2.66:9219/metrics | [ribbybibby/ssl_exporter](https://github.com/ribbybibby/ssl_exporter) |\n| ecs | aws ecs exporter | 9222 | | http://192.168.2.66:9222/metrics | [slok/ecs-exporter](https://github.com/slok/ecs-exporter) |\n| sql | custom sql exporter | 9237 | | http://192.168.2.66:9237/metrics | [justwatchcom/sql_exporter](https://github.com/justwatchcom/sql_exporter) |\n| phpfpm | php fpm exporter via sock | 9253 | 5579 | http://192.168.2.66:9253/metrics | [Lusitaniae/phpfpm_exporter](https://github.com/Lusitaniae/phpfpm_exporter) |\n| cadvisor | Google's cadvisor exporter | 9280 (configurable) | | http://192.168.2.66:9280/metrics | [google/cadvisor](https://github.com/google/cadvisor/) |\n| monit | Monit exporter | 9388 (configurable) | | http://192.168.2.66:9388/metrics | [commercetools/monit_exporter](https://github.com/commercetools/monit_exporter) |\n| cloudwatch | Cloudwatch exporter | 9400 (configurable) | | http://192.168.2.66:9400/metrics | [ivx/yet-another-cloudwatch-exporter](https://github.com/ivx/yet-another-cloudwatch-exporter) |\n\nExample of usage:\n\nSimple\n\n```YAML\n\n     - {\n         role: \"sa-prometheus-exporters\"\n       }\n\n\n```\n\nEach exporter gets configured via OPTIONS specified in environment file located at `/etc/prometheus/exporters/exportername_exporter`\nAdditionally, you have possibility to influence systemd service file itself, see advanced section\n\n```shell\nOPTIONS=\" --some-exporter-params --some-exporter-params --some-exporter-params --some-exporter-params\"\n\n```\n\nAdvanced\n\n```YAML\n\nbox_prometheus_exporters:\n  - {\n      name: some_exporter,\n      exporter_configuration_template: \"/path/to/template/with/console/params/for/exporter\",\n      exporter_user: prometheus,\n      exporter_group: prometheus,\n      startup: {\n        env:\n          - ENV_VAR1: \"ENV_VAR1 value\",\n          - ENV_VAR2: \"ENV_VAR1 value\"\n\n        execstop: \"/some/script/to/execute/on/stop\",\n        pidfile: \"/if/you/need/pidfile\",\n        extralines:\n          - \"IF YOU WANT\"\n          - \"SOME REALLY CUSTOM STUFF\"\n          - \"in Service section of the systemd file\"\n          - \"(see templates folder)\"\n      }\n\n    }\n  - {\n      name: apache\n    }\n  - {\n      name: blackbox\n    }\n  - {\n      name: cadvisor\n    }\n  - {\n      name: ecs,\n      parameters: \"--aws.region='us-east-1'\"\n    }\n  - {\n      name: elasticsearch\n    }\n  - {\n      name: memcached\n    }\n  - {\n      name: mongodb\n    }\n  - {\n      name: monit,\n      monit_user: \"admin\",\n      monit_password: \"see_box_example_for_example_)\",\n      listen_address: \"0.0.0.0:9388\"\n    }\n  - {\n      name: mysqld,\n      parameters: \"-config.my-cnf=/etc/prometheus/.mycnf -collect.binlog_size=true -collect.info_schema.processlist=true\"\n    }\n  - {\n      name: node\n    }\n  - {\n      name: nginx,\n      parameters: \"-nginx.scrape-uri http://\u003cnginx\u003e:8080/stub_status\n    }\n  - {\n      name: proxysql\n    }\n  - {\n      name: phpfpm,\n      exporter_user: \"www-data\",\n      parameters: \"--phpfpm.socket-paths /var/run/php/php7.0-fpm.sock\"\n    }\n  - {\n      name: postgres\n    }\n  - {\n      name: redis\n    }\n  - {\n      name: sql\n    }\n  - {\n      name: ssl\n    }\n\n\nroles:\n\n     - {\n         role: \"sa-prometheus-exporters\",\n         prometheus_exporters: \"{{box_prometheus_exporters}}\"\n       }\n\n\n```\n\nMore exporters to consider:   https://prometheus.io/docs/instrumenting/exporters/\n\nIf you want some to be included into role defaults, open the issue or PR (preferable)\n\nmysqld exporter configuration\n-----------------------------\n\nBest served with grafana dashboards from percona https://github.com/percona/grafana-dashboards\n\nFor those you need to add parameter\n`-collect.binlog_size=true -collect.info_schema.processlist=true`\n\nadditionally create exporter mysql user\n\n```sql\nCREATE USER 'prometheus_exporter'@'localhost' IDENTIFIED BY 'XXX' WITH MAX_USER_CONNECTIONS 3;\nGRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'prometheus_exporter'@'localhost';\n```\n\nthen either ensure environment variable in startup script (see configuration example in advanced)\n```shell\nexport DATA_SOURCE_NAME='prometheus_exporter:XXX@(localhost:3306)/'\n```\n\nalso option to do that via exporter environment file `/etc/prometheus/exporters/mysqld_exporter`\n```\nOPTIONS=\"\"\nDATA_SOURCE_NAME='prometheus_exporter:devroot@(localhost:3306)/'\n```\n\nor\n\ncreate  ~/.my.cnf\n\n-config.my-cnf=/etc/prometheus/.mycnf -collect.binlog_size=true -collect.info_schema.processlist=true\n\n```ini\n[client]\nuser=prometheus_exporter\npassword=XXXXXX\n```\n\nFor presentation, consider grafana dashboards , like\n\nhttps://github.com/percona/grafana-dashboards\n\nFor troubleshouting, must have grafana dashboard is  https://grafana.com/dashboards/456\n\n\napache exporter configuration\n-----------------------------\n\napache\tServer params\t9117\thttp://192.168.2.66:9117/metrics\tLusitaniae/apache_exporter\n\n\nprometheus.yml\n```\n  - job_name: \"apache\"\n    ec2_sd_configs:\n      - region: us-east-1\n        port: 9117\n    relabel_configs:\n        # Only monitor instances with a non-no Prometheus tag\n      - source_labels: [__meta_ec2_tag_Prometheus]\n        regex: no\n        action: drop\n      - source_labels: [__meta_ec2_instance_state]\n        regex: stopped\n        action: drop\n        # Use the instance ID as the instance label\n      - source_labels: [__meta_ec2_instance_id]\n        target_label: instance\n      - source_labels: [__meta_ec2_tag_Name]\n        target_label: name\n      - source_labels: [__meta_ec2_tag_Environment]\n        target_label: env\n      - source_labels: [__meta_ec2_tag_Role]\n        target_label: role\n      - source_labels: [__meta_ec2_public_ip]\n        regex: (.*)\n        replacement: ${1}:9117\n        action: replace\n        target_label: __address__\n```\n\nGrafana dashboard compatible with this exporter is, for example  https://grafana.com/dashboards/3894\n\nblackbox exporter configuration\n-------------------------------\n\nBlackbox exporter running on a monitoring host can, for example be used\n\nExample: monitoring ssh connectivity for external boxes\n\nprometheus.yml\n```\n  - job_name: 'blackbox_ssh'\n    metrics_path: /probe\n    params:\n      module: [ssh_banner]\n    ec2_sd_configs:\n      - region: us-east-1\n        port: 9100\n    relabel_configs:\n        # Only monitor instances with a non-no Prometheus tag\n      - source_labels: [__meta_ec2_tag_Prometheus]\n        regex: no\n        action: drop\n      - source_labels: [__meta_ec2_instance_state]\n        regex: stopped\n        action: drop\n        # Use the instance ID as the instance label\n      - source_labels: [__meta_ec2_instance_id]\n        target_label: instance\n      - source_labels: [__meta_ec2_tag_Name]\n        target_label: name\n      - source_labels: [__meta_ec2_tag_Environment]\n        target_label: env\n      - source_labels: [__meta_ec2_tag_Role]\n        target_label: role\n      - source_labels: [__meta_ec2_private_ip]\n        regex: (.*)(:.*)?\n        replacement: ${1}:22\n        target_label: __param_target\n      # Actually talk to the blackbox exporter though\n      - target_label: __address__\n        replacement: 127.0.0.1:9115\n\n```\n\nAnd in a result you can tune prometheus alert manager to alert if you got issues with ssh connectivity\n\n/etc/prometheus/rules/ssh_alerts.yml\n```\ngroups:\n- name: ssh_alerts.rules\n  rules:\n  - alert: SSHDown\n    expr: probe_success{job=\"blackbox_ssh\"} == 0\n    annotations:\n      description: '[{{ $labels.env }}]{{ $labels.instance }} {{ $labels.name }} of job {{ $labels.job }} is not responding on ssh.'\n      summary: 'Instance {{ $labels.instance }} has possible ssh issue'\n    for: 10m\n```\n\n\nmemcached exporter configuration\n--------------------------------\n\nmemcached\tmemcached health\t9150\thttp://192.168.2.66:9150/metrics\tprometheus/memcached_exporter\n\n\nprometheus.yml\n```\n  - job_name: \"memcached\"\n    ec2_sd_configs:\n      - region: us-east-1\n        port: 9150\n    relabel_configs:\n        # Only monitor instances with a non-no Prometheus tag\n      - source_labels: [__meta_ec2_tag_Prometheus]\n        regex: no\n        action: drop\n      - source_labels: [__meta_ec2_instance_state]\n        regex: stopped\n        action: drop\n        # Use the instance ID as the instance label\n      - source_labels: [__meta_ec2_instance_id]\n        target_label: instance\n      - source_labels: [__meta_ec2_tag_Name]\n        target_label: name\n      - source_labels: [__meta_ec2_tag_Environment]\n        target_label: env\n      - source_labels: [__meta_ec2_tag_Role]\n        target_label: role\n      - source_labels: [__meta_ec2_public_ip]\n        regex: (.*)\n        replacement: ${1}:9150\n        action: replace\n        target_label: __address__\n```\n\nCompatible grafana dashboard\nhttps://grafana.com/dashboards/37\n\n\n\n\nnode exporter configuration\n---------------------------\n\nnode\tServer params\t9100\thttp://192.168.2.66:9100/metrics\tprometheus/node_exporter\n\nAuto discovery in aws cloud, with filtering\n\nprometheus.yml\n```\n  - job_name: \"node\"\n    ec2_sd_configs:\n      - region: us-east-1\n        port: 9100\n    relabel_configs:\n        # Only monitor instances with a non-no Prometheus tag\n      - source_labels: [__meta_ec2_tag_Prometheus]\n        regex: no\n        action: drop\n      - source_labels: [__meta_ec2_instance_state]\n        regex: stopped\n        action: drop\n        # Use the instance ID as the instance label\n      - source_labels: [__meta_ec2_instance_id]\n        target_label: instance\n      - source_labels: [__meta_ec2_tag_Name]\n        target_label: name\n      - source_labels: [__meta_ec2_tag_Environment]\n        target_label: env\n      - source_labels: [__meta_ec2_tag_Role]\n        target_label: role\n      - source_labels: [__meta_ec2_public_ip]\n        regex: (.*)\n        replacement: ${1}:9100\n        action: replace\n        target_label: __address__\n```\n\nSome reasonable set of linked prometheus alerts to consider\n\n/etc/prometheus/rules/node_alerts.yml\n```\ngroups:\n- name: node_alerts.rules\n  rules:\n  - alert: LowDiskSpace\n    expr: node_filesystem_avail{fstype=~\"(ext.|xfs)\",job=\"node\"} / node_filesystem_size{fstype=~\"(ext.|xfs)\",job=\"node\"}* 100 \u003c= 10\n    for: 15m\n    labels:\n      severity: warn\n    annotations:\n      title: 'Less than 10% disk space left'\n      description: |\n        Consider sshing into the instance and removing old logs, clean\n        temp files, or remove old apt packages with `apt-get autoremove`\n      runbook: troubleshooting/filesystem_alerts.md\n      value: '{{ $value | humanize }}%'\n      device: '{{ $labels.device }}%'\n      mount_point: '{{ $labels.mountpoint }}%'\n  - alert: NoDiskSpace\n    expr: node_filesystem_avail{fstype=~\"(ext.|xfs)\",job=\"node\"} / node_filesystem_size{fstype=~\"(ext.|xfs)\",job=\"node\"}* 100 \u003c= 1\n    for: 15m\n    labels:\n      pager: pagerduty\n      severity: critical\n    annotations:\n      title: '1% disk space left'\n      description: \"There's only 1% disk space left\"\n      runbook: troubleshooting/filesystem_alerts.md\n      value: '{{ $value | humanize }}%'\n      device: '{{ $labels.device }}%'\n      mount_point: '{{ $labels.mountpoint }}%'\n\n  - alert: HighInodeUsage\n    expr: node_filesystem_files_free{fstype=~\"(ext.|xfs)\",job=\"node\"} / node_filesystem_files{fstype=~\"(ext.|xfs)\",job=\"node\"}* 100 \u003c= 20\n    for: 15m\n    labels:\n      severity: critical\n    annotations:\n      title: \"High number of inode usage\"\n      description: |\n        \"Consider ssh'ing into the instance and removing files or clean\n        temp files\"\n      runbook: troubleshooting/filesystem_alerts_inodes.md\n      value: '{{ $value | printf \"%.2f\" }}%'\n      device: '{{ $labels.device }}%'\n      mount_point: '{{ $labels.mountpoint }}%'\n\n  - alert: ExtremelyHighCPU\n    expr: instance:node_cpu_in_use:ratio \u003e 0.95\n    for: 2h\n    labels:\n      pager: pagerduty\n      severity: critical\n    annotations:\n      description: CPU use percent is extremely high on {{ if $labels.fqdn }}{{ $labels.fqdn\n        }}{{ else }}{{ $labels.instance }}{{ end }} for the past 2 hours.\n      runbook: troubleshooting\n      title: CPU use percent is extremely high on {{ if $labels.fqdn }}{{ $labels.fqdn\n        }}{{ else }}{{ $labels.instance }}{{ end }} for the past 2 hours.\n\n  - alert: HighCPU\n    expr: instance:node_cpu_in_use:ratio \u003e 0.8\n    for: 2h\n    labels:\n      severity: critical\n    annotations:\n      description: CPU use percent is extremely high on {{ if $labels.fqdn }}{{ $labels.fqdn\n        }}{{ else }}{{ $labels.instance }}{{ end }} for the past 2 hours.\n      runbook: troubleshooting\n      title: CPU use percent is high on {{ if $labels.fqdn }}{{ $labels.fqdn }}{{\n        else }}{{ $labels.instance }}{{ end }} for the past 2 hours.\n\n```\n\nGrafana dashboard might be   https://grafana.com/dashboards/22 (label_values(node_exporter_build_info, instance))\n\nConsider:  https://grafana.com/dashboards/6014 or https://grafana.com/dashboards/718\n\n\nnginx exporter configuration\n----------------------------\n\nAdditional parameters for that might be passed for nginx-prometheus-exporter:\n  -nginx.plus\n        Start the exporter for NGINX Plus. By default, the exporter is started for NGINX. The default value can be overwritten by NGINX_PLUS environment variable.\n  -nginx.retries int\n        A number of retries the exporter will make on start to connect to the NGINX stub_status page/NGINX Plus API before exiting with an error. The default value can be overwritten by NGINX_RETRIES environment variable.\n  -nginx.retry-interval duration\n        An interval between retries to connect to the NGINX stub_status page/NGINX Plus API on start. The default value can be overwritten by NGINX_RETRY_INTERVAL environment variable. (default 5s)\n  -nginx.scrape-uri string\n        A URI for scraping NGINX or NGINX Plus metrics.\n        For NGINX, the stub_status page must be available through the URI. For NGINX Plus -- the API. The default value can be overwritten by SCRAPE_URI environment variable. (default \"http://127.0.0.1:8080/stub_status\")\n  -nginx.ssl-verify\n        Perform SSL certificate verification. The default value can be overwritten by SSL_VERIFY environment variable. (default true)\n  -nginx.timeout duration\n        A timeout for scraping metrics from NGINX or NGINX Plus. The default value can be overwritten by TIMEOUT environment variable. (default 5s)\n  -web.listen-address string\n        An address to listen on for web interface and telemetry. The default value can be overwritten by LISTEN_ADDRESS environment variable. (default \":9113\")\n  -web.telemetry-path string\n        A path under which to expose metrics. The default value can be overwritten by TELEMETRY_PATH environment variable. (default \"/metrics\")\n\nExported metrics\n\nExported Metrics\nCommon metrics:\n\nnginxexporter_build_info -- shows the exporter build information.\nFor NGINX, the following metrics are exported:\n\nAll stub_status metrics.\nnginx_up -- shows the status of the last metric scrape: 1 for a successful scrape and 0 for a failed one.\nConnect to the /metrics page of the running exporter to see the complete list of metrics along with their descriptions.\n\nFor NGINX Plus, the following metrics are exported:\n\nConnections.\nHTTP.\nSSL.\nHTTP Server Zones.\nStream Server Zones.\nHTTP Upstreams. Note: for the state metric, the string values are converted to float64 using the following rule: \"up\" -\u003e 1.0, \"draining\" -\u003e 2.0, \"down\" -\u003e 3.0, \"unavail\" –\u003e 4.0, \"checking\" –\u003e 5.0, \"unhealthy\" -\u003e 6.0.\nStream Upstreams. Note: for the state metric, the string values are converted to float64 using the following rule: \"up\" -\u003e 1.0, \"down\" -\u003e 3.0, \"unavail\" –\u003e 4.0, \"checking\" –\u003e 5.0, \"unhealthy\" -\u003e 6.0.\nStream Zone Sync.\nnginxplus_up -- shows the status of the last metric scrape: 1 for a successful scrape and 0 for a failed one.\nLocation Zones.\nResolver.\nConnect to the /metrics page of the running exporter to see the complete list of metrics along with their descriptions. Note: to see server zones related metrics you must configure status zones and to see upstream related metrics you must configure upstreams with a shared memory zone.\n\n\nYou would need also activate\n\n```\nlocation /stub_status {\n \tstub_status;\n \tallow 127.0.0.1;\t#only allow requests from localhost\n \tdeny all;\t\t#deny all other hosts\n }\n```\n\nphpfpm exporter configuration\n-----------------------------\n\nphpfpm\tphp fpm exporter via sock\t9253\thttp://192.168.2.66:9253/metrics\tLusitaniae/phpfpm_exporter\n\n\nPay attention to configuration\n\nFirst of all, exporter should work under user, that can read php-fpm sock (for example www-data if you used sa-php-fpm role),\nSecond - you should provide path to sock, like `--phpfpm.socket-paths /var/run/php/php7.0-fpm.sock`\n\n```yaml\n      exporter_user: \"www-data\",\n      parameters: \"--phpfpm.socket-paths /var/run/php/php7.0-fpm.sock\"\n```\n\nThird, the FPM status page must be enabled in every pool you'd like to monitor by defining pm.status_path = /status\n\n\nAuto discovery in aws cloud, with filtering\n\nprometheus.yml\n```\n  - job_name: \"phpfpm\"\n    ec2_sd_configs:\n      - region: us-east-1\n        port: 9253\n    relabel_configs:\n        # Only monitor instances with a non-no Prometheus tag\n      - source_labels: [__meta_ec2_tag_Prometheus]\n        regex: no\n        action: drop\n      - source_labels: [__meta_ec2_instance_state]\n        regex: stopped\n        action: drop\n        # Use the instance ID as the instance label\n      - source_labels: [__meta_ec2_instance_id]\n        target_label: instance\n      - source_labels: [__meta_ec2_tag_Name]\n        target_label: name\n      - source_labels: [__meta_ec2_tag_Environment]\n        target_label: env\n      - source_labels: [__meta_ec2_tag_Role]\n        target_label: role\n      - source_labels: [__meta_ec2_public_ip]\n        regex: (.*)\n        replacement: ${1}:9253\n        action: replace\n        target_label: __address__\n```\n\nLinked grafana dashboard:\n\nhttps://grafana.com/dashboards/5579  (single pool)\n\nhttps://grafana.com/dashboards/5714 (multiple pools)\n\n\npostgres exporter configuration\n--------------------------------\n\nRecommended approach - is to use dedicated user for stats collecting\n\ncreate exporter `postgres_exporter` user\n\n```sql\nCREATE USER postgres_exporter PASSWORD 'XXXX';\nALTER USER postgres_exporter SET SEARCH_PATH TO postgres_exporter,pg_catalog;\n```\n\nAs you are running as non postgres user, you would need to create views\nto read statistics information\n\n```sql\n\n-- If deploying as non-superuser (for example in AWS RDS)\n-- GRANT postgres_exporter TO :MASTER_USER;\nCREATE SCHEMA postgres_exporter AUTHORIZATION postgres_exporter;\n\nCREATE VIEW postgres_exporter.pg_stat_activity\nAS\n  SELECT * from pg_catalog.pg_stat_activity;\n\nGRANT SELECT ON postgres_exporter.pg_stat_activity TO postgres_exporter;\n\nCREATE VIEW postgres_exporter.pg_stat_replication AS\n  SELECT * from pg_catalog.pg_stat_replication;\n\nGRANT SELECT ON postgres_exporter.pg_stat_replication TO postgres_exporter;\n```\n\nin `/etc/prometheus/exporters/postgres_exporter`\n\n```\nOPTIONS=\"some parameters\"\nDATA_SOURCE_NAME=\"login:password@(hostname:port)/\"\n```\n\nAssuming, you provided above exporter is ready to operate.\n\nFor presentation, consider grafana dashboards , like\n\nhttps://grafana.com/dashboards/3300\n\nhttps://grafana.com/dashboards/3742\n\n\nBlackbox exporter notes\n-----------------------\n\nstartup options should be kind of\n```\nOPTIONS=\"--config.file=/opt/prometheus/exporters/blackbox_exporter/blackbox.yml\"\n```\n\nwhere blackbox.yml is\n\n```yaml\n\nmodules:\n  http_2xx:\n    prober: http\n    http:\n  http_post_2xx:\n    prober: http\n    http:\n      method: POST\n  tcp_connect:\n    prober: tcp\n  pop3s_banner:\n    prober: tcp\n    tcp:\n      query_response:\n      - expect: \"^+OK\"\n      tls: true\n      tls_config:\n        insecure_skip_verify: false\n  ssh_banner:\n    prober: tcp\n    tcp:\n      query_response:\n      - expect: \"^SSH-2.0-\"\n  irc_banner:\n    prober: tcp\n    tcp:\n      query_response:\n      - send: \"NICK prober\"\n      - send: \"USER prober prober prober :prober\"\n      - expect: \"PING :([^ ]+)\"\n        send: \"PONG ${1}\"\n      - expect: \"^:[^ ]+ 001\"\n  icmp:\n    prober: icmp\n```\n\n\ncloudwatch exporter configuration\n---------------------------------\n\nYou will need to give appropriate rights to your monitoring instance\n\n```tf\n\nresource \"aws_iam_role\" \"monitoring_iam_role\" {\n  name = \"monitoring_iam_role\"\n  assume_role_policy = \u003c\u003cEOF\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Sid\": \"\",\n      \"Effect\": \"Allow\",\n      \"Principal\": {\n        \"Service\": [\n          \"ec2.amazonaws.com\"\n        ]\n      },\n      \"Action\": \"sts:AssumeRole\"\n    }\n  ]\n}\nEOF\n}\n\nresource \"aws_iam_role_policy_attachment\" \"ec2-read-only-policy-attachment\" {\n  role = \"${aws_iam_role.monitoring_iam_role.name}\"\n  policy_arn = \"arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess\"\n}\n\nresource \"aws_iam_role_policy_attachment\" \"CloudWatchFullAccess\" {\n  role = \"${aws_iam_role.monitoring_iam_role.name}\"\n  policy_arn = \"arn:aws:iam::aws:policy/CloudWatchFullAccess\"\n}\n\n\nresource \"aws_iam_role_policy_attachment\" \"ec2-read-only-policy-attachment\" {\n  role = \"${aws_iam_role.monitoring_iam_role.name}\"\n  policy_arn = \"arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess\"\n}\n\nresource \"aws_iam_role_policy_attachment\" \"CloudWatchFullAccess\" {\n  role = \"${aws_iam_role.monitoring_iam_role.name}\"\n  policy_arn = \"arn:aws:iam::aws:policy/CloudWatchFullAccess\"\n}\n\nresource \"aws_iam_role_policy\" \"iam_role_policy_prometheuscloudwatch\" {\n  name = \"iam_role_policy_prometheuscloudwatch\"\n  role = \"${aws_iam_role.monitoring_iam_role.id}\"\n  policy = \u003c\u003cEOF\n{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n        {\n            \"Sid\": \"prometheuscloudwatchexporter\",\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"tag:GetResources\",\n                \"cloudwatch:GetMetricStatistics\",\n                \"cloudwatch:ListMetrics\"\n            ],\n            \"Resource\": \"*\"\n        }\n    ]\n}\nEOF\n}\n\n```\n\nconfig.yml by default is scripted to give you idea about possibilities.\nAmend it. You should adjust it's structure to your environment\n\n\n```\ndiscovery:\n  exportedTagsOnMetrics:\n    vpn:\n      - Project\n      - Name\n    elb:\n      - Project\n      - Name\n    rds:\n      - Project\n      - Name\n    ec:\n     - Project\n     - Name\n    lambda:\n     - Project\n     - Name\n    alb:\n     - Project\n     - Name\n\n  jobs:\n  - region: {{ ec2_region }}\n    type: \"vpn\"\n    searchTags:\n      - Key: {{ prometheus_yace_tag_filter }}\n        Value: {{ prometheus_yace_tag_value }}\n    metrics:\n      - name: TunnelState\n        statistics:\n        - 'Maximum'\n        period: 60\n        length: 300\n      - name: TunnelDataOut\n        statistics:\n        - 'Sum'\n        period: 60\n        length: 300\n      - name: TunnelDataIn\n        statistics:\n        - 'Sum'\n        period: 60\n        length: 300\n  - region: {{ ec2_region }}\n    type: \"lambda\"\n    searchTags:\n      - Key: {{ prometheus_yace_tag_filter }}\n        Value: {{ prometheus_yace_tag_value }}\n    metrics:\n      - name: Throttles\n        statistics:\n        - 'Average'\n        period: 60\n        length: 300\n      - name: Invocations\n        statistics:\n        - 'Sum'\n        period: 60\n        length: 300\n      - name: Errors\n        statistics:\n        - 'Sum'\n        period: 60\n        length: 300\n      - name: Duration\n        statistics:\n        - 'Average'\n        period: 60\n        length: 300\n      - name: Duration\n        statistics:\n        - 'Minimum'\n        period: 60\n        length: 300\n      - name: Duration\n        statistics:\n        - 'Maximum'\n        period: 60\n        length: 300\n  - region: {{ ec2_region }}\n    type: \"ec\"\n    searchTags:\n      - Key: {{ prometheus_yace_tag_filter }}\n        Value: {{ prometheus_yace_tag_value }}\n    metrics:\n      - name: NewConnections\n        statistics:\n        - 'Sum'\n        period: 60\n        length: 300\n      - name: GetTypeCmds\n        statistics:\n        - 'Sum'\n        period: 60\n        length: 300\n      - name: SetTypeCmds\n        statistics:\n        - 'Sum'\n        period: 60\n        length: 300\n      - name: CacheMisses\n        statistics:\n        - 'Sum'\n        period: 60\n        length: 300\n      - name: CacheHits\n        statistics:\n        - 'Sum'\n        period: 60\n        length: 300\n  - region: {{ ec2_region }}\n    type: \"rds\"\n    searchTags:\n      - Key: {{ prometheus_yace_tag_filter }}\n        Value: {{ prometheus_yace_tag_value }}\n    metrics:\n      - name: DatabaseConnections\n        statistics:\n        - 'Sum'\n        period: 60\n        length: 300\n      - name: ReadIOPS\n        statistics:\n        - 'Sum'\n        period: 60\n        length: 300\n      - name: WriteIOPS\n        statistics:\n        - 'Sum'\n        period: 60\n        length: 300\n  - region: {{ ec2_region }}\n    type: \"elb\"\n    searchTags:\n      - Key: {{ prometheus_yace_tag_filter }}\n        Value: {{ prometheus_yace_tag_value }}\n    metrics:\n      - name: RequestCount\n        statistics:\n        - 'Sum'\n        period: 60\n        length: 300\n      - name: HealthyHostCount\n        statistics:\n        - 'Minimum'\n        period: 60\n        length: 300\n      - name: UnHealthyHostCount\n        statistics:\n        - 'Maximum'\n        period: 60\n        length: 300\n      - name: HTTPCode_Backend_2XX\n        statistics:\n        - 'Sum'\n        period: 60\n        length: 300\n      - name: HTTPCode_Backend_5XX\n        statistics:\n        - 'Sum'\n        period: 60\n        length: 300\n      - name: HTTPCode_Backend_4XX\n        statistics:\n        - 'Sum'\n        period: 60\n        length: 300\n  - region: {{ ec2_region }}\n    type: \"alb\"\n    searchTags:\n      - Key: {{ prometheus_yace_tag_filter }}\n        Value: {{ prometheus_yace_tag_value }}\n    metrics:\n      - name: RequestCount\n        statistics:\n        - 'Sum'\n        period: 600\n        length: 600\n      - name: HealthyHostCount\n        statistics:\n        - 'Minimum'\n        period: 600\n        length: 600\n      - name: UnHealthyHostCount\n        statistics:\n        - 'Maximum'\n        period: 600\n        length: 600\n      - name: HTTPCode_Target_2XX\n        statistics:\n        - 'Sum'\n        period: 600\n        length: 600\n      - name: HTTPCode_Target_5XX\n        statistics:\n        - 'Sum'\n        period: 600\n        length: 600\n      - name: HTTPCode_Target_4XX\n        statistics:\n        - 'Sum'\n        period: 60\n        length: 60\n```\n\nssl exporter configuration\n--------------------------\n\nJust like with the blackbox_exporter, you should pass the targets to a single instance of the exporter in a scrape config with a clever bit of relabelling. This allows you to leverage service discovery and keeps configuration centralised to your Prometheus config.\n\n```yml\n\nscrape_configs:\n  - job_name: 'ssl'\n    metrics_path: /probe\n    static_configs:\n      - targets:\n        - example.com:443\n        - prometheus.io:443\n    relabel_configs:\n      - source_labels: [__address__]\n        target_label: __param_target\n      - source_labels: [__param_target]\n        target_label: instance\n      - target_label: __address__\n        replacement: 127.0.0.1:9219  # SSL exporter.\n```\n\nExample Queries\nCertificates that expire within 7 days, with Subject Common Name and Subject Alternative Names joined on:\n\n```\n((ssl_cert_not_after - time() \u003c 86400 * 7) * on (instance,issuer_cn,serial_no) group_left (dnsnames) ssl_cert_subject_alternative_dnsnames) * on (instance,issuer_cn,serial_no) group_left (subject_cn) ssl_cert_subject_common_name\n```\n\nOnly return wildcard certificates that are expiring:\n\n```\n((ssl_cert_not_after - time() \u003c 86400 * 7) * on (instance,issuer_cn,serial_no) group_left (subject_cn) ssl_cert_subject_common_name{subject_cn=~\"\\\\*.*\"})\n```\n\nNumber of certificates in the chain:\n\n```\ncount(ssl_cert_subject_common_name) by (instance)\n\n```\nIdentify instances that have failed to create a valid SSL connection:\n\n```\nssl_tls_connect_success == 0\n```\n\n\nUsage with ansible galaxy workflow\n----------------------------------\n\nIf you installed the `sa-prometheus-exporters` role using the command\n\n\n`\n   ansible-galaxy install softasap.sa-prometheus-exporters\n`\n\nthe role will be available in the folder `library/softasap.sa-prometheus-exporters`\nPlease adjust the path accordingly.\n\n```YAML\n\n     - {\n         role: \"softasap.sa-nginx\"\n       }\n\n```\n\n\nIdeas for more alerts:  https://awesome-prometheus-alerts.grep.to/\n\n\nCopyright and license\n---------------------\n\nCode 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.\n\nReach us:\n\nSubscribe for roles updates at [FB] (https://www.facebook.com/SoftAsap/)\n\nJoin gitter discussion channel at [Gitter](https://gitter.im/softasap)\n\nDiscover other roles at  http://www.softasap.com/roles/registry_generated.html\n\nvisit our blog at http://www.softasap.com/blog/archive.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftasap%2Fsa-prometheus-exporters","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftasap%2Fsa-prometheus-exporters","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftasap%2Fsa-prometheus-exporters/lists"}