ndoutils | NDOUtils - Database Output for Nagios Core | Plugin library
kandi X-RAY | ndoutils Summary
kandi X-RAY | ndoutils Summary
NDOUtils - Database Output for Nagios Core
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ndoutils
ndoutils Key Features
ndoutils Examples and Code Snippets
Community Discussions
Trending Discussions on ndoutils
QUESTION
I'm working on a rewrite of a popular add-on module (NDOUtils) for an even more popular application (Nagios). This module adds functionality to Nagios by making the objects/statuses/histories of each object available in a database.
The current available version takes the data from Nagios (via some registered callbacks/function pointers) and sends it over a socket where an additional process listens and queues the data up. Finally, an additional process then pops the data from the queue and builds mysql queries for insertion.
Although it works, and has worked for quite some time, we encounter problems on larger systems (15k+ objects defined in Nagios configurations). We decided to start over and re-write the module to handle the database calls directly (via mysql c api prepared statements).
This works beautifully for the status data. One problem we face is that on startup, we need to get the object definitions into the database. Since the definitions can change each time the process starts, we truncate the appropriate tables and recreate each object. This works fine for most systems...
But for large systems, this process can take upwards of several minutes - and this is a blocking process - several minutes is unacceptable, and this is exacerbated on critical monitoring setups.
So, to get this rewrite underway, I kept things simple. To begin with, I looped over each object definition, and built a simple query and then inserted. Once each of that type of object were inserted, I looped back over the objects for all of the objects that are related (for example, each host definition likely has a contact or contactgroup associated with it. Those relationships need to be identified). This was the easiest to read, but extremely slow on a system with 15k hosts and 25k services. Extremely slow as in 3 minutes.
Of course we can do better than that. I rewrote the major functions (hosts and services) to only need to loop over the object list twice each, and instead of sending an individual query per object or relationship, we build a bulk insert query. The code for this looks something like this:
...ANSWER
Answered 2019-Sep-12 at 20:38Your code at first glance does not appear to have any issues that would cause a performance problem like this. With this amount of data I would expect the code to run in a few seconds given normal hardware/OS behavior. I would recommend examining two possible pain points:
- How fast are you generating the data to insert? (Replace the insertion part of the code to a NOOP)
- If you determine in step 1 that the data is being generated quickly enough, the problem is with the write performance of the database.
Regardless, it is very likely that you have to troubleshoot on the database server level - run SHOW PROCESSLIST to start, then SHOW ENGINE INNODB STATUS if you are using InnoDB, and if all else fails, grab stacktrace shots of mysqld process with gdb.
Likely culprit is something horribly wrong with the I/O subsystem of the server or perhaps some form of synchronous replication is enabled, but it is hard to know for sure without some server-level diagnostic.
QUESTION
I would like to know which tables/column allow to link a host with his services in NDOutils?
I need to display a list of some hosts with their own services. I looked but could not find out.
Thank you.
...ANSWER
Answered 2017-Feb-20 at 15:05The tables nagios_hosts
and nagios_services
have a column called host_object_id
. This is your link.
SELECT host_object_id FROM nagios_hosts WHERE display_name = 'localhost'
SELECT display_name FROM nagios_services WHERE host_object_id =
(SELECT host_object_id FROM nagios_hosts WHERE display_name = 'localhost' LIMIT 1)
Hope this helps.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ndoutils
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page