Using check_netio monitoring plugin on CentOS 7 or RHEL 7

Written by - 2 comments

Published on - Listed in Linux Monitoring Nagios Icinga


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:10.162.216.65  Bcast:10.162.216.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          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  mtu 1500
        inet 10.162.214.132  netmask 255.255.255.0  broadcast 10.162.214.255
        inet6 fe80::fc3c:fc22:c796:54e1  prefixlen 64  scopeid 0x20
        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)

vs.

        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?


RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder