Page 1 of 1

retrieve field populated in several template

Posted: Thu Sep 22, 2016 9:15 am
by mon-team
Hallo,
I've a question about data retrieving on Nagios.
In several services we need to populate the field 'Notes URL': this is done in different ways, it happens to directly write the field inside the service, in some cases we use a Service Template with the field 'Notes URL' populated, or a 'Host Template'. A next complication level is added when a template containing the information is inherited from another template.

I've tried to write a SQL query, to get this information from Mysql 'nagios' database: the query is enormous and it's very hard to retrieve all the possible cases and combination with the various possible template.

Do you know a way to get these information? Maybe Nagios scan via script inside the configuration files bypassing the database option?

Regards
Francesco

Re: retrieve field populated in several template

Posted: Thu Sep 22, 2016 10:55 am
by tgriep
When the Nagios process starts up, it will go through all of the configuration files, resolve the dependencies, templates etc and create a file called objects.cache with all of that resolved.
You can then search through that file for the information you are looking for which would probably be easier that doing the SQL query and determining the links, etc as it is already done in that file.

Re: retrieve field populated in several template

Posted: Fri Sep 23, 2016 3:29 am
by mon-team
Thanks,
you solved my problem! The information can be retrieved much easier in this way.
Regards,
Francesco

Re: retrieve field populated in several template

Posted: Fri Sep 23, 2016 10:03 am
by tgriep
Your welcome.
Is it alright to mark this post as solved and lock it up?

Re: retrieve field populated in several template

Posted: Fri Sep 23, 2016 10:23 am
by mon-team
Yes, of course!
Regards,
Francesco