Page 2 of 2
Re: Add custom variable to 300 services
Posted: Wed Oct 28, 2015 1:59 pm
by WillemDH
Ah damn, sry read too fast. Didn't have to add free vars to svc's yet.

Re: Add custom variable to 300 services
Posted: Wed Oct 28, 2015 2:05 pm
by tmcdonald
"Could" vs "Have the time to do custom dev for free" are pretty different :)
The difficulty is in the automation. For a single service on a single host it is pretty easy, but if I don't have a CSV or something to work with, we need some sort of web interface. The devs might have this on their roadmap already, and it's possible one of them could gut some functionality from a few components and patch something together, but I don't think anything like this exists currently.
To be clear, are these individual services or is it one service applied to many hosts?
Re: Add custom variable to 300 services
Posted: Wed Oct 28, 2015 2:09 pm
by BanditBBS
Yeah, I know Trevor, just giving you a hard time
Individual services. I'm going to do that bad thing and try to figure out the sql. All the services will have similar descriptions, so I'll be able to use the like function.....
Edit: Bah, it uses that separate table...I don't think I can do it easily with just sql. If a dev can easily throw something together it'll save me/one of my guys a ton of time, as I counted, there are about 400 it needs added to

I understand if not, but wow it'd be awesome....
Re: Add custom variable to 300 services
Posted: Wed Oct 28, 2015 7:55 pm
by BanditBBS
DING DING DING
I'll create a new template that has nothing on it except the custom variable and I can then use the Bulk Mod Tool to change the templates in use on the services. Anyone see an issue with that method? I'd have to run it twice and the services use a mixture of two different templates right now and the bulk mod tool replaces templates, it does not add or remove. Other than that caveat I think I'm golden, right?
Re: Add custom variable to 300 services
Posted: Thu Oct 29, 2015 9:45 am
by tmcdonald
It's... gross, but yea I think that would work. Will be a pain to deal with going down the road, but if it works I say do it.
Re: Add custom variable to 300 services
Posted: Thu Oct 29, 2015 3:55 pm
by BanditBBS
Trevor(or whoever),
Adding a value to NOTES on the MISCELLANEOUS tab would be easy with SQL and would not need to use the template method I mentioned. My question now though, how do I add that to notifications? According to this page:
https://assets.nagios.com/downloads/nag ... rvicenotes it is a valid notification variable. I tried adding --servicenotes=$SERVICENOTES$ on the end of the notification command and then add %servicenotes% to my notification messages but no luck
Is XI just not programmed to handle that notification variable or was I doing something wrong?
Re: Add custom variable to 300 services
Posted: Thu Oct 29, 2015 4:07 pm
by tmcdonald
According to page 4 of this doc:
https://assets.nagios.com/downloads/nag ... iables.pdf
it's not in the list, but it appears that all custom macros are possible according to page 5. So maybe don't add it to
notes but add it to
_notes or
_tmcdonaldisacoolguy or something? But then we circle back around to the issue of relating the custom var table to the particular service.