Problems with passive checks

Tedman Eng teng at dataway.com
Fri Sep 17 05:51:02 CEST 2004


Try changing your check.sh script's echo line to echo -e to parse the "\t"
properly.


-----Original Message-----
From: Jan.Scholten [mailto:Jan.Scholten at iconz.net]
Sent: Thursday, September 16, 2004 3:50 PM
To: nagios-users at lists.sourceforge.net
Subject: [Nagios-users] Problems with passive checks


Hi!

I am unable to receive passive checks, or I am missing a piece..

CentralServer:
Debian testing, Nagios 1.2. External Commands are activated, passive  
commands too
- Set up a Service:
define service{
         name                            generic-service ; The 'name' of  
this service template, referenced in
other service definitions
         active_checks_enabled           1       ; Active service checks  
are enabled
         passive_checks_enabled          1       ; Passive service checks  
are enabled/accepted
         parallelize_check               1       ; Active service checks  
should be parallelized (disabling
this can lead to major  
performance problems)
         obsess_over_service             1       ; We should obsess over  
this service (if necessary)
         check_freshness                 0       ; Default is to NOT check  
service 'freshness'
         notifications_enabled           1       ; Service notifications  
are enabled
         event_handler_enabled           1       ; Service event handler is

enabled
         flap_detection_enabled          1       ; Flap detection is enabled
         process_perf_data               1       ; Process performance data
         retain_status_information       1       ; Retain status  
information across program restarts
         retain_nonstatus_information    1       ; Retain non-status  
information across program restarts
         register                        0       ; DONT REGISTER THIS  
DEFINITION - ITS NOT A REAL SERVICE,
JUST A TEMPLATE!
         }
define service{
         use                             generic-service         ; Name of  
service template to use
         host_name                       testswitch
         service_description             Check
         is_volatile                     0
         check_period                    none
         max_check_attempts              3
         normal_check_interval           1
         retry_check_interval            1
         contact_groups                  Test-Admins
         notification_interval           120
         notification_period             24x7
         notification_options            c,r
         check_command                   check_if2_snmp
         }
nsca.cfg:
server_address=192.168.100.76
allowed_hosts=127.0.0.1,192.168.100.178
debug=1
command_file=/usr/local/nagios/var/rw/nagios.cmd
alternate_dump_file=/usr/local/nagios/var/rw/nsca.dump
password=test
decryption_method=1


On the Remote host I have the same password and decryption method.

my Script
alteredbeast:/usr/local/nagios#cat check.sh
#!/bin/bash
send_nsca=/usr/sbin/send_nsca
send_nsca_cfg=/etc/send_nsca.cfg
nagioshost=192.168.100.76
host=$1
service=$2
plugin=/usr/local/nagios/check_disk
warn=10%
crit=5%
mountpoint=$3
output=`$plugin -w $warn -c $crit -p $mountpoint -m`
rc=$?
echo "$host\t$service\t$rc\t$output"|$send_nsca -H $nagioshost -c  
$send_nsca_cfg
exit 0

When i try to send it via nsca to the central Server i get the following  
result:
alteredbeast:/usr/local/nagios# ./check.sh testswitch Check /dev/hda8
0 data packet(s) sent to host successfully.

And on the Central Server the following lines in syslog:
Sep 17 10:45:42 localhost nsca[7421]: connect from 192.168.100.178  
(192.168.100.178)
Sep 17 10:45:42 localhost nsca[7421]: Handling the connection...
Sep 17 10:45:43 localhost nsca[7421]: End of connection...

No entry appears in the Nagios Command File, but i can trigger a passive  
Result via the web interface (Submit passive check result for this service)

I don't know where to look know..

Jan


When i comment the second half of the "echo" line out
my result is:
alteredbeast:/usr/local/nagios# ./check.sh testswitch Check /dev/hda8
testswitch\tCheck\t0\tDISK OK - free space: /home 2701 MB (94%);|  
/home=2700MB;2591;2735;0;2879



-- 
Jan Scholten
Research and Development Intern
Iconz.co.nz


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting
any issue. 
::: Messages without supporting info will risk being sent to /dev/null


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list