Custom misccommands.cfg

Ethan Galstad nagios at nagios.org
Wed Dec 13 20:49:44 CET 2006


Jeremy Young wrote:
> Quick question, wondering if it was possible to grab a HOSTGROUP
> variable when using a command like host-notify-by-email, or
> notify-by-email. I would like the notification to show which hostgroup
> the affected host belongs to?
> 
> The following does not work:
> 
> define command{
>         command_name    notify-by-email
>         command_line    /usr/bin/printf "%b" "***** Nagios-MCI
> *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService:
> $SERVICEDESC$\nHost: $HOSTALIAS$\nHost Group: $HOSTGROUP$\nAddress:
> $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time:
> $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s
> "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is
> $SERVICESTATE$ **" $CONTACTEMAIL$
>         }
> 
> Any help is much appreciated?
> 
> Jeremy
> 

You can use the $HOSTGROUPNAME$ macro to get the name of the (first) 
hostgroup that a particular host/service belongs to.  See:

http://nagios.sourceforge.net/docs/2_0/macros.html#hostgroupname

Hope that helps.


Ethan Galstad,
Nagios Developer
---
Email: nagios at nagios.org
Website: http://www.nagios.org

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV




More information about the Developers mailing list