(No output returned from plugin)
(No output returned from plugin)
Hi everyone,
i got a little issue with a Script that made on PHP, thes cript works fine in te command line but when i put in Nagios i retrieve the message in the descripción: (No output returned from plugin), but the script works perfectly and shows the information that needed, what could be the problem here?
i got a little issue with a Script that made on PHP, thes cript works fine in te command line but when i put in Nagios i retrieve the message in the descripción: (No output returned from plugin), but the script works perfectly and shows the information that needed, what could be the problem here?
Re: (No output returned from plugin)
Please post your service and command definitions, attach the plugin as well so that we can debug further.
Thank you
Thank you
Re: (No output returned from plugin)
It could be a misconfiguration of the service or command definition. What do those look like? What does the full command look like when you run the script from the command line?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: (No output returned from plugin)
Command:ssax wrote:Please post your service and command definitions, attach the plugin as well so that we can debug further.
Thank you
define command {
command_name check_springboot
command_line $USER1$/check_springboot.php --url $ARG1$
}
Service:
define service {
use local-service
host_name localhost
service_description Servicios Cobro QR
check_command check_springboot!192.168.2.196:8080/actuator/health
#register 0
}
Re: (No output returned from plugin)
The pluggin is designed to Monitoring springboot actuator health services by cURL and get the Json response; that have the status of services.cdienger wrote:It could be a misconfiguration of the service or command definition. What do those look like? What does the full command look like when you run the script from the command line?
Code: Select all
#!/usr/bin/php
<?php
define('STATE_OK', 0);
define('STATE_WARNING', 1);
define('STATE_CRITICAL', 2);
define('STATE_UNKNOWN', 3);
$url_aux = getopt(null, ["url:"]);
if ($url_aux == NULL){
echo "Error no has agregado la URL";
$url = NULL;
exit (STATE_UNKNOWN);
}
$url = $url_aux['url'];
$ch = curl_init($url);
#curl_setopt($ch, CURLOPT_URL, '$url');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Accept: application/json'
));
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
$info = curl_getinfo ($ch);
$code = $info['http_code'];
curl_close($ch);
#$json = json_decode($result, true);
#print_r($json);
echo "\nEstado de Servicios\n";
class JSON {
public static function prettify($json)
{
$array = json_decode($json, true);
$json = json_encode($array, JSON_PRETTY_PRINT);
return $json;
}
}
$jsonString = $result;
echo JSON::prettify($jsonString);
if ( $code !== NULL ) {
switch($code){
case 200:
$text = "Servicios OK";
echo "\n$text\n";
exit(STATE_OK);
case 503:
$text = "Servicio DOWN";
echo "$text\n";
exit(STATE_CRITICAL);
default:
$text = "UKNOWN";
echo "$text\n";
exit(STATE_UNKNOWN);
break;
}
}
?>
Re: (No output returned from plugin)
This is the view in Nagios Service:
Current Status: OK (for 0d 1h 3m 46s)
Status Information: (No output returned from plugin)
Estado de Servicios
{
"status": "UP",
"components": {
"diskSpace": {
"status": "UP",
"details": {
"total": 499462959104,
"free": 340257636352,
"threshold": 10485760
}
},
"ping": {
"status": "UP"
}
}
}
Servicios OK
Current Status: OK (for 0d 1h 3m 46s)
Status Information: (No output returned from plugin)
Estado de Servicios
{
"status": "UP",
"components": {
"diskSpace": {
"status": "UP",
"details": {
"total": 499462959104,
"free": 340257636352,
"threshold": 10485760
}
},
"ping": {
"status": "UP"
}
}
}
Servicios OK
-
- Posts: 3
- Joined: Wed Jun 10, 2020 7:07 am
Re: (No output returned from plugin)
Hello,
I got the exact same issue in my php script. Have you found any solution for it yet?
I got the exact same issue in my php script. Have you found any solution for it yet?
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: (No output returned from plugin)
I haven't dug into your full script, but I see this right at the top
the blank line is going to give you a blank line of output right at the beginning of the script which is what Nagios will see as the first link of output and CANNOT be blank
I would recommend changing that to
Code: Select all
#!/usr/bin/php
<?php
I would recommend changing that to
Code: Select all
#!/usr/bin/php
<?php
-
- Posts: 3
- Joined: Wed Jun 10, 2020 7:07 am
Re: (No output returned from plugin)
scottwilkerson wrote:I haven't dug into your full script, but I see this right at the topthe blank line is going to give you a blank line of output right at the beginning of the script which is what Nagios will see as the first link of output and CANNOT be blankCode: Select all
#!/usr/bin/php <?php
I would recommend changing that toCode: Select all
#!/usr/bin/php <?php
This fixed it for me. Thank you
-
- Posts: 3
- Joined: Wed Jun 10, 2020 7:07 am
Re: (No output returned from plugin)
This fixed it for me. Thank youscottwilkerson wrote:I haven't dug into your full script, but I see this right at the topthe blank line is going to give you a blank line of output right at the beginning of the script which is what Nagios will see as the first link of output and CANNOT be blankCode: Select all
#!/usr/bin/php <?php
I would recommend changing that toCode: Select all
#!/usr/bin/php <?php