dear tgriep
thanks for your great efforts but still there issue even in testing phase
more graphtemplate.php
$displayname1 = shell_exec( 'php /usr/local/nagios/share/pnp/templates/fetchdispname.php router2int2' );
$displayname2 = shell_exec( 'php /usr/local/nagios/share/pnp/templates/fetchdispname.php "router3int3"' );
$def[1] .= "COMMENT:\" DispName1 $displayname1 \\n\" ";
$def[1] .= "COMMENT:\" DispName2 $displayname2 \\n\" ";
passed the static parameters for testing purpose with Quotes and without Quotes, from CLI its okay but in real scenario unable to match even I tried with == or === (logical AND)
working fine from CLI with quotes
php /usr/local/nagios/share/pnp/templates/fetchdispname.php "router3int3"
diSPNameTHreerouter3int3
working fine from CLI without quotes
php /usr/local/nagios/share/pnp/templates/fetchdispname.php router2int2
dispname2router2int2
more fetchdispname.php
<?php
$from_mrtg=$argv[1];
$MeraSaya="SorrY";
$Hlines = file('hostservice.txt');
foreach ($Hlines as $Kline) {
$Yparts = explode(' ', $Kline);
if ($Yparts[0]==$from_mrtg) {
$MeraSaya=substr($Yparts[1], 0, -1);
}
}
print($MeraSaya.$from_mrtg);
?>
more hostservice.txt
router1int1 dispname1
router2int2 dispname2
router3int3 diSPNameTHree
but on the graph showing as below
DispName1 SorrYrouter2int2
DispName2 SorrYrouter3int3
regards
sorry for trouble
selected period need to show in performance graph
Re: selected period need to show in performance graph
You should put in the full path to the hostservice.txt file in the fetchdisplayname.php script so it knows that exact location of the file.
Also, make sure it is readable too.
Also, make sure it is readable too.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: selected period need to show in performance graph
dear tgriep
great....testing phase over......will come back to you when it will work in real scenario
thanks a lot to you
great....testing phase over......will come back to you when it will work in real scenario
thanks a lot to you
Re: selected period need to show in performance graph
Your welcome. Let us know how it works out.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: selected period need to show in performance graph
dear tgriep
i am fetching values directly from MySQL and okay when the Service_Description does not have any space or :
we using colon (:) and space in our service_description and in the Template.php it get replaced by under score (_), i tried to use $NAGIOS_DISP_SERVICEDESC which i want to say having original value whatever we feed as a Service_Description but no success, its giving
blank or empty or NULL value whatever you say it
now how to pass original value from Template.PHP to my fetchdispname.php script
or
any valuable advice (other way to do fetch the value)
$NagHost=$argv[1];
$NagSrvc=$argv[2];
$sql = "SELECT object_id FROM nagios_objects WHERE name1='".$NagHost."' AND name2='".$NagSrvc."' AND objecttype_id=2 AND is_active=1";
not matching and fetching 0 zero records
regards
i am fetching values directly from MySQL and okay when the Service_Description does not have any space or :
we using colon (:) and space in our service_description and in the Template.php it get replaced by under score (_), i tried to use $NAGIOS_DISP_SERVICEDESC which i want to say having original value whatever we feed as a Service_Description but no success, its giving
blank or empty or NULL value whatever you say it
now how to pass original value from Template.PHP to my fetchdispname.php script
or
any valuable advice (other way to do fetch the value)
$NagHost=$argv[1];
$NagSrvc=$argv[2];
$sql = "SELECT object_id FROM nagios_objects WHERE name1='".$NagHost."' AND name2='".$NagSrvc."' AND objecttype_id=2 AND is_active=1";
not matching and fetching 0 zero records
regards
Re: selected period need to show in performance graph
Put double quotes around the shell_exec command like this so which will pass the variables to the php script.
$NagDspNam = shell_exec( "php /usr/local/nagios/share/pnp/templates/fetchdispname.php $hostname $servicedesc" );
$NagDspNam = shell_exec( "php /usr/local/nagios/share/pnp/templates/fetchdispname.php $hostname $servicedesc" );
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: selected period need to show in performance graph
dear tgriep
its already done and working fine however there is but....sorry, can you read my above post one more time
$NagDspNam = shell_exec( "php /usr/local/nagios/share/pnp/templates/fetchdispname.php '".$hostname."' '".$servicedesc."'" );
when servicedesc = 0754_real_time_sla_rrt <<<<<<<<<<<< working fine
but when servicedesc = 6573:router1:int1_1ge:rotuer2:int3 Latency <<<<<<<<not working because
this real services description get changed and coming to Template.php like below
6573_router1_int1_1ge_rotuer2_int3_Latency <<<<<<< colon and space get replaced with _ (underscore) then how it will match with real name2 in nagios table.
Regards
its already done and working fine however there is but....sorry, can you read my above post one more time
$NagDspNam = shell_exec( "php /usr/local/nagios/share/pnp/templates/fetchdispname.php '".$hostname."' '".$servicedesc."'" );
when servicedesc = 0754_real_time_sla_rrt <<<<<<<<<<<< working fine
but when servicedesc = 6573:router1:int1_1ge:rotuer2:int3 Latency <<<<<<<<not working because
this real services description get changed and coming to Template.php like below
6573_router1_int1_1ge_rotuer2_int3_Latency <<<<<<< colon and space get replaced with _ (underscore) then how it will match with real name2 in nagios table.
Regards
Re: selected period need to show in performance graph
Then, you will have to re-write the script to replace the Underscores with what ever is needed to run your MYSQL query.
Look as the str_replace php function to do that.
Look as the str_replace php function to do that.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: selected period need to show in performance graph
dear tgriep
Thanks!!! great...working fine......really thanks to you for going extra mile.....Salute to Nagios Support Team.
but me little greedy......now want to come back to my original question
how to print graph period.........is there any way if I have to write some small script I will do under your guidance.
regards
Thanks!!! great...working fine......really thanks to you for going extra mile.....Salute to Nagios Support Team.
but me little greedy......now want to come back to my original question
how to print graph period.........is there any way if I have to write some small script I will do under your guidance.
regards
Re: selected period need to show in performance graph
Your welcome.
Sorry, getting the time period of the graph printed on the graph is not possible as it is not passed into the templates so there is not a way to get those values.
Sorry, getting the time period of the graph printed on the graph is not possible as it is not passed into the templates so there is not a way to get those values.
Be sure to check out our Knowledgebase for helpful articles and solutions!