Here's the definition:
define command {
command_name check_disk_snmp
command_line $USER1$/check_disk_snmp $HOSTADDRESS$
2>/dev/null
}
as from the debug log:
[1386766294.078566] [024.1] [pid=31567] Run a few checks before
executing a service check for 'check_disk_snmp'.
[1386766294.079175] [008.0] [pid=31567] ** Service Check Event ==> Host:
'pmzen3-9', Service: 'check_disk_snmp', Options: 0, Latency: 0.079000 sec
[1386766294.079382] [016.0] [pid=31567] Attempting to run scheduled
check of service 'check_disk_snmp' on host 'pmzen3-9': check options=0,
latency=0.079000
[1386766294.080000] [016.0] [pid=31567] Checking service
'check_disk_snmp' on host 'pmzen3-9'...
[1386766294.080246] [2320.2] [pid=31567] Raw Command Input:
$USER1$/check_disk_snmp $HOSTADDRESS$ 2>/dev/null
[1386766294.080354] [2320.2] [pid=31567] Expanded Command Output:
$USER1$/check_disk_snmp $HOSTADDRESS$ 2>/dev/null
[1386766294.080651] [2048.1] [pid=31567] Processing:
'$USER1$/check_disk_snmp $HOSTADDRESS$ 2>/dev/null'
[1386766294.081587] [2048.2] [pid=31567] Processing part:
'/check_disk_snmp '
[1386766294.081684] [2048.2] [pid=31567] Not currently in macro.
Running output (42): '/usr/local/icinga/libexec/check_disk_snmp '
[1386766294.082181] [2048.2] [pid=31567] Uncleaned macro. Running
output (53): '/usr/local/icinga/libexec/check_disk_snmp 172.20.0.79'
[1386766294.082281] [2048.2] [pid=31567] Just finished macro. Running
output (53): '/usr/local/icinga/libexec/check_disk_snmp 172.20.0.79'
[1386766294.082485] [2048.2] [pid=31567] Not currently in macro.
Running output (65): '/usr/local/icinga/libexec/check_disk_snmp
172.20.0.79 2>/dev/null'
[1386766294.082579] [2048.1] [pid=31567] Done. Final output:
'/usr/local/icinga/libexec/check_disk_snmp 172.20.0.79 2>/dev/null'
[1386766294.087502] [016.0] [pid=25883] running command
/usr/local/icinga/libexec/check_disk_snmp 172.20.0.79 2>/dev/null via popen
so yes, it run exactly as it should
On 11.12.2013 14:35, Gerd Radecke wrote:
Can you post the definition for check_command check_disk_snmp?
are you sure it is executed as you expect it to by icinga? (in the
classic UI, you can get the raw command line when you have the
detailed check view and click on the Check Type "active" link.)
is the command definitely being executed on the correct host? (double
check the IP maybe?)
On Wed, Dec 11, 2013 at 12:39 PM, Dan Radu Dragomir
<r...@aim4solutions.com> wrote:
Hi everybody,
I've been bashing my head against the wall for 3 days already and I
can't seem to be able to understand what's going on.
As I've already googled about this until my fingers bled I decided to
ask you guys, maybe you're in a better position on this:
Here's the issue
Icinga (classic) install: 1.10.2
OS:
Distributor ID: Ubuntu
Description: Ubuntu 12.04.3 LTS
Release: 12.04
Codename: precise
Completely random 2 commands end up with the error in $subj.
Here's the script (command):
#!/usr/bin/php
<?php
$HOSTNAME=$argv[1];
$lines=snmprealwalk($HOSTNAME,'public','.1.3.6.1.4.1.2021.9.1');
foreach($lines as $key=>$value) {
if (!empty($value)) {
$second=explode('iso.3.6.1.4.1.2021.9.1.',$key);
$third=explode('.',$second[1]);
$index=trim($third[1]);
$diskInfo[$index][$third[0]]=$value;
}
}
$infoLine='';
$status=0;
foreach ($diskInfo as $diskKey=>$diskValues) {
if (!strpos($diskValues[3],'/dev')) {
unset($diskInfo[$diskKey]);
} else {
$diskName=trim(clean($diskValues[2]));
if($diskName=='/') {
$diskName='root';
}
$diskInfo[$diskKey][2]=$diskName;
$infoLine.=
$diskName.'('.trim(clean($diskValues[3])).'):'.trim(clean($diskValues[9])).'%
used; ';
$percentUsed=(int)trim(clean($diskValues[9]));
if($percentUsed >= 90 ) $status=1;
if($percentUsed >= 99 ) $status=2;
}
}
fwrite(STDOUT, $infoLine."\n");
exit($status);
function clean($data){
$dataArray = explode(':',$data);
$dataOutput = trim($dataArray[1]);
$dataOutput = str_replace('"','',$dataOutput);
return $dataOutput;
}
Running this from command line (shell) outputs the correct answer
including the exit code:
root@louie:~# sudo -u icinga /usr/local/icinga/libexec/check_disk_snmp
172.20.1.21 2>/dev/null ; echo $?
root(/dev/sda1):19% used; /boot(/dev/sda2):18% used;
0
and as the user itself:
/usr/local/icinga/libexec/check_disk_snmp 172.20.1.21 2>/dev/null ; echo $?
root(/dev/sda1):19% used; /boot(/dev/sda2):18% used;
0
so everything seems to be correct (as far as i can tell)
Here's the service definition
define service {
service_description check_disk_snmp
check_command check_disk_snmp
host_name telefonix
check_period 24x7
notification_period 24x7
register 1
max_check_attempts 3
check_interval 5
retry_interval 5
first_notification_delay 5
notification_interval 5
active_checks_enabled 1
notifications_enabled 1
event_handler_enabled 0
contact_groups +C1
}
Any ideas ?
Thx in adavnce:
Radu Dragomir
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
icinga-users mailing list
icinga-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/icinga-users
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
icinga-users mailing list
icinga-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/icinga-users
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
icinga-users mailing list
icinga-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/icinga-users