Is there a macro that I can use to give me the hostname of the nagios server itself?
I want this as we may have several nagios servers, and when they send an SMS, I'd like to know which one is sending it.
Of course I could manually put it into the command, but would be nice if it were simpler.
Macro for server name?
Re: Macro for server name?
Nope. No such thing in the docs or the source.
I would think if you're sending an SMS, then you would want to make each character count, so I don't know why you want the hostname in there, but you can always add it in the printf command within commands.cfg. Here's one idea. Note the `/bin/hostname` in the middle of the printf:
I would think if you're sending an SMS, then you would want to make each character count, so I don't know why you want the hostname in there, but you can always add it in the printf command within commands.cfg. Here's one idea. Note the `/bin/hostname` in the middle of the printf:
Code: Select all
define command{
command_name notify-service-by-sms
command_line /usr/bin/printf "%b" "$NOTIFICATIONTYPE$ - `/bin/hostname`: $SERVICEDESC$ ($HOSTNAME$) $SERVICESTATE$ - $SERVICEOUTPUT$\n" | $USER1$/send_sms 2>/dev/null
}
-
- Posts: 3
- Joined: Fri Aug 01, 2014 10:09 am
Re: Macro for server name?
Thanks - an interesting idea! However, in the end I just decided to rewrite the sender.
BTW, the hostname doesn't actually take any valuable SMS real-estate, as I'm putting it as the sender ID
BTW, the hostname doesn't actually take any valuable SMS real-estate, as I'm putting it as the sender ID