Hi All,
We are holding latest nagios XI 5.8.0 version on Test and Prod NagiosXI servers.
We have received some requirement which can accomplish using SQL query. So, in order to implement on prod servers I have created SQL script on one of our NagiosXI test server and it is working as expected. However, when I ran the same query on one of the prod NAgios XI server I have observed that only one record was displaying and that too it was of localhost. Then I tried running it on another prod server and I have observed MySql service is not running.
Now interesting thing on GUI of both prod servers I can observe all the data is present and also in reports correct data is getting reflected. But in terminal when I check the tables it shows only local host data on one of the prod server. As on another server mysql service is not running so didn't had a look.
Below are the tables in which I'm looking for values.
nagios_services,nagios_servicestatus,nagios_hosts, nagios_hostgroup_members, nagios_hostgroups
Below are the points I'm looking for
1. How can i see data under the requested tables.
2. If we are starting the mysql service will it going to effect any performance.
3. If it start displaying the data in the tables does it going to effect any performance.
As I'm observing this problem in Prod env due to which I need to ensure will it effect any problem or not. Because on Test env it is working as expected and no changes required.
Only localhost data present under nagios_* tables
-
- Posts: 89
- Joined: Fri May 08, 2020 11:47 am
Re: Only localhost data present under nagios_* tables
The table in the nagios database nagios_hosts only gets hosts inserted into it if the configuration has been applied. If the configuration isn't applied, Nagios won't put anything in that table. Likewise, if the management engine isn't running it also won't put anything in the table.
If you want to interrogate the database for both applied and unapplied configuration objects, you'll want to connect to the nagiosxi database instead.
Note about API
Querying the database directly may not be the route you want to go, anyway. The database schema isn't guaranteed to be stable, and may change when a new version of Nagios XI comes out. While you can write a script to connect directly to the database and interrogate the database tables, it's not recommended. What is recommended is using the Nagios API that comes with Nagios XI to interrogate objects. It'll even give you a nicer output so you don't have to figure out how to do join tables and format data, etc. Help for the API is in Nagios XI under Help (top menu) -> Objects reference.
If you want to interrogate the database for both applied and unapplied configuration objects, you'll want to connect to the nagiosxi database instead.
If a host doesn't have MySQL installed, there's no way that it has a Nagios XI database running on it. For that reason, I'm not sure you were logged into the Nagios XI server when you tried that command.Amit_Alone wrote:As on another server mysql service is not running so didn't had a look.
This makes me think you're using an offloaded database. If you PM me a System Profile, I can diagnose further.Amit_Alone wrote:Now interesting thing on GUI of both prod servers I can observe all the data is present and also in reports correct data is getting reflected. But in terminal when I check the tables it shows only local host data on one of the prod server.
Note about API
Querying the database directly may not be the route you want to go, anyway. The database schema isn't guaranteed to be stable, and may change when a new version of Nagios XI comes out. While you can write a script to connect directly to the database and interrogate the database tables, it's not recommended. What is recommended is using the Nagios API that comes with Nagios XI to interrogate objects. It'll even give you a nicer output so you don't have to figure out how to do join tables and format data, etc. Help for the API is in Nagios XI under Help (top menu) -> Objects reference.
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.
Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
-
- Posts: 89
- Joined: Fri May 08, 2020 11:47 am
Re: Only localhost data present under nagios_* tables
Thanks @dchurch for a hint after taking a deep dive, I have observed Offloaded DB server is configured. Because of that on Nagios server none of the DB records were present.
It has resolved my problem and getting records as expected.
If any one observing same problem please check below path on NagiosXI server were you can find the offloaded DB details.
It has resolved my problem and getting records as expected.
If any one observing same problem please check below path on NagiosXI server were you can find the offloaded DB details.
Code: Select all
vi /usr/local/nagios/etc/ndo.cfg