I'm working to automate the addition of hosts in Nagios when we stand them up in Ansible. While I was testing the scripts in development, I called the API several times with the applyconfig=1 parameter by mistake.
Because it was in the test environment, it wasn't a big deal, but was curious to find out where these requests are queued up (and maybe my script could check to ensure that subsequent apply configs aren't done)?
Multiple calls to API with applyconfig=1
-
dwhitfield
- Former Nagios Staff
- Posts: 4583
- Joined: Wed Sep 21, 2016 10:29 am
- Location: NoLo, Minneapolis, MN
- Contact:
Re: Multiple calls to API with applyconfig=1
There is work going on in the API that should help you in this endeavor. Unfortunately, I don't have an ETA on that.
My major concern with limiting apply configs is that what if you are spinning up two different machines and they both need to run apply config. You need them both to run. Maybe I'm misunderstanding exactly what you want to do though.
It's possible you could just "queue up" the apply config in a variable in your script and just have it run once when the script exits.
My major concern with limiting apply configs is that what if you are spinning up two different machines and they both need to run apply config. You need them both to run. Maybe I'm misunderstanding exactly what you want to do though.
It's possible you could just "queue up" the apply config in a variable in your script and just have it run once when the script exits.
Re: Multiple calls to API with applyconfig=1
My script typically does wait until the last host has been added before doing an applyconfig=1, but in this case, we had someone feed each host in individually instead of a feeding in the group of hosts.dwhitfield wrote:My major concern with limiting apply configs is that what if you are spinning up two different machines and they both need to run apply config. You need them both to run. Maybe I'm misunderstanding exactly what you want to do though.
Re: Multiple calls to API with applyconfig=1
Are you asking if there is an API call to see if the system needs an apply config ran or if one is in the queue?
If so, that function is not in the API currently, your application would have to keep track of that for you.
Does that answer your question?
If so, that function is not in the API currently, your application would have to keep track of that for you.
Does that answer your question?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Multiple calls to API with applyconfig=1
Not really - wanting to know where it queues those requests up at. Are they added to the ipcs queue? If so, then looking for them would be a lost cause.tgriep wrote:Are you asking if there is an API call to see if the system needs an apply config ran or if one is in the queue?
If so, that function is not in the API currently, your application would have to keep track of that for you.
Re: Multiple calls to API with applyconfig=1
From what I was told, they do not queue up. If you create a host or service check using the API but do not apply it, those entries are added to the nagiosql database as Not Applied configs, every call creates an entry.
Be sure to check out our Knowledgebase for helpful articles and solutions!