import service configuration file

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
xlin125
Posts: 172
Joined: Mon Jan 19, 2015 6:01 pm

import service configuration file

Post by xlin125 »

For some reason, a host running Nagios NRPE has duplicate definition found for service "Yum Updates", "Users" and "Load" in the configuration file "/usr/local/nagios/etc/services/<host_IP>.cfg". I copied this cfg file to /tmp and removed the duplicate definition for these three services. I planned to copy this updated cfg file to /usr/local/nagios/etc/import directory, and import this cfg file via Nagios CCM->Tools->Import Config Files on the Nagios XI web interface, as instructed. I logged in as root on the Nagios XI server, however, I can not copy this updated cfg file to /usr/local/nagios/etc/import directory because this "import" is a setuid setgid directory:

[root]# cp /tmp/135.25.75.56.cfg /usr/local/nagios/etc/import/.
cp: cannot create regular file `import/./135.25.75.56.cfg': No space left on device

How can I place this update cfg file to import directory and import it? Are there other ways to fix this problem?

Another question: should we start /stop nagios on the Nagios XI as "root" or "nagios"? We were getting the following error when starting nagios:
-----------
Checking misc settings...
Error: Unable to write to check_result_path ('/usr/local/nagios/var/spool/checkresults') - No space left on device

Total Warnings: 0
Total Errors: 1
-----------
'/usr/local/nagios/var/spool/checkresults' is a setuid setgid directory as well.

Thanks!
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: import service configuration file

Post by jdalrymple »

It sounds more like your disk is full...

Code: Select all

[jdalrymple@localhost ~]$ df
Filesystem                        1K-blocks    Used Available Use% Mounted on
/dev/mapper/centos-lv_root  18134344 2975880  14237276  18% /
tmpfs                                502204       0    502204   0% /dev/shm
/dev/sda1                            495844   32659    437585   7% /boot
As for restarting Nagios - the best place to do that is from within the XI UI itself.
xlin125
Posts: 172
Joined: Mon Jan 19, 2015 6:01 pm

Re: import service configuration file

Post by xlin125 »

Thanks for the reponse.

The error message seems a misleading because the disk is not full:
[root]# pwd
/usr/local/nagios/etc
[root]# df -k .
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda5 10079084 3346068 6221016 35% /
[root@mtwdb01 etc]# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda5 10079084 3346068 6221016 35% /
tmpfs 960356 0 960356 0% /dev/shm
/dev/sda1 198337 35056 153041 19% /boot
/dev/sda7 30654476 12876860 16220420 45% /home
/dev/sda3 12095032 161204 11319428 2% /opt
/dev/sda2 15118728 1029980 13320748 8% /var
none 960356 28 960328 1% /tmp
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: import service configuration file

Post by jdalrymple »

setuid/setgid should not prevent root from modifying files there:

Code: Select all

[jdalrymple@localhost ~]$ touch randomfile
[jdalrymple@localhost ~]$ cp randomfile /usr/local/nagios/etc/import/
cp: cannot create regular file `/usr/local/nagios/etc/import/randomfile': Permission denied
[jdalrymple@localhost ~]$ sudo cp randomfile /usr/local/nagios/etc/import/
[sudo] password for jdalrymple:
[jdalrymple@localhost ~]$ ls -l /usr/local/nagios/etc/import/
total 0
-rw-r--r-- 1 root nagios 0 Apr  7 13:06 randomfile
Maybe time for an fsck?
xlin125
Posts: 172
Joined: Mon Jan 19, 2015 6:01 pm

Re: import service configuration file

Post by xlin125 »

I just found out that there are no more i-nodes on the file system.

[root]# pwd
/usr/local/nagios/etc
[root]# df -i .
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda5 640848 640848 0 100% /

So it is short of i-nodes on the file system. I need to cleanup some files on the file systems.

What is the preferable way to update the /usr/local/nagios/etc/services/<host-ip>.cfg file on the Nagios XI since it has duplicate definition for a few services? I mentioned what I planned to do in this post, which is that placing the updated cfg file in the /usr/local/nagios/etc/import directory. And then on Nagios XI web GUI, CCM->Tools->Import Config Files, select the cfg file needed to update, and click on "Import". I expect the cfg file in the import directory will be imported to replace the one having the same name in the services directory. Any comments or suggestions on this? Maybe there are other ways to do it.

Thanks!
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: import service configuration file

Post by jdalrymple »

The best way would be to simply delete the duplicate services out using CCM. Is there a reason you can't do that?

Using the import feature is less likely to lay the services into the database as cleanly as creating using CCM. It works - it's just not ideal.
xlin125
Posts: 172
Joined: Mon Jan 19, 2015 6:01 pm

Re: import service configuration file

Post by xlin125 »

Good point! Yes, I deleted the duplicate services using CCM. Thank you!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: import service configuration file

Post by lmiltchev »

xlin125, is it OK to mark this topic as "resolved" and lock it?
Be sure to check out our Knowledgebase for helpful articles and solutions!
xlin125
Posts: 172
Joined: Mon Jan 19, 2015 6:01 pm

Re: import service configuration file

Post by xlin125 »

Yes, this problem was resolved. Thanks!
Locked