Graphing Multiple Variables from Single Plugin

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
eholm
Posts: 2
Joined: Fri Nov 09, 2018 7:43 am

Graphing Multiple Variables from Single Plugin

Post by eholm »

Hello All,

I've been writing my own Plugins for a while.
This is the first one where I'm trying to get it to graph multiple values on the same graph.

Here is the end of my plugin... where I prep the output.

Code: Select all

#---------- Step 3 ------------------------------------------------------------
# Format Output

    performanceData=""
    performanceData=$performanceData"'connections'=$NUM_CONNECTIONS;$WARNING_THRESHOLD;$CRITICAL_THRESHOLD;0;250 "
    performanceData=$performanceData"NECC'=$NUM_NECC;;;0;250 "
    performanceData=$performanceData"'Direct'=$NUM_DCS;;;0;250 "
    echo "Connections - $NUM_CONNECTIONS"
    echo " | $performanceData"
    exit $RESULT

#-- END
If I delete the 3rd and 4th performanceData lines I can get Connections to graph by itself.
However once I add the additional metrics... nothing graphs.

I get all of the "speedometers" for each of the three metrics.
I can see that Nagios is getting performance data in the Advanced tab.

Performance Data: 'connections'=2;100;200;0;250 'NECC'=0;;;0;250 'Direct'=1;;;0;250

All my other graphs work.
And there is a MySQL plugin someone else made. It has multiple metrics being tracked and my output is in the same format as theirs. That one graphs just fine.

I reviewed the documentation for plugin output. I believe I have everything right. Especially since I can get it to work with a single metric but not multiple. Searched online for answers for a bit and I'm at the end of my rope! Any help would be appreciated.

-- Eric
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Graphing Multiple Variables from Single Plugin

Post by npolovenko »

Hello, @eholm. Your performance data output looks correct, but if you add data sources to the existing service check that's going to break the RRD graph. To fix that you can either delete the corresponding RRD and XML files from the /usr/local/nagios/var/spool/perfdata folder and let Nagios automatically create a new RRD file with the modified number of data sources.
Otherwise, if deleting the existing RRD file is not an option you may follow this article to increase the number of data sources:
https://support.nagios.com/kb/article.php?id=149
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
eholm
Posts: 2
Joined: Fri Nov 09, 2018 7:43 am

Re: Graphing Multiple Variables from Single Plugin

Post by eholm »

Removing the files for each server worked like a charm.
I had a feeling it was something like this.
Just didn't know where to look.

-- Eric
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Graphing Multiple Variables from Single Plugin

Post by scottwilkerson »

eholm wrote:Removing the files for each server worked like a charm.
I had a feeling it was something like this.
Just didn't know where to look.

-- Eric
Great!

Locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked