Add custom variable to 300 services

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Add custom variable to 300 services

Post by WillemDH »

Ah damn, sry read too fast. Didn't have to add free vars to svc's yet. :(
Nagios XI 5.8.1
https://outsideit.net
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Add custom variable to 300 services

Post 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?
Former Nagios employee
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Add custom variable to 300 services

Post 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....
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Add custom variable to 300 services

Post by BanditBBS »

DING DING DING :idea: :idea:

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?
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Add custom variable to 300 services

Post 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.
Former Nagios employee
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Add custom variable to 300 services

Post 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?
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Add custom variable to 300 services

Post 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.
Former Nagios employee
Locked