How to surpess notifications if ping fails.

Jon Angliss jon at netdork.net
Thu Jul 2 00:15:38 CEST 2009


Jeremiah Jester wrote:
> Hmmm, tryied this...but not working. Also, i get an error when i specify
> 'retry_interval'. maybe n agios3 only?
> 
> define host{
>     host_name               psedev2
>     alias                   dev
>     check_command           check-host-alive
>     notification_options    d,r
>     max_check_attempts      3
>     check_interval          1
>     retry_interval          1
>     address                 10.139.10.42
>     use                     generic-host
>     parents                 switch-office
> }
> 
> Error log:
> [1246481763] Error: Invalid host object directive 'retry_interval'.
> [1246481763] Error: Could not add object property in file
> '/etc/nagios2/conf.d/generic-host_nagios2.cfg' on line 143.
> [1246481763] Bailing out due to one or more errors encountered in the
> configuration files.  Run Nagios from the command line with the -v
> option to verify your config before restarting. (PID=27490)

Yep, that'd be a nagios 3 option.  I'd not realized (or maybe
missed) you were using v2.  Just remove that option.

-- 
Jon Angliss
<jon at netdork.net>


> 
> 
> Thanks,
> JJ
> 
> 
> On Tue, Jun 30, 2009 at 9:08 PM, Jon Angliss <jon at netdork.net
> <mailto:jon at netdork.net>> wrote:
> 
>     Jeremiah Jester wrote:
>     > Jon,
>     >
>     > Thanks for the reply. I've been struggling with this for some
>     days. Can
>     > you give me an example of what how to define this and in what file? I
>     > would appreciate your help.
> 
>     Files don't really matter.  Nagios loads them all, and processes.
>     Its up to you how you want to format.  Sometimes it's easier to
>     group by type (hosts, services, commands, etc), and others by
>     location (server room, etc).  How you format is up to you.  If you
>     want, you can even bundle it all in a single file.
> 
>     Lines ending in \ are wrapped and should appear on a single line in
>     your config.
> 
>     define command {
>            command_name    check-host-alive
>            command_line    $USER1$/check_ping -H $HOSTADDRESS$ \
>                                    -w 3000.0,80% -c 5000.0,100% \
>                                    -p 5
>     }
> 
>     define command {
>            command_name    check_http
>            command_line    $USER1$/check_http -H $HOSTNAME$
>     }
> 
>     define host {
>            host_name               myhost
>            address                 1.1.1.1
>            check_command           check-host-alive
>            notification_options    d,r
>            check_period            All
>            max_check_attempts      3
>            check_interval          1
>            retry_interval          1
>            contact_groups          mycontacts
>     }
> 
>     define service {
>            host_name               myhost
>            check_command           check_http
>            {.. other stuff here .. }
>     }
> 
>     This will execute check_http against the "myhost".  check-host-alive
>     will be executed every 1 minute.  If check-host-alive fails 3 times,
>     host is considered down, and alerts for check_http will be
>     suppressed.  You should read up on host checks [1], service checks
>     [2], and notifications [3].
> 
>     > Also, I've not seen v3 in the repsository but maybe i need to
>     change my
>     > sources?
> 
>     You didn't mention which version of ubuntu you were using, but
>     jaunty has nagios3...
> 
>      http://packages.ubuntu.com/jaunty/nagios3
> 
> 
> 
>     [1]: http://nagios.sourceforge.net/docs/3_0/hostchecks.html
>     [2]: http://nagios.sourceforge.net/docs/3_0/servicechecks.html
>     [3]: http://nagios.sourceforge.net/docs/3_0/notifications.html
> 
>     --
>     Jon Angliss
>     <jon at netdork.net <mailto:jon at netdork.net>>
> 
> 


-- 
Jon Angliss
<jon at netdork.net>

------------------------------------------------------------------------------
_______________________________________________
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