nagios macros in scripts

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
vvz
Posts: 187
Joined: Wed Oct 30, 2013 5:15 pm

nagios macros in scripts

Post 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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: nagios macros in scripts

Post 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.
Former Nagios employee
vvz
Posts: 187
Joined: Wed Oct 30, 2013 5:15 pm

Re: nagios macros in scripts

Post by vvz »

thank you
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: nagios macros in scripts

Post 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.
Former Nagios employee
vvz
Posts: 187
Joined: Wed Oct 30, 2013 5:15 pm

Re: nagios macros in scripts

Post by vvz »

thank you, I'm completely OK with parameters for scripts
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: nagios macros in scripts

Post by tmcdonald »

Great! I'll be closing this thread now, but feel free to open another if you need anything in the future!
Former Nagios employee
Locked