Tag Archives: Nagvis gadgets

At work I utilize Nagios to monitor our systems and Nagvis to display things in a visual way on a large screen monitor so we can see whats it going on at a glance. One of the gadgets we use quite a bit is the rawNumbers.php by Sascha Runschke. Now while it works well at what it does, which is displaying data as a number in image format, it is very limited with customizations. Nagvis gives you the ability to pass options in the gadget_opts field so that you can choose what you want to display. What I have done is to add some extra functionality to the gadget to allow you to modify the following

* divide = <value> divides the perfdata by this number.

This allow you to set the divisor for traffic data which is in bps to show as MB/s. As an example, your perfdata is 3752690,4Bits/s and you use divide=1048576, then rawNumbers will display 3.5 as the output
* datauom = <string> shows this as the uom instead of the perfdata, showuom must not be set to 0.

This is a fairly simple change that allows you to change what displays after the value. For example, you might want to show Hz for Hertz or C for Celsius after your values. Note that showuom must not be set to '0' or whatever you set here will not display.
* showuom = <0|1> default = 1 shows the unit of measure.

This allows you to turn off the display of the unit of measure so it does not display.
* string = s s is a string the perfdata label has to contain

This allows you to choose what to display if you have multiple perfdata in the array. It is handy when displaying traffic counters. You would set string=traffic_in and string=traffic_out to get both in the inbound and outbound traffic data to show. Replace traffic_in / traffic_out with your own perfdata names of course.

This example uses gadget_opts of:

In: showuom=1 divide=1048576 datauom=Mb string=traffic_in

Out: showuom=1 divide=1048576 datauom=Mb string=traffic_out

Here is another example from a UPS. These use divide=10 to format them correctly.

Download the below file and extract the contents into your nagvis gadgets directory. (likely something like /usr/share/nagvis/share/userfiles/gadgets) Be sure to back up the original files first in case something goes wrong.