retrieve field populated in several template

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
mon-team
Posts: 171
Joined: Thu Jun 28, 2012 9:22 am

retrieve field populated in several template

Post 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
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: retrieve field populated in several template

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
mon-team
Posts: 171
Joined: Thu Jun 28, 2012 9:22 am

Re: retrieve field populated in several template

Post by mon-team »

Thanks,
you solved my problem! The information can be retrieved much easier in this way.
Regards,
Francesco
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: retrieve field populated in several template

Post by tgriep »

Your welcome.
Is it alright to mark this post as solved and lock it up?
Be sure to check out our Knowledgebase for helpful articles and solutions!
mon-team
Posts: 171
Joined: Thu Jun 28, 2012 9:22 am

Re: retrieve field populated in several template

Post by mon-team »

Yes, of course!
Regards,
Francesco
Locked