event_handlers macro contactemail

Carlos de Sousa Carlos.de_Sousa at ericsson.com
Thu Mar 9 23:18:45 CET 2006


Hi!

Thanx for the prompt answer, I realize now that
I shouldn't try to fool the system by using obscure
ways.

BUT .....

    If I use the suggested "contact"-path, could u
pls explain what is the major difference between
a notification and an event?

If I already have in production  a event-handler
script that works fine (except for not using the CONTACTx stuff),
would I then disable "event_handler processing" completely
and use the contactgroup in a host definition to use a contact
that would call the same script as I am using for events?

The example I gave before is somewhat shortened, here is what
I really use

define command {
command_name                   send_snmptrap_host
command_line                   /usr/bin/perl
$USER1$/eventhandlers/send_nagiostrap HOST $HOSTSTATE$ $HOSTSTATETYPE$
$HOSTATTEMPT$ $HOSTNAME$#$HOSTADDRESS$#$HOSTALIAS$#$SERVICEDESC$#$USER2$
}

Would I still be able to use the above macros through a notification
command?
Would the macros above contain the exact same information if I used
them in a notification command rather than in a event_handler?

So basically, If I understood u right, u say that I could do

define host {
       name                           NOC-MAIN

       event_handler_enabled          0
       register                       0
       notifications_enabled          1
       contact_groups                 NOC_TRAP
}

define host {
      name          host1
      use           NOC-MAIN
      alias             my host1
      address           xxx.xxx.xxx.xxx
      check_command     check-host-alive
}

define contactgroup {
     contactgroup_name              NOC_TRAP
     alias                          noc trap contact
     members                        noc_trap
}


define contact {
    contact_name                   noc_trap
    alias                          contact for running traps
    service_notification_period    24x7
    host_notification_period       24x7
    service_notification_options   w,u,c,r
    host_notification_options      d,u,r
    service_notification_commands  send_snmptrap_svc
    host_notification_commands     send_snmptrap_host
    email                          xx at xx
    pager                          some number
    address1                       text1
    #address2                       Network Security
    #address3                       Network Security
    #address4                       Network Security
    #address5                       Network Security
    #address6                       Network Security
}

would I loose any functionality at all by not using eventhandlers
in favor of notification commands?


would appreciate your help

Regards
Carlos de Sousa



Marc Powell wrote:
> 
>>-----Original Message-----
>>From: nagios-users-admin at lists.sourceforge.net [mailto:nagios-users-
>>admin at lists.sourceforge.net] On Behalf Of Carlos de Sousa
>>Sent: Thursday, March 09, 2006 1:02 PM
>>To: nagios-users at lists.sourceforge.net
>>Subject: [Nagios-users] event_handlers macro contactemail
>>
>>Hi!
>>
>>I am in real need for having access to the $CONTACTx$ macros in my
>>eventhandlers. I am running Nagios V2.
>>
>>Would I get it to work if I did the following?
>>
>>
>>define command {
>>     command_name                   send_snmptrap_host
>>     command_line                   /usr/bin/perl
>>$USER1$/eventhandlers/send_nagiostrap $ARG1$ $ARG2$
>>
>>}
>>
>>define host {
>>      name                           NOC-MAIN
>>
>>      event_handler_enabled          1  ; Host event handler is
> 
> enabled
> 
>>
>>      register                       0  ; DONT REGISTER THIS
> 
> DEFINITION
> 
>>      notifications_enabled          0
>>      event_handler
>>send_snmptrap_host!$CONTACTEMAIL$!$CONTACTPAGER$
>>      contact_groups                 NOC
>>}
>>
> 
> 
> No, the $CONTACT*$ macros are not available to event handlers. See the
> chart at --
> 
> http://nagios.sourceforge.net/docs/2_0/macros.html
> 
> 
> 
>>Any other suggestion?
> 
> 
> Why not make a contact whose notification command runs
> send_nagiostrap_host and associate them with that host? You could also
> build in logic into send_nagiostrap_host to gather that information from
> some other source or the nagios config files themselves if the contact
> route isn't acceptable to you.
> 
> 
>>would it work if I put the event_handler keyword in the host
>>definition for the host instead of in a template?
> 
> 
> No, they're just not available to the event_handler subsystem at all.
>  
> --
> Marc 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting language
> that extends applications into web and mobile media. Attend the live webcast
> and join the prime developer group breaking into this new coding territory!
> http://sel.as-us.falkag.net/sel?cmd=k&kid0944&bid$1720&dat1642
> _______________________________________________
> 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

-- 
Carlos de Sousa

Ericsson AB
Phone: +46 8 56860605
Mail: Carlos.de_Sousa at ericsson.com

Disclaimer

This communication is confidential and intended solely for the
addressee(s). Any unauthorized review, use, disclosure or distribution
is prohibited. If you believe this message has been sent to you in
error, please notify the sender by replying to this transmission and
delete the message without disclosing it. Thank you.

E-mail including attachments is susceptible to data
corruption,interruption, unauthorized amendment, tampering and viruses,
and we only send and receive e-mails on the basis that we are not liable
for any such corruption, interception, amendment, tampering or viruses
or any consequences thereof.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Carlos.de_Sousa.vcf
Type: text/x-vcard
Size: 161 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/users/attachments/20060309/3c022a74/attachment.vcf>


More information about the Users mailing list