Today, i ‘d like to introduce to you the PowerLogic EGX300.
What is that?
The EGX300 is an Ethernet-based device providing a transparent interface
between Ethernet-based networks and field devices. Field devices include
meters, monitors, protective relays, PLCs, trip units, motor controls, and
other devices that communicate using Modbus, Jbus, or PowerLogic
The EGX300 uses Modbus TCP/IP protocol to access field device
information across a local area network (LAN) or a wide area network
And all information is available from Embedded Web Interface. Sounds cool huh?
However, what if you have many similar devices like this, wouldn’t you want to see all data in one single place like Monitoring system such as Nagios or Zabbix?
I bet you do. 🙂
This task was given to me months ago: to get vital readings from The PowerLogic EGX300 interface and embed it to Nagios Web Monitoring server.
Usually, scenario is typical: you send snmp calls and get readings back.
But what if your device is using Modbus Protocol?
This article will show you how to get readings via Modbus protocol in a simple and comprehensive way.
So, we have a RHEL5 server with Nagios Server + Nagios Nconf.
Setup of RHEL, Nagios and Nagios Nconf is out of scope of this article, as far as i know, there are plenty of such manuals around the web.
In my case Nagios didn’t have a tools to interact with Modbus protocol out of box, so i had to compile the necessary apps.
1. Via root shell, navigate to some comfortable place like /usr/src/.
[root@ /]# cd /usr/src/
2. Download and extract libmodbus library and useful check_modbus app that will query info to Nagios for us:
3. Untar libmodbus archive, enter
libmodbus directory and install it:
[root@ libmodbus-3.0.6]# ./configure;make;make install;
4. In same fashion install
[root@ check_modbus-master]# ./configure LDFLAGS=-L/usr/local/lib CPPFLAGS=-I/usr/local/include;
[root@ check_modbus-master]# make;make install;
Its time to check if check_modbus is working by typing it in shell.
You should receive lots of help output.
However, if check_modbus is reporting that it cannot find libmodbus, this might help:
[root@ /]# touch /etc/ld.so.conf.d/libc.conf
[root@ /]# echo "/usr/local/lib" >/etc/ld.so.conf.d/libc.conf
Verify if library can now be seen by system, Run:
[root@ /]# ldconfig -v | grep libmodbus
By itself “check_modbus” has great capabilities, far beyond our needs.
If you are willing to know what it can do type: “man check_modbus”
So, we have “check_modbus” working but we still need some wrapper so Nagios would understand the output according to its standards.
Therefore, i ‘ve decided to create my own wrapper on bash which can be easily extended if required.
You can download it from github: https://github.com/leshcat/leshcatlabs
Put it to folder where your “libexec” folder resides (in my case its
Its very simple to use:
To get proper Modbus registers, you will have to check manufacturer’s manuals, for DM6000 they are the following:
Now we are ready to embed the readings from EGX300 to our Nagios Monitoring.
Open nConf and Register additional checkcommand “check_modbus_2”:
Once done, configure advanced services for your EGX300 or similar model:
Since i am measuring Voltage, i have included “lower” and “upper” limits in my script, crossing which will force Nagios to generate CRITICAL output.
Once all done, hit Nconf’s “Generate Config” and you are good to go.
Voila! We can now monitor EGX300 with Nagios.
I hope you enjoyed this article and it will be useful for people who have troubles monitoring their ModBus devices.
Feel free to discuss it at -> Forums <-
AndreySV, the creator of original check_modbus application has told me that his newest version supports always critical output as my wrapper.
I had no chance to verify this, however, in case it is true, my wrapper bash script might not be required anymore.
Of course, the choice of using my wrapper or to work with original check_modbus directly is entirely up to you. 😉