Gadgets are small programs which generate images from information which is provided by NagVis. The main idea is to provide the performance data of Nagios to these programs for visualizing it as nice graphs or fancy speedometers, thermometers etc.
The gadgets can be written in any language which can be interpreted by your webserver. Some options can be PHP, Perl,...
Gadgets are only supported for service objects. An object can be turned into a gadget by setting view_type="gadget" and a valid gadget_url.
NagVis supports gadgets since version 1.4.
NagVis 1.4 std_speedometer gadget on test map with enabled label.
The gadgets get their information via a HTTP-Get call from NagVis.
The following parameters are being passed to the gadgets:
Parameter | Example value | Description |
---|---|---|
name1 | localhost | The name of the host. |
name2 | Current Load | The service description of the object. |
scale | 100 | The scale of the gadget. |
state | OK | The string which represents the current state. |
stateType | HARD | The type of the current state. Can be HARD or SOFT |
perfdata | load1=0.960;5.000;10.000;0; load5=0.570;4.000;6.000;0; load15=0.540;3.000;4.000;0; | The current performance data information provided by Nagios. It's important to have valid performance data here. |
A valid http get on the std_speedometer.php looks like this:
std_speedometer.php?name1=localhost&name2=Current%20Load&state=OK&stateType=HARD&perfdata=load1=0.450;5.000;10.000;0;%20load5=0.260;4.000;6.000;0;%20load15=0.750;3.000;4.000;0;
Please check the parameters view_type
and gadget_url
on service object in the map configuration format description
The best thing is to take a look at the std_speedometer and adapt the core things from there
You should set a sample perfdata string in the gadget code by writing it to the variable $sDummyPerfdata. This makes it possible to show the gadget with dummy data in the WUI. It's much easier to design the maps in the WUI when the gadgets are shown there. Important: The variable needs to be set before the gadgets_core.php is included.