├── Alert-Manager ├── Installation-steps.txt ├── alert_rules.yml ├── alertmanager.service ├── alertmanager.yml └── prometheus.yml ├── Node-Exporter-Installation ├── Installation-steps.txt ├── master-prometheus.yml └── node_exporter.service ├── README.md └── prometheus installation ├── prometheus-installation-steps ├── prometheus.service └── prometheus.yml /Alert-Manager/Installation-steps.txt: -------------------------------------------------------------------------------- 1 | cd /tmp 2 | wget https://github.com/prometheus/alertmanager/releases/download/v0.16.2/alertmanager-0.16.2.linux-amd64.tar.gz 3 | tar -xvzf alertmanager-0.16.2.linux-amd64.tar.gz 4 | mv alertmanager-0.16.2.linux-amd64/alertmanager /usr/local/bin/ 5 | mkdir /etc/alertmanager/ 6 | vim /etc/alertmanager/alertmanager.yml 7 | vim /etc/prometheus/alert_rules.yml 8 | vim /etc/systemd/system/alertmanager.service 9 | vim /etc/prometheus/prometheus.yml 10 | systemctl daemon-reload 11 | systemctl start alertmanager 12 | systemctl status alertmanager 13 | -------------------------------------------------------------------------------- /Alert-Manager/alert_rules.yml: -------------------------------------------------------------------------------- 1 | groups: 2 | - name: example 3 | rules: 4 | - alert: InstanceDown 5 | expr: up == 0 6 | for: 1m 7 | -------------------------------------------------------------------------------- /Alert-Manager/alertmanager.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=AlertManager Server Service 3 | Wants=network-online.target 4 | After=network-online.target 5 | 6 | [Service] 7 | User=root 8 | Group=root 9 | Type=Simple 10 | ExecStart=/usr/local/bin/alertmanager \ 11 | --config.file /etc/alertmanager/alertmanager.yml 12 | 13 | [Install] 14 | WantedBy=multi-user.target 15 | -------------------------------------------------------------------------------- /Alert-Manager/alertmanager.yml: -------------------------------------------------------------------------------- 1 | route: 2 | group_by: [Alertname] 3 | # Send all notifications to me. 4 | receiver: email-me 5 | 6 | receivers: 7 | - name: email-me 8 | email_configs: 9 | - to: receiver@gmail.com 10 | from: sender@gmail.com 11 | smarthost: smtp.gmail.com:587 12 | auth_username: "sender@gmail.com" 13 | auth_identity: "sender@gmail.com" 14 | auth_password: "**********************" 15 | -------------------------------------------------------------------------------- /Alert-Manager/prometheus.yml: -------------------------------------------------------------------------------- 1 | # my global config 2 | global: 3 | scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. 4 | evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. 5 | # scrape_timeout is set to the global default (10s). 6 | 7 | # Alertmanager configuration 8 | alerting: 9 | alertmanagers: 10 | - static_configs: 11 | - targets: 12 | - localhost:9093 13 | 14 | # Load rules once and periodically evaluate them according to the global 'evaluation_interval'. 15 | rule_files: 16 | - "alert_rules.yml" 17 | # - "second_rules.yml" 18 | 19 | # A scrape configuration containing exactly one endpoint to scrape: 20 | # Here it's Prometheus itself. 21 | scrape_configs: 22 | # The job name is added as a label `job=` to any timeseries scraped from this config. 23 | - job_name: 'prometheus' 24 | 25 | # metrics_path defaults to '/metrics' 26 | # scheme defaults to 'http'. 27 | 28 | static_configs: 29 | - targets: ['localhost:9090'] 30 | 31 | - job_name: 'node_exporter' 32 | static_configs: 33 | - targets: ['192.168.3.111:9100'] 34 | -------------------------------------------------------------------------------- /Node-Exporter-Installation/Installation-steps.txt: -------------------------------------------------------------------------------- 1 | --------------------------Node Exporter-------------------------------------- 2 | cd /opt 3 | wget https://github.com/prometheus/node_exporter/releases/download/v0.16.0-rc.1/node_exporter-0.16.0-rc.1.linux-amd64.tar.gz 4 | mv node_exporter-0.16.0-rc.1.linux-amd64 node_exporter 5 | cd /etc/systemd/system/ 6 | vim node_exporter.service 7 | systemctl start node_exporter 8 | systemctl status node_exporter 9 | free -h 10 | ---------------------------End----------------------------------- 11 | -------------------------prometheus[master]------------------- 12 | cd /etc/prometheus/ 13 | mv prometheus.yml prometheus_backup.yml 14 | vi prometheus.yml 15 | promtool check config prometheus.yml 16 | systemctl restart prometheus 17 | systemctl status prometheus 18 | ------------------------------------------ 19 | -------------------------------------------------------------------------------- /Node-Exporter-Installation/master-prometheus.yml: -------------------------------------------------------------------------------- 1 | # my global config 2 | global: 3 | scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. 4 | evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. 5 | # scrape_timeout is set to the global default (10s). 6 | 7 | # Alertmanager configuration 8 | alerting: 9 | alertmanagers: 10 | - static_configs: 11 | - targets: 12 | # - alertmanager:9093 13 | 14 | # Load rules once and periodically evaluate them according to the global 'evaluation_interval'. 15 | rule_files: 16 | # - "first_rules.yml" 17 | # - "second_rules.yml" 18 | 19 | # A scrape configuration containing exactly one endpoint to scrape: 20 | # Here it's Prometheus itself. 21 | scrape_configs: 22 | # The job name is added as a label `job=` to any timeseries scraped from this config. 23 | - job_name: 'prometheus' 24 | 25 | # metrics_path defaults to '/metrics' 26 | # scheme defaults to 'http'. 27 | 28 | static_configs: 29 | - targets: ['localhost:9090'] 30 | 31 | - job_name: 'node_exporter' 32 | static_configs: 33 | - targets: ['192.168.3.111:9100'] 34 | -------------------------------------------------------------------------------- /Node-Exporter-Installation/node_exporter.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Node Exporter 3 | Wants=network-online.target 4 | After=network-online.target 5 | 6 | [Service] 7 | User=root 8 | Group=root 9 | ExecStart=/opt/node_exporter/node_exporter 10 | 11 | [Install] 12 | WantedBy=default.target 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Prometheus-Tutorial-Series 2 | 3 | Part 1 - How to install and configure Prometheus monitoring system
4 | A. Installation-Step
5 | B. prometheus.service file
6 | 7 | Refer below YouTube vidoes to complete the excerise: 8 | 9 | [![](http://img.youtube.com/vi/6EFldoe9dyI/0.jpg)](http://www.youtube.com/watch?v=6EFldoe9dyI "") 10 | 11 | Part 2 -Prometheus - How to install and configure Node Exporter in Prometheus
12 | 13 | [![](http://img.youtube.com/vi/9gj9ys_tZpo/0.jpg)](http://www.youtube.com/watch?v=9gj9ys_tZpo "Prometheus - How to install and configure Node Exporter in Prometheus") 14 | 15 | Part 3 - Prometheus - How to setup Alert Manager in Prometheus
16 | 17 | [![](http://img.youtube.com/vi/GiaYg19-OTM/0.jpg)](http://www.youtube.com/watch?v=GiaYg19-OTM "Prometheus - How to setup AlertManager in Prometheus") 18 | 19 | Connect @
20 | http://YouTube.com/DevopsGuru
21 | https://www.linkedin.com/in/vipinkumar-gupta/
22 | http://vipinkumargupta.com
23 | -------------------------------------------------------------------------------- /prometheus installation/prometheus-installation-steps: -------------------------------------------------------------------------------- 1 | 1. useradd -M -s /bin/false prometheus 2 | 2. useradd --no-create-home -s /bin/false node_exporter 3 | 3. sudo mkdir /etc/prometheus 4 | 4. sudo mkdir /var/lib/prometheus 5 | 5. sudo chown prometheus:prometheus /var/lib/prometheus 6 | 6. sudo chown prometheus:prometheus /etc/prometheus 7 | 7. cd /tmp 8 | 8. wget https://github.com/prometheus/prometheus/releases/download/v2.7.2/prometheus-2.7.2.linux-amd64.tar.gz 9 | 9. tar xvf prometheus-2.7.2.linux-amd64.tar.gz 10 | 10. cp prometheus-2.7.2.linux-amd64/prometheus /usr/local/bin/ 11 | 11. cp prometheus-2.7.2.linux-amd64/promtool /usr/local/bin/ 12 | 12. sudo chown prometheus:prometheus /usr/local/bin/prometheus 13 | 13. sudo chown prometheus:prometheus /usr/local/bin/promtool 14 | 14. cp -r prometheus-2.7.2.linux-amd64/consoles /etc/prometheus 15 | 15. cp -r prometheus-2.7.2.linux-amd64/console_libraries /etc/prometheus 16 | 16. sudo chown -R prometheus:prometheus /etc/prometheus/ 17 | 17. sudo chown -R prometheus:prometheus /etc/prometheus/console_libraries 18 | 18. cp prometheus-2.7.2.linux-amd64/prometheus.yml /etc/prometheus 19 | 19. cd prometheus-2.7.2.linux-amd64 20 | 20. cat prometheus.yml 21 | 21. cd /etc/systemd/system 22 | 22. vi prometheus.service 23 | 23. sudo systemctl daemon-reload 24 | 24. sudo systemctl start prometheus 25 | 25. sudo systemctl enable prometheus 26 | 26. sudo systemctl status prometheus 27 | -------------------------------------------------------------------------------- /prometheus installation/prometheus.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Prometheus 3 | Wants=network-online.target 4 | After=network-online.target 5 | 6 | [Service] 7 | User=prometheus 8 | Group=prometheus 9 | Type=simple 10 | ExecStart=/usr/local/bin/prometheus \ 11 | --config.file /etc/prometheus/prometheus.yml \ 12 | --storage.tsdb.path /var/lib/prometheus/ \ 13 | --web.console.templates=/etc/prometheus/consoles \ 14 | --web.console.libraries=/etc/prometheus/console_libraries 15 | 16 | [Install] 17 | WantedBy=multi-user.target 18 | -------------------------------------------------------------------------------- /prometheus installation/prometheus.yml: -------------------------------------------------------------------------------- 1 | # my global config 2 | global: 3 | scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. 4 | evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. 5 | # scrape_timeout is set to the global default (10s). 6 | 7 | # Alertmanager configuration 8 | alerting: 9 | alertmanagers: 10 | - static_configs: 11 | - targets: 12 | # - alertmanager:9093 13 | 14 | # Load rules once and periodically evaluate them according to the global 'evaluation_interval'. 15 | rule_files: 16 | # - "first_rules.yml" 17 | # - "second_rules.yml" 18 | 19 | # A scrape configuration containing exactly one endpoint to scrape: 20 | # Here it's Prometheus itself. 21 | scrape_configs: 22 | # The job name is added as a label `job=` to any timeseries scraped from this config. 23 | - job_name: 'prometheus' 24 | 25 | # metrics_path defaults to '/metrics' 26 | # scheme defaults to 'http'. 27 | 28 | static_configs: 29 | - targets: ['localhost:9090'] --------------------------------------------------------------------------------