Monitor linux statistics with grafana (munin replacement)
This quick tutorial will guide you to install grafana to monitor a linux system. We also are going to save a history to an influx database.
Install and start theInfluxDB service:
Now you can check at the port 8083 (for a local installation check http://localhost:3000)) that the InfluxDB is working.
Since InfluxDB default config is a little insecure let’s change some settings:
sudo vim /etc/influxdb/influxdb.conf
Now search for auth-enabled and set it to true.
it’s recommended to enable also https-enabled
using the influx-cli create the admin user (remeber to start the service with influxd):
influx CREATE USER leonardo WITH PASSWORD ‘use_secure_password’ WITH ALL PRIVILEGES
We need to download the official .deb file (please check the updated .deb here http://grafana.org/download/)
Now check that Grafana web interface is working on localhost at port 3000 (for a local installation check http://localhost:3000).
Sign up with a new user and then open the grafana configuration (/etc/grafana/grafana.ini) to uncomment admin_user and admin_password
Then restart grafana
Configure InfluxDB data source. Since telegraf database is not yet created an error is expected. Add the datasource as the following screenshot shows.
Collect and metrics reporting
Now we need a Grafana pluging to collect and report metrics, in this case we are going to use telegraf (https://github.com/influxdata/telegraf)
Next step is to configure the pluging. Telegraf can generate a file with specific inputs and outputs, you can use the -input-filter and -output-filter flags
The last command will create a config to monitor CPU, memory, network and swap.
Now we need to add telegraf as a service