Install Prometheus and Grafana

31 07 2017

These are the steps to install Prometheus and Grafana in a standalone Linux Debian box for monitor their system with a nice dashboard.

Install the package server and exporter from the repo:

apt-get install prometheus prometheus-node-exporter

Change Prometheus to listen only in localhost and the sync strategy (if you want to save battery) /etc/default/prometheus:

ARGS="-web.listen-address=localhost:9090 -storage.local.series-sync-strategy 'never'"

Assure that there is a target in /etc/prometheus/prometheus.yml:

- job_name: node
# If prometheus-node-exporter is installed, grab stats about the local
# machine by default.
static_configs:
- targets: ['localhost:9100']

Restart it and enable in systemd:

systemctl restart prometheus
systemctl enable prometheus

Change the listen address too in the node exporter /etc/default/prometheus-node-exporter:

ARGS="-collector.diskstats.ignored-devices=^(ram|loop|fd)\d+$ \
-collector.filesystem.ignored-mount-points=^/(sys|proc|dev|run)($|/) \
-collector.textfile.directory=/var/lib/prometheus/node-exporter -web.listen-address=127.0.0.1:9100"

Restart it and enable in systemd:

systemctl restart prometheus-node-exporter
systemctl enable prometheus-node-exporter

Download Grafana from their website and install it:

mkdir /opt/grafana
cd /opt/grafana
wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_4.4.1_amd64.deb
dpkg -i grafana_4.4.1_amd64.deb

Enable and start it in systemd:

systemctl daemon-reload
systemctl enable grafana-server
systemctl start grafana-server

Use the browser and enter this address (user/password: admin/admin):

http://localhost:3000

Add the Prometheus datasource as in the image:

Add a new dashboard following this path in the menu:

Type the id “1860” inside “Grafana.com Dashboard”. It automatically get it:

Confirm the import fetching the values from localhost:


Enjoy.

Advertisements




Instalar munin-node en RedHat / CentOS 5

10 09 2012

Para instalar munin-node en una máquina RedHat o CentOS 5 hay que utilizar los repositorios dag y forzar algunos paquetes, ya que no se encuentran todos disponibles para ésta release del sistema.

Aquí van los pasos, básicamente, crear un repo nuevo, bajar varios rpm e instalarlos a mano y finalmente instalar munin-node:

cat > /etc/yum.repos.d/dag.repo << FIN
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
gpgkey=http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
enabled=1
FIN
cd /var/cache/yum/dag/packages/
wget 'http://pkgs.repoforge.org/perl-Net-Server/perl-Net-Server-0.90-2.el5.rf.noarch.rpm&#039;
yum install perl-Net-Server-0.90-2.el5.rf.noarch.rpm -y
wget 'http://pkgs.repoforge.org/perl-Socket6/perl-Socket6-0.23-1.el5.rfx.x86_64.rpm&#039;
yum install perl-Socket6-0.23-1.el5.rfx.x86_64.rpm -y
wget 'http://pkgs.repoforge.org/perl-Crypt-DES/perl-Crypt-DES-2.05-3.2.el5.rf.x86_64.rpm&#039;
yum install perl-Crypt-DES-2.05-3.2.el5.rf.x86_64.rpm -y
wget 'http://pkgs.repoforge.org/perl-Net-SNMP/perl-Net-SNMP-5.2.0-1.2.el5.rf.noarch.rpm&#039;
rpm -ivh --force perl-Net-SNMP-5.2.0-1.2.el5.rf.noarch.rpm --nodeps
yum -y install munin-node
/etc/init.d/munin-node restart