NagVis custom gadget - perfdata is missing

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
solarmon
Posts: 81
Joined: Fri Sep 13, 2019 3:57 am

NagVis custom gadget - perfdata is missing

Post by solarmon »

Hi,

I am trying to create a custom gadget that will display the status icon of the database replication status returned by this script:

https://exchange.nagios.org/directory/P ... us/details

This script does not seem to return any performance data.

My understanding is that my gadget should then set a dummy performance data with something like:

Code: Select all

$sDummyPerfdata = 'config=20%;80;90;0;100';
And this should be done before gadgets_core.php is included.

However, the output of my custom gadget in NagVis returns:

Code: Select all

ERROR: The needed parameter "perfdata" is missing.
The code in gadgets_core.php suggests that it should be checking to see if $sDummyPerfdata is set, otherwise it would display this message.

Please could you tell me what I am doing wrong.

Thank you.
solarmon
Posts: 81
Joined: Fri Sep 13, 2019 3:57 am

Re: NagVis custom gadget - perfdata is missing

Post by solarmon »

Some additional information that I have just observed.

The check_mysql_slavestatus.sh does actually return performance data for when the status is OK:

Code: Select all

delay=0s
But when the status is CRITICAL, the performance data is empty/blank.

So my gadget works when there is real performance data, but breaks when there is no real performance data.

So I suppose the question is still why the $sDummyPerfdata dummy performance data is not working.
solarmon
Posts: 81
Joined: Fri Sep 13, 2019 3:57 am

Re: NagVis custom gadget - perfdata is missing

Post by solarmon »

Another update.

To test, I edited the check_mysql_slavestatus.sh script so that it returns "delay=0" for when it returns CRITICAL status.

My NagVis gadget script now works as expected, because it is getting the real performance data.

I will contact the developer of the check_mysql_slavestatus.sh script to see if it can still return performance data when it returns a CRITICAL status, but I would still like to know why using the $sDummyPerfdata dummy performance data didn't work.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: NagVis custom gadget - perfdata is missing

Post by ssax »

The top comment at the bottom here shows how to add the performance data:

https://exchange.nagios.org/directory/P ... us/details
solarmon
Posts: 81
Joined: Fri Sep 13, 2019 3:57 am

Re: NagVis custom gadget - perfdata is missing

Post by solarmon »

@ssax,

That comment was from 2014, the latest version of the check script is from 2020. I have reached to the developer regarding my issue.

However, I would still like to understand why using the $sDummyPerfdata dummy performance data didn't work. Or is my understanding of what this is used for is not correct?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: NagVis custom gadget - perfdata is missing

Post by ssax »

After looking at the code it looks like you need to pass conf in the gadget_url in your map definition for $sDummyPerfdata to be used:

Code: Select all

define service {
host_name=localhost
service_description=NOTHING
x=50
y=50
object_id=1dd76b
view_type=gadget
gadget_url=[/nagvis/userfiles/gadgets/std_speedometer.php?conf=true]
}
EDIT: Please note that helping write custom nagvis gadgets isn't something that support has experience with and isn't something that's included in support, you may need to reach out to the developers of nagvis for any in-depth custom development questions in the future as they would be the experts on creating custom gadgets for their product and what it requires, we include Nagvis because a lot of customers used it in the past but we stop short of consulting on custom development. You can see their support options here:

https://www.nagvis.org/support
solarmon
Posts: 81
Joined: Fri Sep 13, 2019 3:57 am

Re: NagVis custom gadget - perfdata is missing

Post by solarmon »

@ssax,

Apologies, I will go directly to NagVis support next time.

Thank you for your hint. I couldn't find a way of making that change in the NagVis editor GUI - so I exported the map, edited the config, and imported it back it. But adding "conf=true" did indeed solve the issue!

Thank you so much for your support - it is greatly appreciated!
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: NagVis custom gadget - perfdata is missing

Post by ssax »

Glad to help! Let us know when we're okay to lock this up and mark it as resolved.
solarmon
Posts: 81
Joined: Fri Sep 13, 2019 3:57 am

Re: NagVis custom gadget - perfdata is missing

Post by solarmon »

Yes, you can close this ticket now.

Thank you once again!
Locked