Skip to content

Poswark/monitoring-server-basic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

monitoring-server-basic

Basic monitoring using bash, prometheus and Grafana

Let's monitor with Grafana, Prometheus, Pushgateway

Full demo

Tutorial

Monitoring server architecture

Alt text

Download Pushgateway and prometheus

https://prometheus.io/download/

Download Grafana

https://grafana.com/grafana/download

Pushgateway and prometheus services are uploaded, modify prometheus.yml

 [root@monitoring ~]# netstat -ntpl | grep -i 909
tcp6       0      0 :::9090                 :::*                    LISTEN      4528/./prometheus   
tcp6       0      0 :::9091                 :::*                    LISTEN      4513/./pushgateway  
[root@monitoring ~]#
[root@monitoring ~]# systemctl enable --now grafana-server

Create a bash script to collect metrics Your next task is to create a simple bash script that collects metrics like CPU usage and memory usage for individual processes.

Your script can be defined as a cron task that will run every second later.

To perform this task, you have multiple candidates.

You can run the main commands every second, analyze them with sed, and send the metrics to Pushgateway.

Shell to take resources, cpu, memory and Disk

[root@monitoring script]# sh recursos.sh 
192.168.121.82
[root@monitoring script]# 

We upload the metrics to pushgateway

[root@monitoring script]# sh load-cpu.sh

We see it reflected in the console

Alt text

Automatically pushgateway metrics are also stored in the prometheus database

Alt text

The data can now be read by grafana

Alt text

Example Alt text

About

Basic monitoring using bash, prometheus and Grafana

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages