Nagios 3.0.2 with ndoutils 1.4b7 problems writing to mysql

Hello
I’ve got a Nagios 3.0.2 up and running on Ubuntu 8.0.4 Server. It got about 100 hosts and everything works on nagios part.
When I installed ndoutils I followed the install [http://nagios.sourceforge.net/docs/ndoutils/NDOUtils.pdf](hyperlink url)
Everything works until the ndo is going to write to mysql, the /var/log/messages says;

Oct 16 13:39:40 ubuntu-Nagios nagios: ndomod: NDOMOD 1.4b7 (10-31-2007) Copyright (c) 2005-2007 Ethan Galstad ([email protected]) Oct 16 13:39:40 ubuntu-Nagios ndo2db-3x: Successfully connected to MySQL database Oct 16 13:39:40 ubuntu-Nagios nagios: ndomod: Successfully connected to data sink. 0 queued items to flush. Oct 16 13:39:40 ubuntu-Nagios nagios: Event broker module '/usr/local/nagios/bin/ndomod-3x.o' initialized successfully. Oct 16 13:39:40 ubuntu-Nagios nagios: Finished daemonizing... (New PID=17169) Oct 16 13:39:40 ubuntu-Nagios ndo2db-3x: Error: mysql_query() failed for 'INSERT INTO nagios_configfilevariables SET instance_id='1', configfile_id='8', varname='cfg_file', varvalue='/usr/local/nagios/etc/objects/contacts\.cfg'' Oct 16 13:39:40 ubuntu-Nagios ndo2db-3x: Error: mysql_query() failed for 'INSERT INTO nagios_configfilevariables SET instance_id='1', configfile_id='8', varname='cfg_file', varvalue='/usr/local/nagios/etc/objects/timeperiods\.cfg'' Oct 16 13:39:40 ubuntu-Nagios ndo2db-3x: Error: mysql_query() failed for 'INSERT INTO nagios_configfilevariables SET instance_id='1', configfile_id='8', varname='cfg_file', varvalue='/usr/local/nagios/etc/objects/templates\.cfg'' Oct 16 13:39:40 ubuntu-Nagios ndo2db-3x: Error: mysql_query() failed for 'INSERT INTO nagios_configfilevariables SET instance_id='1', configfile_id='8', varname='cfg_file', varvalue='/usr/local/nagios/etc/objects/hosts\.cfg'' Oct 16 13:39:40 ubuntu-Nagios ndo2db-3x: Error: mysql_query() failed for 'INSERT INTO nagios_configfilevariables SET instance_id='1', configfile_id='8', varname='cfg_file', varvalue='/usr/local/nagios/etc/objects/hostgroups\.cfg'' Oct 16 13:39:40 ubuntu-Nagios ndo2db-3x: Error: mysql_query() failed for 'INSERT INTO nagios_configfilevariables SET instance_id='1', configfile_id='8', varname='cfg_file', varvalue='/usr/local/nagios/etc/objects/services\.cfg'' Oct 16 13:39:40 ubuntu-Nagios ndo2db-3x: Error: mysql_query() failed for 'INSERT INTO nagios_configfilevariables SET instance_id='1', configfile_id='8', varname='cfg_file', varvalue='/usr/local/nagios/etc/objects/service_groups\.cfg'' Oct 16 13:39:40 ubuntu-Nagios ndo2db-3x: Error: mysql_query() failed for 'INSERT INTO nagios_configfilevariables SET instance_id='1', configfile_id='8', varname='cfg_file', varvalue='/usr/local/nagios/etc/objects/localhost\.cfg''

When I log into the mysql server and manually add the lines I get this error:

I’m using some config files from an old groundwork installation, Nagios 2.x config files. Is this a problem?

Edit:
ps aux | egrep “nagios|ndo” shows this

nagios 14385 0.0 0.0 4452 356 ? Ss 13:21 0:00 /usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg nagios 17168 0.0 0.1 4584 1352 ? S 13:39 0:00 /usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg nagios 17169 0.1 0.1 11228 1340 ? Rsl 13:39 0:01 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg nagios 20248 0.0 0.0 11232 688 ? S 14:00 0:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
2x on both of them. I’ve tried to manually kill them without any luck. Also tried a reboot on server and nagios several times.

I’ve seen other posts on this subject but not any answers that helps.
I’m hoping someone else have had same problems and can help out

cheers Tommy

Hi

I don’t believe that the failed INSERTs are a “problem” in so many words, I think this a legacy issue from back in the day when Nagios had a single config file. Now in v3 we use multiple files and I believe NDOUtils is trying to set the same single variable multiple times as it goes through nagios.cfg and sees multiple cfg_file entries. Not really a problem unless you want to access the cfg_file details from the database.
A pair of ndo2db processes is normal… one spawns the other…

[root@localhost ~]# ps -ef | egrep "ndo2db|PPID" UID PID PPID C STIME TTY TIME CMD nagios 12579 1 0 Oct15 ? 00:00:00 /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg nagios 13889 12579 1 Oct15 ? 00:38:52 /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
I think the multiple nagios -d processes is due to nagios fork()ing itself (twice) when it does checks, and again, is entirely normal. I often see a lot more than just 2.

So, everything would seem to be fine… is there an actual problem you are experiencing with NDOUtils or is it just concern regarding the above? Are some of the other tables in the DB (nagios_hosts) (nagios_contacts) populating OK?

HTH

/S

Hello and thanks for the reply

The other tables in mysql is populated like
mysql> show columns from nagios_services
-> ;
±----------------------------------±-------------±-----±----±--------±---------------+
| Field | Type | Null | Key | Default | Extra |
±----------------------------------±-------------±-----±----±--------±---------------+
| service_id | int(11) | NO | PRI | NULL | auto_increment |
| instance_id | smallint(6) | NO | MUL | 0 | |
| config_type | smallint(6) | NO | | 0 | |
| host_object_id | int(11) | NO | | 0 | |
| service_object_id | int(11) | NO | | 0 | |
| display_name | varchar(64) | NO | | | |
| check_command_object_id | int(11) | NO | | 0 | |
| check_command_args | varchar(255) | NO | | | |
| eventhandler_command_object_id | int(11) | NO | | 0 | |
| eventhandler_command_args | varchar(255) | NO | | | |
| notification_timeperiod_object_id | int(11) | NO | | 0 | |
| check_timeperiod_object_id | int(11) | NO | | 0 | |
| failure_prediction_options | varchar(64) | NO | | | |
| check_interval | double | NO | | 0 | |
| retry_interval | double | NO | | 0 | |
| max_check_attempts | smallint(6) | NO | | 0 | |
| first_notification_delay | double | NO | | 0 | |
| notification_interval | double | NO | | 0 | |
| notify_on_warning | smallint(6) | NO | | 0 | |
| notify_on_unknown | smallint(6) | NO | | 0 | |
| notify_on_critical | smallint(6) | NO | | 0 | |
etc etc etc

the output for the nagios_configfilevariables; is following:

±----------------------±-------------±-----±----±--------±---------------+
| Field | Type | Null | Key | Default | Extra |
±----------------------±-------------±-----±----±--------±---------------+
| configfilevariable_id | int(11) | NO | PRI | NULL | auto_increment |
| instance_id | smallint(6) | NO | MUL | 0 | |
| configfile_id | int(11) | NO | | 0 | |
| varname | varchar(64) | NO | | | |
| varvalue | varchar(255) | NO | | | |
±----------------------±-------------±-----±----±--------±---------------+
5 rows in set (0.00 sec)

I was just concerned this would be a problem regarding the installation of nagvis. So I wanted to be sure that the ndoutils worked as it should before i start on another installation.
So if this isn’t gonna be a problem for nagvis, I’ll just start the installation of that as soon as I got the time.

Thanks again for the reply
Tommy

Hi

No worries. Nagvis should run over that without any issues.

Cheers

/S