Page 1 of 1

sometext from user php script to rrd

Posted: Sun Dec 01, 2019 3:12 am
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

Re: sometext from user php script to rrd

Posted: Mon Dec 02, 2019 3:35 pm
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?

Re: sometext from user php script to rrd

Posted: Sun Dec 08, 2019 5:46 am
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

Re: sometext from user php script to rrd

Posted: Mon Dec 09, 2019 10:21 am
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";

Re: sometext from user php script to rrd

Posted: Wed Dec 18, 2019 6:35 am
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

Re: sometext from user php script to rrd

Posted: Wed Dec 18, 2019 10:31 am
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'" ;