Hello,
Is there some way to search in Nagios XI for the values of the free variables definitions? For example if I set a free variable serial number, is there someway to search In Nagios XI with that serial number?
Grtz
Searching for 'Free variables'
Searching for 'Free variables'
Nagios XI 5.8.1
https://outsideit.net
https://outsideit.net
Re: Searching for 'Free variables'
What is the use case?
You could try to search for those using a backend (xml or json). That would get you the hostname that you could then use to navigate to the desired host.
You could try to search for those using a backend (xml or json). That would get you the hostname that you could then use to navigate to the desired host.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Searching for 'Free variables'
Hmm the use case would be to store some extra info in Nagios XI. It was just an idea, but it depends of how easy it would be to search or see that extra info. I could make a quick action linking to a pretty-json url page, like this http://warfares.github.io/pretty-json/
So if you know what host it's relatively easy to get the data, but I'm not sure how I could search for the (example) serial number with json (or xml) without knowing from which host the serial is.. Or I would have to query all hosts seperately and then look at the values.. what doesn't seem really performant.
EDIT: Some really vague idea, would it be possible to somehow extract all the object data with some job / script to json format, let's say once a day and search in this info with NLS?
So if you know what host it's relatively easy to get the data, but I'm not sure how I could search for the (example) serial number with json (or xml) without knowing from which host the serial is.. Or I would have to query all hosts seperately and then look at the values.. what doesn't seem really performant.
EDIT: Some really vague idea, would it be possible to somehow extract all the object data with some job / script to json format, let's say once a day and search in this info with NLS?
Nagios XI 5.8.1
https://outsideit.net
https://outsideit.net
Re: Searching for 'Free variables'
Well, you can query the core json api for a json encoded full list of objects (including custom variables):
Does this help?
Code: Select all
http://<ip>/nagios/cgi-bin/objectjson.cgi?query=hostlist&details=trueFormer Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Searching for 'Free variables'
This helps indeed! And it's superfast too.
Really thanks Andy. I've used your JSON query generator a lot lately. Finding data in Nagios XI has been made super easy with this tool. If only it was as easy to write data back to Nagios XI. It's possible of course by editing the config files and running the import script, but rather cumbersome imho. Or does there happen to be a magic tool that converts Nagios config files to json and back? 
Nagios XI 5.8.1
https://outsideit.net
https://outsideit.net
Re: Searching for 'Free variables'
Nope, not yet. Maybe someday? Or maybe never?
The limitation here is NagiosQL (the ccm) as any changes to the configs need to be inserted/updated in the nagiosql database. Due to the highly relational nature of this db, the import procedure is the only safe way to update them. Direct queries can be *very* dangerous unless you fully understand the nagiosql relational structure.
This really is the only option if you need to change non-runtime state options. For runtime-state stuff (enable/disable notifications/perfdata/checks/etc) you can just submit to the command pipe or the cmd.cgi.WillemDH wrote:It's possible of course by editing the config files and running the import script, but rather cumbersome imho
The limitation here is NagiosQL (the ccm) as any changes to the configs need to be inserted/updated in the nagiosql database. Due to the highly relational nature of this db, the import procedure is the only safe way to update them. Direct queries can be *very* dangerous unless you fully understand the nagiosql relational structure.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Searching for 'Free variables'
Ok, thanks for confirming. You can close the thread Andy.
Nagios XI 5.8.1
https://outsideit.net
https://outsideit.net