Header RSS Feed
If you only want to see the articles of a certain category, please click on the desired category below:
ALL Android Backup BSD Database Hacks Hardware Internet Linux Mail MySQL Monitoring Network Personal PHP Proxy Shell Solaris Unix Virtualization VMware Windows Wyse

Using check_netio monitoring plugin on CentOS 7 or RHEL 7
Friday - Jan 27th 2017 - by - (2 comments)

For years I've been using the monitoring plugin check_netio to get statistics of the network interfaces on Linux. Purely for graphing purposes as the plugin doesn't do a "classical check". An example of such a graph can be seen here:

check_netio graph 

But since RHEL 7 and CentOS 7 the plugin didn't return any values anymore. The reason lies in the different output of the ifconfig command:

ifconfig on CentOS 6 and RHEL6 returns:

[root@centos6 ~]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:50:56:B5:7A:26 
          inet addr:  Bcast:  Mask:
          RX packets:124417619 errors:0 dropped:0 overruns:0 frame:0
          TX packets:45443808 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:824234857174 (767.6 GiB)  TX bytes:59269515633 (55.1 GiB)

ifconfig on CentOS 7 and RHEL7 returns:

[root@centos7 ~]# ifconfig ens192
ens192: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet  netmask  broadcast
        inet6 fe80::fc3c:fc22:c796:54e1  prefixlen 64  scopeid 0x20<link>
        ether 00:50:56:8d:19:be  txqueuelen 1000  (Ethernet)
        RX packets 170715  bytes 56526535 (53.9 MiB)
        RX errors 0  dropped 38  overruns 0  frame 0
        TX packets 36453  bytes 7216222 (6.8 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

As the plugin uses grep 'bytes' and then cut to get the current number of bytes, you can see the problem by comparing the lines:

        RX bytes:824234857174 (767.6 GiB)  TX bytes:59269515633 (55.1 GiB)


        RX packets 170715  bytes 56526535 (53.9 MiB)
        TX packets 36453  bytes 7216222 (6.8 MiB)

In order to use the plugin on newer CentOS 7 and RHEL 7 installations, too, I adapted the plugin. Unfortunately I couldn't find a source repository to contribute to so I created a new repository on my Github account (see my repository check_netio).

Besides fixing the CentOS/RHEL 7 case, I also added a simple check if the given network interface even exists on the system. In the original plugin, this simply caused the plugin to return OK with no values. 

[root@rhel7 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.3 (Maipo)

[root@rhel7 ~]# /usr/lib/nagios/plugins/check_netio -i ens192
NETIO OK - ens192: RX=56936528, TX=7374799|NET_ens192_RX=56936528B;;;; NET_ens192_TX=7374799B;;;;

[root@rhel7 ~]# /usr/lib/nagios/plugins/check_netio -i ens999
NETIO UNKNOWN - No interface ens999 found


Add a comment

Show form to leave a comment

Comments (newest first):

ck from Switzerland wrote on Jan 29th, 2017:
Hi draugas. I'm using check_netio through NRPE. Please follow my article Creating custom PNP4Nagios templates in Icinga 2 for NRPE checks for more information how to change the graphing behavior of PNP4Nagios.

draugas from Vilnius wrote on Jan 28th, 2017:
how to enable graph on pnp4nagios?

Go to Homepage home
Linux Howtos how to's
Monitoring Plugins monitoring plugins
Links links

Valid HTML 4.01 Transitional
Valid CSS!
[Valid RSS]

7605 Days
until Death of Computers