selected period need to show in performance graph
Re: selected period need to show in performance graph
thanks for your efforts
so only solution is feature request, to add PERIOD via TEMPLATE
same time, please do not forget to add DISPLAY_NAME via TEMPLATE
both will we additional feature to add at below X-Axis of the graph
regards
so only solution is feature request, to add PERIOD via TEMPLATE
same time, please do not forget to add DISPLAY_NAME via TEMPLATE
both will we additional feature to add at below X-Axis of the graph
regards
Re: selected period need to show in performance graph
FYI, we did find a solution to print out the last time the rrd file was updated. Put the following line at the bottom of the template and it will print the date / time to the graph..
I will put in a feature request for the rest of what you want to display in the graphs.
Code: Select all
$def[1] .= "COMMENT:'".str_replace(':', '\:', date("Y-m-d H:i:s", "$NAGIOS_TIMET"))."'" ;Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: selected period need to show in performance graph
great its done
$def[1] .= "COMMENT:Printed\ on\ '".str_replace(':', '\:', date("D d-M-Y H:i", "$NAGIOS_TIMET"))." (GMT+n)"."'" ;
upon your this solution, thinking may be there is a way to call external PHP code from this template (check_xi_service_mrtgtraf.php)
will pass the $hostname & $servicedesc from this Template to external PHP function and will return Display_Name
we will write that small external PHP code / function, sure with your some guideline/hint
Regards
$def[1] .= "COMMENT:Printed\ on\ '".str_replace(':', '\:', date("D d-M-Y H:i", "$NAGIOS_TIMET"))." (GMT+n)"."'" ;
upon your this solution, thinking may be there is a way to call external PHP code from this template (check_xi_service_mrtgtraf.php)
will pass the $hostname & $servicedesc from this Template to external PHP function and will return Display_Name
we will write that small external PHP code / function, sure with your some guideline/hint
Regards
Re: selected period need to show in performance graph
There is not a direct way to get the display_name from an external application so something would have to be written to get the name.
If you do an API call to get the servicestatus for a host, it will return a list of the services for that host and the display_name will be included as json.
You could use that to get the data into the php script so you can display it in the graph.
curl -XGET "https://xxx.xxx.xxx.xxx/nagiosxi/api/v1 ... t&pretty=1" -k
If you do an API call to get the servicestatus for a host, it will return a list of the services for that host and the display_name will be included as json.
You could use that to get the data into the php script so you can display it in the graph.
curl -XGET "https://xxx.xxx.xxx.xxx/nagiosxi/api/v1 ... t&pretty=1" -k
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: selected period need to show in performance graph
dear tgriep
in /usr/local/nagios/share/pnp/templates
I have copied below files
hostservices.txt (left side host+service , one space , and right side is displayname)
router1giga1 connected_to_london
router1pos2 connected_to_paris
jnpr3xe-0/0/1 uplink-to-frakfurt
$ php ./fetchdispname.php jnpr3xe-0/0/1 <<<<<<<<<<<<<<<< has been written to fetch the DisplayName
uplink-to-frakfurt <<<<<<<<<<<<< tested working fine
now how to add this PHP code/function (fetchdispname.php) in MRTG template or any other place to show/print DisplayName in rrd / performance graph fetched by PHP Code (fetchdispname.php)
regards
in /usr/local/nagios/share/pnp/templates
I have copied below files
hostservices.txt (left side host+service , one space , and right side is displayname)
router1giga1 connected_to_london
router1pos2 connected_to_paris
jnpr3xe-0/0/1 uplink-to-frakfurt
$ php ./fetchdispname.php jnpr3xe-0/0/1 <<<<<<<<<<<<<<<< has been written to fetch the DisplayName
uplink-to-frakfurt <<<<<<<<<<<<< tested working fine
now how to add this PHP code/function (fetchdispname.php) in MRTG template or any other place to show/print DisplayName in rrd / performance graph fetched by PHP Code (fetchdispname.php)
regards
Re: selected period need to show in performance graph
If the fetchdispname.php script in in the /usr/local/nagios/share/pnp/templates folder
You would add this to the mrtg template to get the display name. If you have any arguments needed for your script, you will have to pass them to it.
As long as the permissions are good and the name of the macro it the same, it should work.
You would add this to the mrtg template to get the display name. If you have any arguments needed for your script, you will have to pass them to it.
Code: Select all
$displayname = "php -q /usr/local/nagios/share/pnp/templates/fetchdispname.php";Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: selected period need to show in performance graph
dear tgriep
$opt[1] = "--vertical-label score -l0 --title \"Score for $hostname / $servicedesc\" ";
$displayname = "php -q /usr/local/nagios/share/pnp/templates/fetchdispname.php";
#
$def[1] .= "COMMENT:\" DispName $displayname \" ";
$def[1] .= "COMMENT:mAGIc'" .$displayname. "'" ; <<<<<<<<<<< tried this way but no success
it just diplaying as below
DispName php -q /usr/local/nagios/share/pnp/templates/fetchdispname.php
(means it just assigning right side string "php -q /usr....." to $displayname) not executing the code
to make the simple, I just change the code to three lines only,
more fetchdispname.php
<?php
return "MyMagicDISPname";
?>
tried to change the different group but no success
chown nagios:nagios fetchdispname.php
chown root:nagios fetchdispname.php
chown apache:nagios fetchdispname.php
chmod 755 fetchdispname.php
Looks your some more last efforts will fix this issue
regards
$opt[1] = "--vertical-label score -l0 --title \"Score for $hostname / $servicedesc\" ";
$displayname = "php -q /usr/local/nagios/share/pnp/templates/fetchdispname.php";
#
$def[1] .= "COMMENT:\" DispName $displayname \" ";
$def[1] .= "COMMENT:mAGIc'" .$displayname. "'" ; <<<<<<<<<<< tried this way but no success
it just diplaying as below
DispName php -q /usr/local/nagios/share/pnp/templates/fetchdispname.php
(means it just assigning right side string "php -q /usr....." to $displayname) not executing the code
to make the simple, I just change the code to three lines only,
more fetchdispname.php
<?php
return "MyMagicDISPname";
?>
tried to change the different group but no success
chown nagios:nagios fetchdispname.php
chown root:nagios fetchdispname.php
chown apache:nagios fetchdispname.php
chmod 755 fetchdispname.php
Looks your some more last efforts will fix this issue
regards
Re: selected period need to show in performance graph
I forgot to remove the double quotes, from the command.
Try this
or this
This line should look like this
Also, make sure you set the $displayname variable before trying to display it.
Try this
Code: Select all
$displayname = php -q /usr/local/nagios/share/pnp/templates/fetchdispname.php;Code: Select all
$displayname = /usr/local/nagios/share/pnp/templates/fetchdispname.php;Code: Select all
$opt[1] = "--vertical-label score -l0 --title \"Score for $hostname / $servicedesc / $displayname\" ";Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: selected period need to show in performance graph
dear tgriep
no, not giving the desired result
$opt[1] = "--vertical-label score -l0 --title \"Score for $hostname / $servicedesc\" ";
$displayname = php -q /usr/local/nagios/share/pnp/templates/fetchdispname.php;
$def[1] .= "COMMENT:\" DispName $displayname \" ";
displaying >>>>> 0php <<<<<< this is the result of $displayname
two possibilities
1) may be the code not running as should
or
2) the PHP code (fetchdispname.php) is not correct
if No.1 is wrong, can you please test in your Leb
if No.2 is wrong, can you please write few line code with static output as I mentioned earlier to make sure code is correct (as below similar).
more fetchdispname.php
<?php
return "MyMagicDISPname";
?>
regards
no, not giving the desired result
$opt[1] = "--vertical-label score -l0 --title \"Score for $hostname / $servicedesc\" ";
$displayname = php -q /usr/local/nagios/share/pnp/templates/fetchdispname.php;
$def[1] .= "COMMENT:\" DispName $displayname \" ";
displaying >>>>> 0php <<<<<< this is the result of $displayname
two possibilities
1) may be the code not running as should
or
2) the PHP code (fetchdispname.php) is not correct
if No.1 is wrong, can you please test in your Leb
if No.2 is wrong, can you please write few line code with static output as I mentioned earlier to make sure code is correct (as below similar).
more fetchdispname.php
<?php
return "MyMagicDISPname";
?>
regards
Re: selected period need to show in performance graph
I added / edited these 2 lines to the top of the Graph Template
I had to change the fetchdispname.php script to the following
That printed MyMagicDISPname to the top line of graph.
Code: Select all
$displayname = shell_exec( 'php /usr/local/nagios/share/pnp/templates/fetchdispname.php' );
$opt[1] = " --vertical-label \"Traffic $UNIT[1]\" -E --title \"Interface Traffic for $hostname / $servicedesc / $displayname\" ";Code: Select all
<?php
print( "MyMagicDISPname");
?>That printed MyMagicDISPname to the top line of graph.
Be sure to check out our Knowledgebase for helpful articles and solutions!