sometext from user php script to rrd

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
zaji_nms
Posts: 616
Joined: Tue Oct 16, 2012 12:28 am

sometext from user php script to rrd

Post by zaji_nms »

Dear Expert

more myscript.php
------------------------
include '/abc/xyz/somefuncs.php';
$MyOutputStatusInfo=pullStatusInfo();
$YaxisLeft1 = YaxisLeft1();
$YaxisRight1 = YaxisRight1();
$XaxisLine1 = XaxisLine1();
my $result = "";
#some code
$result = $result . $MyOutputStatusInfo . " | PDU1=$currPDU1 PDU2=$currPDU2\n";

in my above script, the graphs are plotting via default template and its great but I want to send above three variables which having pure clear text to show at left of Yaxis, right of Yaxis and as a last line bottom of the graph (xAxis), how possible?

Regards
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: sometext from user php script to rrd

Post by tgriep »

In one of your previous posts, we used the Comment option to get the data from a php script to display in the graph.
See this link.
https://support.nagios.com/forum/viewto ... 80#p278980
Is that what you are looking for?
Be sure to check out our Knowledgebase for helpful articles and solutions!
zaji_nms
Posts: 616
Joined: Tue Oct 16, 2012 12:28 am

Re: sometext from user php script to rrd

Post by zaji_nms »

No

that time was working on Template (/usr/local/nagios/share/pnp/templates)

this moment asking how to send from my Script (/usr/local/nagios/libexec/myScript.php) X-Axis, Y-Axis TEXT to RRD (performance graph)

regards
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: sometext from user php script to rrd

Post by tgriep »

OK, I understand now. Your custom plugin is not outputting the performance data.
Take a look at the plugin development guide at the following link.
https://nagios-plugins.org/doc/guidelines.html#AEN200

To get the other 3 variables to plot on the graph, you would have to add a label and the value in the end of the $result line in your example.

Something similar to the following.

Code: Select all

$result = $result . $MyOutputStatusInfo . " | PDU1=$currPDU1 PDU2=$currPDU2 YaxisLeft1=$YaxisLeft1 YaxisRight1=$YaxisRight1 XaxisLine1=$XaxisLine1\n";
Be sure to check out our Knowledgebase for helpful articles and solutions!
zaji_nms
Posts: 616
Joined: Tue Oct 16, 2012 12:28 am

Re: sometext from user php script to rrd

Post by zaji_nms »

Dear tgriep

no no, I am looking something else

FYI, there is single host with one IP assume 10.10.10.10, its related to APC rPDU (Rack PDU)
from single host/IP, we monitoring 4 PDUs, from my single common script, I am able to plot graphs of all 4 PDUs current but I don't know how to add the comments (some very useful info to our normal user), please ref the attached, the red text at the bottom, its there in my script stored in some variables, how to send to RRD or Nagios Performance Graph to show at the bottom (simple text in red, how to send and how to show as COMMENT in rrd , how to configure PNP php TEMPLATE).

just once again , all the X-Axis COMMENTS (in red) are four comments and all are differ each other and stored in some variables

the below code is not real, it is Pseudocode, please convert to real code (myscript.php) and then need to guide how to reflect in PNP Template.php.

$result = $result . $MyOutputStatusInfo . " | (PDU1=$PDU1CurrentValue $PDU1Comments) (PDU2=$PDU2CurrentValue $PDU2Comments)(PDU3=$PDU3CurrentValue $PDU3Comments) (PDU4=$PDU4CurrentValue $PDU4Comments)

regards
You do not have the required permissions to view the files attached to this post.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: sometext from user php script to rrd

Post by tgriep »

Take a look at this link on page 2 and 3 on how to add a comment to the Graph Template.
https://support.nagios.com/forum/viewto ... 2&start=10

You would have to create a PHP script to get the data for the comment and put that in the template like the example from the previous link and then add a comment like the example below to display it in the graph.

Code: Select all

$def[1] .= "COMMENT:'$result'" ;
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked