Changeset 1680
- Timestamp:
- 11/13/08 17:48:21 (2 months ago)
- Files:
-
- branches/DEV-opsview3/opsview-core/bin/nagconfgen.pl (modified) (6 diffs)
- branches/DEV-opsview3/opsview-core/lib/Opsview/Servicecheck.pm (modified) (2 diffs)
- branches/DEV-opsview3/opsview-core/t/var/configs/ClusterA/objects.cache (modified) (1 diff)
- branches/DEV-opsview3/opsview-core/t/var/configs/ClusterA/services.cfg (modified) (1 diff)
- branches/DEV-opsview3/opsview-core/t/var/configs/Master Monitoring Server/objects.cache (modified) (2 diffs)
- branches/DEV-opsview3/opsview-core/t/var/configs/Master Monitoring Server/services.cfg (modified) (2 diffs)
- branches/DEV-opsview3/opsview-core/t/var/opsview.test.db (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/DEV-opsview3/opsview-core/bin/nagconfgen.pl
r1679 r1680 429 429 } 430 430 431 # Special commands 432 define command{ 433 command_name negate 434 command_line $libexecpath/negate $libexecpath/\$ARG1\$ 435 } 431 436 define command{ 432 437 command_name my_check_snmp_linkstatus 433 438 command_line $libexecpath/check_snmp_linkstatus -H \$HOSTADDRESS\$ \$ARG1\$ -i -o -I \$ARG2\$ \$ARG3\$ 434 439 } 435 436 440 define command{ 437 441 command_name set_to_stale 438 442 command_line /usr/local/nagios/bin/set_to_stale 439 443 } 440 441 444 define command{ 442 445 command_name set_to_stale_timedoverride 443 446 command_line /usr/local/nagios/bin/set_to_stale 444 447 } 445 446 448 define command{ 447 449 command_name refresh_state 448 450 command_line /usr/local/nagios/bin/refresh_state 449 451 } 450 451 452 define command{ 452 453 command_name my_check_snmp 453 454 command_line $libexecpath/check_snmp -H \$HOSTADDRESS\$ -C \$ARG1\$ -P 2c -o \$ARG2\$ \$ARG3\$ 454 455 } 455 456 456 define command{ 457 457 command_name check_ocsp_status 458 458 command_line /usr/local/nagios/bin/check_file_state /usr/local/nagios/var/ocsp.status 459 459 } 460 461 460 define command{ 462 461 command_name takeover_hosts … … 518 517 519 518 my $commandalias; 520 my $commandargs;521 519 my %notification_options; 522 520 map { $notification_options{$_}++ } split(",", $s->notification_options); … … 524 522 $commandalias = "set_to_stale"; 525 523 } elsif ($s->checktype->id == 1) { 526 $commandalias = $s->plugin; 527 $commandargs = "!".$h->expand_host_macros($sc->{args}); 524 $commandalias = $h->expand_host_macros($s->command(args => $sc->{args}, sep => "!")); 528 525 } elsif ($s->checktype->id == 4 || $s->checktype->id == 2) { 529 526 $commandalias = "refresh_state"; … … 537 534 $oid = &SNMP::translateObj($oid); 538 535 } 539 $commanda rgs= "!".(Opsview::Utils->make_shell_friendly(Opsview::Utils->cleanup_args_for_nagios($h->snmp_community)))."!".$oid."!".$s->check_snmp_threshold_args;536 $commandalias .= "!".(Opsview::Utils->make_shell_friendly(Opsview::Utils->cleanup_args_for_nagios($h->snmp_community)))."!".$oid."!".$s->check_snmp_threshold_args; 540 537 } else { 541 538 $commandalias = "set_to_stale"; … … 547 544 host_name ".$h->name." 548 545 service_description ".$s->name." 549 check_command $commandalias $commandargs546 check_command $commandalias 550 547 normal_check_interval ".($s->check_interval || 5)." 551 548 retry_check_interval ".($s->retry_check_interval || 1)." … … 572 569 573 570 if($sc->{timedoverride} && ${commandalias} ne "set_to_stale") { 574 my $args = $h->expand_host_macros($s c->{timedoverride_args});575 print OUTFILE " check_timeperiod_command ".$sc->{timedoverride_timeperiod}.", ".$commandalias."!".$args."\n";571 my $args = $h->expand_host_macros($s->command(args => $sc->{timedoverride_args}, sep => "!")); 572 print OUTFILE " check_timeperiod_command ".$sc->{timedoverride_timeperiod}.",$args\n"; 576 573 } 577 574 branches/DEV-opsview3/opsview-core/lib/Opsview/Servicecheck.pm
r1679 r1680 227 227 sub command { 228 228 my $self = shift; 229 my %args = @_;229 my %args = ( sep => " ", @_ ); 230 230 my $command; 231 my $path = $args{fullpath} || "";232 if ($path && $path !~ /\/$/) {233 $path .= "/";234 }235 231 if ($self->invertresults) { 236 $command = $path."negate "; 232 $command = "negate$args{sep}"; 233 $args{sep}=" "; 237 234 } 238 235 my $plugin_args; … … 248 245 my $a = $self->args; 249 246 $template =~ s/\$ARGS\$/$a/; 250 $command .= $ path.$template;247 $command .= $template; 251 248 } else { 252 $command .= $path.$self->plugin." $plugin_args"; 249 $command .= $self->plugin; 250 $command .= $args{sep}.$plugin_args if $plugin_args; 253 251 } 254 252 return $command; branches/DEV-opsview3/opsview-core/t/var/configs/ClusterA/objects.cache
r1679 r1680 244 244 command_name my_check_snmp_linkstatus 245 245 command_line /usr/local/nagios/libexec/check_snmp_linkstatus -H $HOSTADDRESS$ $ARG1$ -i -o -I $ARG2$ $ARG3$ 246 } 247 248 define command { 249 command_name negate 250 command_line /usr/local/nagios/libexec/negate /usr/local/nagios/libexec/$ARG1$ 246 251 } 247 252 branches/DEV-opsview3/opsview-core/t/var/configs/ClusterA/services.cfg
r1679 r1680 22 22 } 23 23 24 # Special commands 25 define command{ 26 command_name negate 27 command_line /usr/local/nagios/libexec/negate /usr/local/nagios/libexec/$ARG1$ 28 } 24 29 define command{ 25 30 command_name my_check_snmp_linkstatus 26 31 command_line /usr/local/nagios/libexec/check_snmp_linkstatus -H $HOSTADDRESS$ $ARG1$ -i -o -I $ARG2$ $ARG3$ 27 32 } 28 29 33 define command{ 30 34 command_name set_to_stale 31 35 command_line /usr/local/nagios/bin/set_to_stale 32 36 } 33 34 37 define command{ 35 38 command_name set_to_stale_timedoverride 36 39 command_line /usr/local/nagios/bin/set_to_stale 37 40 } 38 39 41 define command{ 40 42 command_name refresh_state 41 43 command_line /usr/local/nagios/bin/refresh_state 42 44 } 43 44 45 define command{ 45 46 command_name my_check_snmp 46 47 command_line /usr/local/nagios/libexec/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -P 2c -o $ARG2$ $ARG3$ 47 48 } 48 49 49 define command{ 50 50 command_name check_ocsp_status 51 51 command_line /usr/local/nagios/bin/check_file_state /usr/local/nagios/var/ocsp.status 52 52 } 53 54 53 define command{ 55 54 command_name takeover_hosts branches/DEV-opsview3/opsview-core/t/var/configs/Master Monitoring Server/objects.cache
r1679 r1680 249 249 command_name my_check_snmp_linkstatus 250 250 command_line /usr/local/nagios/libexec/check_snmp_linkstatus -H $HOSTADDRESS$ $ARG1$ -i -o -I $ARG2$ $ARG3$ 251 } 252 253 define command { 254 command_name negate 255 command_line /usr/local/nagios/libexec/negate /usr/local/nagios/libexec/$ARG1$ 251 256 } 252 257 … … 2830 2835 service_description AFS 2831 2836 check_period 24x7 2832 check_command check_tcp!-H $HOSTADDRESS$ -p 5482837 check_command negate!check_tcp -H $HOSTADDRESS$ -p 548 2833 2838 event_handler host6_service1_eh-done-for-afs 2834 2839 contact_groups hostgroup5_servicegroup1/masterprofile branches/DEV-opsview3/opsview-core/t/var/configs/Master Monitoring Server/services.cfg
r1679 r1680 22 22 } 23 23 24 # Special commands 25 define command{ 26 command_name negate 27 command_line /usr/local/nagios/libexec/negate /usr/local/nagios/libexec/$ARG1$ 28 } 24 29 define command{ 25 30 command_name my_check_snmp_linkstatus 26 31 command_line /usr/local/nagios/libexec/check_snmp_linkstatus -H $HOSTADDRESS$ $ARG1$ -i -o -I $ARG2$ $ARG3$ 27 32 } 28 29 33 define command{ 30 34 command_name set_to_stale 31 35 command_line /usr/local/nagios/bin/set_to_stale 32 36 } 33 34 37 define command{ 35 38 command_name set_to_stale_timedoverride 36 39 command_line /usr/local/nagios/bin/set_to_stale 37 40 } 38 39 41 define command{ 40 42 command_name refresh_state 41 43 command_line /usr/local/nagios/bin/refresh_state 42 44 } 43 44 45 define command{ 45 46 command_name my_check_snmp 46 47 command_line /usr/local/nagios/libexec/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -P 2c -o $ARG2$ $ARG3$ 47 48 } 48 49 49 define command{ 50 50 command_name check_ocsp_status 51 51 command_line /usr/local/nagios/bin/check_file_state /usr/local/nagios/var/ocsp.status 52 52 } 53 54 53 define command{ 55 54 command_name takeover_hosts … … 1015 1014 host_name resolved_services 1016 1015 service_description AFS 1017 check_command check_tcp!-H $HOSTADDRESS$ -p 5481016 check_command negate!check_tcp -H $HOSTADDRESS$ -p 548 1018 1017 normal_check_interval 5 1019 1018 retry_check_interval 1 branches/DEV-opsview3/opsview-core/t/var/opsview.test.db
r1665 r1680 1327 1327 LOCK TABLES `servicechecks` WRITE; 1328 1328 /*!40000 ALTER TABLE `servicechecks` DISABLE KEYS */; 1329 INSERT INTO `servicechecks` VALUES (1,'AFS',1,'check_tcp','-H $HOSTADDRESS$ -p 548','Network Services',1,'AFS over TCP', 0,'w,c,r',NULL,NULL,'5','1','3',0,NULL,0,1,NULL,1,0);1329 INSERT INTO `servicechecks` VALUES (1,'AFS',1,'check_tcp','-H $HOSTADDRESS$ -p 548','Network Services',1,'AFS over TCP',1,'w,c,r',NULL,NULL,'5','1','3',0,NULL,0,1,NULL,1,0); 1330 1330 INSERT INTO `servicechecks` VALUES (2,'PowerChute',1,'check_tcp','-H $HOSTADDRESS$ -p 3052','Network Services',1,'Checks APC PoweChute on TCP port 3052',0,'w,c,r',NULL,NULL,'5','1','3',0,NULL,0,1,NULL,1,0); 1331 1331 INSERT INTO `servicechecks` VALUES (3,'DHCP',1,'check_dhcp','','Network Services',1,'Checks DHCP on local network',0,'w,c,r',NULL,NULL,'5','1','3',0,NULL,0,1,NULL,1,0);
