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!
import service configuration file
-
jdalrymple
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: import service configuration file
It sounds more like your disk is full...
As for restarting Nagios - the best place to do that is from within the XI UI itself.
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% /bootRe: import service configuration file
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
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
setuid/setgid should not prevent root from modifying files there:
Maybe time for an fsck?
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 randomfileRe: import service configuration file
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!
[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
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.
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.
Re: import service configuration file
Good point! Yes, I deleted the duplicate services using CCM. Thank you!
Re: import service configuration file
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!
Re: import service configuration file
Yes, this problem was resolved. Thanks!