IBM Support

Linux: Installing InfluxDB 1.8 and Grafana 7 and njmon

How To


Summary

When I show technical folk my njmon performance tool and InfluxDB with Grafana, they assume that must be complicated to set up but it is not true. On Linux, installing is simple and quick. Heck, you can also use Microsoft Windows and Mac OS for a quick go but you really want to run it as on a server so its 24 x 7. Thanks to amazing team are power-devops.com we can also use AIX and Linux on POWER8 and POWER9 - my favourite servers. InfluxDB and Grafana are simple and quick to install. Then, you have the best Time-series database (in my opinion) and the best browser-based performance stats graphing tool Grafana, ready for njmon data. I estimate the tasks details here will take 10 to 15 minutes.
You can cut'n'paste most of the commands directly. With Linux on Intel, you have Red Hat, SUSE and Ubuntu. In this blog, I am using RHEL - as an IBMer I have to! Apart from the software package format and install command name, the process is the same regardless of Linux Distro.

Objective

Nigels Banner

Environment

Assuming the following environment:
  1. A freshly installed Red Hat 8.2 and you have system admin access.
  2. We are going to take all the default settings including using the root file system for the InfluxDB data. It is your option to set-up a separate file system for this data. Alternatively, use a large root file system. I suggest a root file system of 1 TB or more.  If this is a quick proto-type to throw away then even 64GB is fine.
  3. Internet access from the server.  Alternatively, you could download and copy over the installation files by hand.
  4. Latest versions for InfluxDB and Grafana (at the time of writing this blog) InfluxDB 1.8.3 and Grafana 7.3.6.
    • For Intel go here: https://portal.influxdata.com/downloads/ and https://grafana.com/grafana/download
    • For POWER8 go here: and POWER9 servers the latest versions here https://www.power-devops.com/influxdb and https://www.power-devops.com/grafana
    • I have not tested InfluxDB version 2 yet. I think version 2 has excellent compatibility with an earlier version and work fine. For an early easy successful first time, use InfluxDB 1.8
  5. The root user is used throughout.
  6. We will be using default network ports 8086 for InfluxDB and 3000 for Grafana.
  7. Assuming you have the correct time or an Network Time Protocol process and you are not going to change the hostname after install (possible but not covered here).
  8. Both InfluxDB and Grafana have a text config file for advanced options.  You can study these options after you have successfully installed and have graphed your first statistics.

Steps

1) Make a file system - optional.
If you want a file system for the InfluxDB database data, create that now mount at /var/lib/influxdb.
  • Not covering that here are there are multiple LVM and file system options.
2) If not already installed, install wget
For RHEL:
yum install wget
SUSE and Ubuntu have other commands: zypper and apt.
3) Fetch the Influxdb software, install it and start it
Note: for InfluxDB and Grafana there are plenty of command and hints for the supported operating systems.
For Intel:
wget https://dl.influxdata.com/influxdb/releases/influxdb-1.8.3.x86_64.rpm
sudo yum localinstall influxdb-1.8.3.x86_64.rpm

sudo systemctl start influxdb
For POWER8/POWER9:
wget https://dl.power-devops.com/influxdb-1.8.3-1.el8.ppc64le.rpm

sudo yum localinstall influxdb-1.8.3-1.el8.ppc64le.rpm

sudo systemctl start influxdb
4) Create the njmon database within InfluxDB for data and check that worked
Create the njmon database within InfluxDB
influx <<EOF
create database njmon
EOF
Check that it worked
influx <<EOF
show databases
EOF
5) Fetch the Grafana software, install it and start it
For Intel:
wget https://dl.grafana.com/oss/release/grafana-7.3.6-1.x86_64.rpm
sudo yum install grafana-7.3.6-1.x86_64.rpm

sudo systemctl start grafana-server
For POWER8/POWER9:
wget https://dl.power-devops.com/grafana-7.3.6-1.el8.ppc64le.rpm

sudo yum install grafana-7.3.6-1.el8.ppc64le.rpm

sudo systemctl start grafana-server
6) Fetch the latest njmon for AIX agent, install it and start it
For a quick start, we will run the first njmon and nimon on the InfluxDB and Grafana server itself.  Later, you install this on each endpoint of AIX, VIOS and Linux. The only change is localhost command-line option. It becomes the IP address or hostname of the InfluxDB server.
We are going to use the nimon variation of njmon, which directly injects the data in to InfluxDB skipping the JSON file format.
You have to find the latest version as it is regularly updated. The package file names can be found here:
For Linux:
wget http://sourceforge.net/projects/nmon/files/njmon_linux_binaries_v71.zip
unzip njmon_aix_binaries_v71.zip

./ninstall
For AIX and VIOS:
wget http://sourceforge.net/projects/nmon/files/njmon_aix_binaries_v69.zip
unzip njmon_aix_binaries_v69.zip

./ninstall
Get nimon running:
 
# Start now
nimon -s 30 -k -i localhost -p 8086 -x njmon
For failsafe restarting hourly. If nimon is already running it stops itself, so no harm is done. 
Start nimon every hour (if it stopped for some reason like a reboot). Add this line to cron using the command: crontab -e
For Linux:
0 * * * * /usr/local/bin/nimon -s 30 -k -i localhost -p 8086 -x njmon -n
For AIX:
0 * * * * /usr/lbin/nimon -s 30 -k -i localhost -p 8086 -x njmon -n
7) Get InfluxDB and Grafana to start on reboot
sudo systemctl enable grafana-server.service

sudo systemctl enable influxdb
- - - Everything is now set up and collecting data- - -
8) Added nimon to other servers
You need to repeat the nimon installation for other AIX servers but change "localhost" to the hostname (or IP address) of your InfluxDB service.  I am a network administrator, so I added a network hostname alias of "influx" to make life simple.  So for example to hand start nimon I use:
nimon -s 30 -k -i influx -p 8086 -x njmon -n
There are two tasks with Grafana to see the graphs
A) Creating a Grafana Data Source to the InfluxDB
Assuming the server running Grafana hostname is as follows:
$ hostname
myserver.mycompany.com
  1. Browse to "https://myserver.mycompany.com:3000"
  2. Log in with user admin and password admin
  3. Change admin password - optional but highly recommended
  1. Go to Configure - Data Source 
  2. Configure Data Source
  3. Click "Add Data Source"
    Add
  4. Select InfluxDB
    Select InfluxDB
  5. Type a good name like: "InfluxDB njmon", add URL "http://localhost:8086" and database "njmon"
    add fields
  6. Scroll down and click "Save & Test"
    Save
  7. If the details are correct, it displays a green "Data source is working" message.
  8. Your Grafana is connected to your InfluxDB
B) Import a njmon & nimon Dashboard for your server type AIX or Linux
The example here is for importing a Dashboard for graphing data from AIX but the same applies for Linux stats.  If you are collecting stats on a Linux server look for a Dashboard with "Linux" in the name.
  1. Prepare to Import a Dashboard
    Select Import Dashboard
  2. Type "10891" in to the Import from Grafana.com field the click "Load"
    add the ID and Load
     
  3. Select the Data Source from the list and click "Import"
    select the database
  4. You are now looking at a Grafana Dashboard for your server with six simple graphs covering CPU, memory user, run queue, file system use, disk I/O and network I/O.  Here is a mine - after a half hour of collecting performance statistics, so there are more data points.
  5. the graphs
Here is the Linux Dashboard equivalent (nimon running on Linux on POWER9. Note: Linux on Intel will be exactly the same except the contents of the Architecture, Model and Serial number fields.
image 7811
   Stand back in awesome wonder!   
You can add further pre-prepared Dashboards and create your own Graphs of the njmon or nimon performance statistics.
For more information and links to YouTube videos about njmon and nimon go here:  http://tinyurl.com/njmon

Additional Information


Find more content from Nigel Griffiths (retired) here:

Document Location

Worldwide

[{"Line of Business":{"code":"LOB08","label":"Cognitive Systems"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG10","label":"AIX"},"ARM Category":[{"code":"","label":""}],"Platform":[{"code":"PF002","label":"AIX"}],"Version":"All Versions"}]

Document Information

Modified date:
09 June 2023

UID

ibm16403836