Page 1 of 1
nagios macros in scripts
Posted: Mon Apr 21, 2014 12:54 pm
by vvz
Hello!
I'm going to use nagios to send me phone calls via Asteriks.
I'm going to use eventhandler for - bash script.
Is it possible to use Nagios macros (like $CONTACTMAIL$) in bash script somehow?
Thank you
Re: nagios macros in scripts
Posted: Mon Apr 21, 2014 12:57 pm
by tmcdonald
You can't use them directly within the script itself, but you can certainly pass them in as bash parameters in the event handler, then within the script use $1, $2, etc to get them.
Re: nagios macros in scripts
Posted: Mon Apr 21, 2014 1:03 pm
by vvz
thank you
Re: nagios macros in scripts
Posted: Mon Apr 21, 2014 1:06 pm
by tmcdonald
It is *technically* possible to use them directly, but you will have to set certain environment variables first and that will cause some potential load issues.
Re: nagios macros in scripts
Posted: Mon Apr 21, 2014 1:09 pm
by vvz
thank you, I'm completely OK with parameters for scripts
Re: nagios macros in scripts
Posted: Mon Apr 21, 2014 1:09 pm
by tmcdonald
Great! I'll be closing this thread now, but feel free to open another if you need anything in the future!