Page 1 of 4
databases
Posted: Thu May 11, 2017 12:47 pm
by hsauerbach
can someone give me a detailed explanation of the three nagios databases (nagios, nagiosql and nagiosxi).
Re: databases
Posted: Thu May 11, 2017 1:23 pm
by dwhitfield
What are you trying to do? We generally try to steer people clear of modifying the databases directly.
nagiosql is what the CCM uses.
nagiosxi is where settings are stored. Depending on your version, this could be in postgres rather than MySQL/MariaDB.
nagios is used for display.
https://assets.nagios.com/downloads/nag ... _Model.pdf will likely be of use. You'll see a lot of similarity between what you see there and what you see in the nagios database.
Re: databases
Posted: Fri May 12, 2017 8:48 am
by hsauerbach
with the security we have on our servers the apply configuration doesn't work so we have been doing manual reconfigure using nagiosxi/scripts. It now seens like we have a mix of both console and manual configurations and this stop work. We are trying to stop notification for now I modified the services file and ran reconfigure. from the console I could not disable notification. It said it worked but no change. I modified noitification_enabled to "0" in the nagios database service table but now I want to apply the fix to the nagiosql tbl_service and don't know what it show be since it is a "2" right now. Any help I can get to fix my problem would be helpful. Also al lot of my plugins that worked at first do not work now.
Re: databases
Posted: Fri May 12, 2017 9:28 am
by dwhitfield
Modified sudoers and SELinux are known to cause issues with XI. Is one of those what you are trying to do? If not, what is the security measure? It's possible we'll be able to help.
As for the notifications, do you have any modified event handlers? If so, you may be looking in the wrong place.
It probably makes sense to start a new thread for the plugins not working. It's likely related, but would still be best to break that out.
Re: databases
Posted: Fri May 12, 2017 9:34 am
by mcapra
I would double check your cron jobs to make sure out back-end scripts are doing the things they are supposed to be doing:
Code: Select all
[root@xi-stable ~]# ps aux | grep php
nagios 2018 0.0 0.0 113120 1200 ? Ss 09:33 0:00 /bin/sh -c /usr/bin/php -q /usr/local/nagiosxi/cron/perfdataproc.php > /usr/local/nagiosxi/var/perfdataproc.log 2>&1
nagios 2019 0.0 0.0 113120 1208 ? Ss 09:33 0:00 /bin/sh -c /usr/bin/php -q /usr/local/nagiosxi/cron/event_handler.php > /usr/local/nagiosxi/var/event_handler.log 2>&1
nagios 2022 0.8 0.5 434324 23260 ? S 09:33 0:00 /usr/bin/php -q /usr/local/nagiosxi/cron/perfdataproc.php
nagios 2023 0.0 0.0 113120 1212 ? Ss 09:33 0:00 /bin/sh -c /usr/bin/php -q /usr/local/nagiosxi/cron/cmdsubsys.php > /usr/local/nagiosxi/var/cmdsubsys.log 2>&1
nagios 2026 0.6 0.5 434328 23104 ? S 09:33 0:00 /usr/bin/php -q /usr/local/nagiosxi/cron/cmdsubsys.php
nagios 2027 0.6 0.5 434184 22916 ? S 09:33 0:00 /usr/bin/php -q /usr/local/nagiosxi/cron/event_handler.php
nagios 2029 0.0 0.0 113120 1208 ? Ss 09:33 0:00 /bin/sh -c /usr/bin/php -q /usr/local/nagiosxi/cron/sysstat.php > /usr/local/nagiosxi/var/sysstat.log 2>&1
nagios 2034 0.0 0.0 113120 1208 ? Ss 09:33 0:00 /bin/sh -c /usr/bin/php -q /usr/local/nagiosxi/cron/eventman.php > /usr/local/nagiosxi/var/eventman.log 2>&1
nagios 2036 0.0 0.0 113120 1208 ? Ss 09:33 0:00 /bin/sh -c /usr/bin/php -q /usr/local/nagiosxi/cron/feedproc.php > /usr/local/nagiosxi/var/feedproc.log 2>&1
nagios 2039 0.8 0.6 434368 23736 ? S 09:33 0:00 /usr/bin/php -q /usr/local/nagiosxi/cron/sysstat.php
nagios 2041 0.6 0.5 434184 22992 ? S 09:33 0:00 /usr/bin/php -q /usr/local/nagiosxi/cron/feedproc.php
nagios 2042 1.1 0.7 440992 29828 ? S 09:33 0:00 /usr/bin/php -q /usr/local/nagiosxi/cron/eventman.php
Those various processes do a lot of things behind the scenes. One of which is handling parts of the "Apply Configuration" jobs. Here's the cron jobs that come with Nagios XI by default:
Code: Select all
[root@xi-stable ~]# cat /etc/cron.d/nagiosxi
# /etc/cron.d/nagiosxi: crontab fragment for nagiosxi
# Backup MySQL & PostgreSQL Databases
0 7 * * * root /root/scripts/automysqlbackup
0 7 * * * root /root/scripts/autopostgresqlbackup > /dev/null 2>&1
* * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/sysstat.php > /usr/local/nagiosxi/var/sysstat.log 2>&1
* * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/cmdsubsys.php > /usr/local/nagiosxi/var/cmdsubsys.log 2>&1
* * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/eventman.php > /usr/local/nagiosxi/var/eventman.log 2>&1
* * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/event_handler.php > /usr/local/nagiosxi/var/event_handler.log 2>&1
* * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/feedproc.php > /usr/local/nagiosxi/var/feedproc.log 2>&1
* * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/perfdataproc.php > /usr/local/nagiosxi/var/perfdataproc.log 2>&1
* * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/nom.php > /usr/local/nagiosxi/var/nom.log 2>&1
* * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/reportengine.php > /usr/local/nagiosxi/var/reportengine.log 2>&1
*/5 * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/dbmaint.php > /usr/local/nagiosxi/var/dbmaint.log 2>&1
* * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/cleaner.php > /usr/local/nagiosxi/var/cleaner.log 2>&1
01 * * * * nagios /usr/local/nagiosxi/cron/recurringdowntime.pl > /usr/local/nagiosxi/var/recurringdowntime.log 2>&1
* * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/deadpool.php > /usr/local/nagiosxi/var/deadpool.log 2>&1
Re: databases
Posted: Fri May 12, 2017 10:24 am
by hsauerbach
Here is my process list for the nagios scripts:
[root@nsc-cld-dma-001 mail]# ps -ef |grep php
nagios 1573 1566 0 11:18 ? 00:00:00 /bin/sh -c /usr/bin/php -q /usr/local/nagiosxi/cron/cmdsubsys.php > /usr/local/nagiosxi/var/cmdsubsys.log 2>&1
nagios 1580 1573 0 11:18 ? 00:00:00 /usr/bin/php -q /usr/local/nagiosxi/cron/cmdsubsys.php
nagios 1918 1910 0 11:19 ? 00:00:00 /bin/sh -c /usr/bin/php -q /usr/local/nagiosxi/cron/cmdsubsys.php > /usr/local/nagiosxi/var/cmdsubsys.log 2>&1
nagios 1919 1907 0 11:19 ? 00:00:00 /bin/sh -c /usr/bin/php -q /usr/local/nagiosxi/cron/feedproc.php > /usr/local/nagiosxi/var/feedproc.log 2>&1
nagios 1920 1911 0 11:19 ? 00:00:00 /bin/sh -c /usr/bin/php -q /usr/local/nagiosxi/cron/sysstat.php > /usr/local/nagiosxi/var/sysstat.log 2>&1
nagios 1921 1906 0 11:19 ? 00:00:00 /bin/sh -c /usr/bin/php -q /usr/local/nagiosxi/cron/perfdataproc.php > /usr/local/nagiosxi/var/perfdataproc.log 2>&1
nagios 1922 1908 0 11:19 ? 00:00:00 /bin/sh -c /usr/bin/php -q /usr/local/nagiosxi/cron/event_handler.php > /usr/local/nagiosxi/var/event_handler.log 2>&1
nagios 1923 1909 0 11:19 ? 00:00:00 /bin/sh -c /usr/bin/php -q /usr/local/nagiosxi/cron/eventman.php > /usr/local/nagiosxi/var/eventman.log 2>&1
nagios 1924 1923 1 11:19 ? 00:00:00 /usr/bin/php -q /usr/local/nagiosxi/cron/eventman.php
nagios 1925 1918 0 11:19 ? 00:00:00 /usr/bin/php -q /usr/local/nagiosxi/cron/cmdsubsys.php
nagios 1926 1920 0 11:19 ? 00:00:00 /usr/bin/php -q /usr/local/nagiosxi/cron/sysstat.php
nagios 1927 1919 0 11:19 ? 00:00:00 /usr/bin/php -q /usr/local/nagiosxi/cron/feedproc.php
nagios 1928 1922 0 11:19 ? 00:00:00 /usr/bin/php -q /usr/local/nagiosxi/cron/event_handler.php
nagios 1929 1921 0 11:19 ? 00:00:00 /usr/bin/php -q /usr/local/nagiosxi/cron/perfdataproc.php
root 2055 25437 0 11:19 pts/0 00:00:00 grep --color=auto php
Not running:
nagios /usr/local/nagiosxi/cron/recurringdowntime.pl > /usr/local/nagiosxi/var/recurringdowntime.log 2>&1
/root/scripts/automysqlbackup
/root/scripts/autopostgresqlbackup > /dev/null 2>&1
Re: databases
Posted: Fri May 12, 2017 12:19 pm
by dwhitfield
Are you using SELinux or a modified sudoers?
If you PM me a profile, we'll be able to take a look at what errors you are getting and better picture of what is going on. You can download it by going to Admin > System Config > System Profile and click the ***Download Profile*** button towards the top. If for whatever reason you *cannot* download the profile, please put the output of View System Info (5.3.4+, Show Profile if older) in the thread (that will at least get us some info). This will give us access to many of the logs we would otherwise ask for individually. If security is a concern, you can unzip the profile take out what you like, and then zip it up again. We may end up needing something you remove, but we can ask for that specifically.
After you PM the profile, please update this thread. Updating this thread is the only way for it to show back up on our dashboard.
UPDATE: Profile received and shared with techs
Re: databases
Posted: Fri May 12, 2017 1:08 pm
by hsauerbach
sent the profile.zip file.
Thanks for your help
Re: databases
Posted: Fri May 12, 2017 1:41 pm
by dwhitfield
First, in your /etc/cron.d/etc, you have the line * * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/cmdsubsys.php > /usr/local/nagiosxi/var/cmdsubsys.log 2>&1.
Change that to * * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/cmdsubsys.php >> /usr/local/nagiosxi/var/cmdsubsys.log 2>&1
Second, your ndoutils user does not have access to the database. If you changed that username, you'll need to also change it on line 54 of your config.inc.php
Once you've resolved the ndoutils issue, please attach your /usr/local/nagiosxi/var/cmdsubsys.log and then change your cron back to the way it was. If you upgrade to 5.4.4 there is a logrotate setting to have a more useful cmdsubsys.log, but considering your modifications, I'm not sure an upgrade to 5.4.4 is going to be a pleasant experience.
Re: databases
Posted: Fri May 12, 2017 2:14 pm
by hsauerbach
fixed ndoutils database login password is nagios. Cron.d nagiosxi back to normal