<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://wiki.ixheim.de/index.php?action=history&amp;feed=atom&amp;title=Nagios_misc</id>
	<title>Nagios misc - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ixheim.de/index.php?action=history&amp;feed=atom&amp;title=Nagios_misc"/>
	<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=Nagios_misc&amp;action=history"/>
	<updated>2026-06-29T12:02:21Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Xinux Wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.ixheim.de/index.php?title=Nagios_misc&amp;diff=5864&amp;oldid=prev</id>
		<title>Thomas: Die Seite wurde neu angelegt: „== Nagios == === Aktivieren von External Commands ===  Nagios 3 is not configured to look for external commands in the  default configuration as a security featur…“</title>
		<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=Nagios_misc&amp;diff=5864&amp;oldid=prev"/>
		<updated>2014-11-20T21:43:21Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „== Nagios == === Aktivieren von External Commands ===  Nagios 3 is not configured to look for external commands in the  default configuration as a security featur…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Nagios ==&lt;br /&gt;
=== Aktivieren von External Commands ===&lt;br /&gt;
 Nagios 3 is not configured to look for external commands in the&lt;br /&gt;
 default configuration as a security feature. To enable external&lt;br /&gt;
 commands, you need to allow the web server write access to the&lt;br /&gt;
 nagios command pipe.  the simplest way of doing this is to&lt;br /&gt;
 set check_external_commands=1 in your nagios configuration,&lt;br /&gt;
 and then change the permissions in a way which will be maintained&lt;br /&gt;
 across package upgrades (otherwise dpkg will overwrite your&lt;br /&gt;
 permission changes).  The following is the recommended approach:&lt;br /&gt;
 &lt;br /&gt;
 - activate external command checks in the nagios configuration. this&lt;br /&gt;
   can be done by setting check_external_commands=1 in the file&lt;br /&gt;
   /etc/nagios3/nagios.cfg.&lt;br /&gt;
 &lt;br /&gt;
 sed -i &amp;quot;s/check_external_commands=0/check_external_commands=1/&amp;quot; /etc/nagios3/nagios.cfg&lt;br /&gt;
 &lt;br /&gt;
 - perform the following commands to change directory permissions and&lt;br /&gt;
   to make the changes permanent:&lt;br /&gt;
 &lt;br /&gt;
 /etc/init.d/nagios3 stop&lt;br /&gt;
 dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw&lt;br /&gt;
 dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3&lt;br /&gt;
 /etc/init.d/nagios3 start&lt;br /&gt;
 &lt;br /&gt;
 This is done by intention and will not fixed. See also #538828 for more informations. &lt;br /&gt;
&lt;br /&gt;
=== Mails Benachichtigungen Limitieren ===&lt;br /&gt;
 If you want to receive only 1 mail, it's easy. Set the&lt;br /&gt;
 notification_interval to 0. But if you want 2, I guess you might achieve&lt;br /&gt;
 this using escalation and setting notification_interval to 0.&lt;br /&gt;
 Defining escalation with first_notification 2, and last_notification 2,&lt;br /&gt;
 it should work.&lt;br /&gt;
 &lt;br /&gt;
 I must admit I haven't tried it though.&lt;br /&gt;
&lt;br /&gt;
== Nagios Grapher ==&lt;br /&gt;
== Nagios Troubleshoot ==&lt;br /&gt;
=== External Command Error===&lt;br /&gt;
&lt;br /&gt;
ERROR:&lt;br /&gt;
&lt;br /&gt;
Error: Could not stat() command file '/var/lib/nagios3/rw/nagios.cmd'!&lt;br /&gt;
&lt;br /&gt;
Lösung:&lt;br /&gt;
&lt;br /&gt;
 chmod g+x /var/lib/nagios3/rw&lt;br /&gt;
&lt;br /&gt;
vi /etc/nagios3/nagios.cfg&lt;br /&gt;
&lt;br /&gt;
 check_external_commands=1&lt;br /&gt;
&lt;br /&gt;
vi /etc/group&lt;br /&gt;
&lt;br /&gt;
 nagios:x:118:www-data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Quell:&lt;br /&gt;
&lt;br /&gt;
I have run into this problem the last three times I have set up Nagios, and every time I fix it, I forget to document the process. So here's the documentation. The first few points are covered in the official Nagios documentation that comes with your package. The later points are not, and have more to do with OS configuration.&lt;br /&gt;
&lt;br /&gt;
My configuration:&lt;br /&gt;
&lt;br /&gt;
    Debian 5.3&lt;br /&gt;
    Nagios 3&lt;br /&gt;
&lt;br /&gt;
Configure nagios.cfg&lt;br /&gt;
&lt;br /&gt;
Make sure you have something like this in /etc/nagios3/nagios.cfg:&lt;br /&gt;
&lt;br /&gt;
# EXTERNAL COMMAND OPTION&lt;br /&gt;
# Values: 0 = disable commands, 1 = enable commands&lt;br /&gt;
 &lt;br /&gt;
check_external_commands=1&lt;br /&gt;
 &lt;br /&gt;
# EXTERNAL COMMAND CHECK INTERVAL&lt;br /&gt;
# NOTE: Setting this value to -1 causes Nagios to check the external&lt;br /&gt;
# command file as often as possible.&lt;br /&gt;
 &lt;br /&gt;
command_check_interval=15s&lt;br /&gt;
#command_check_interval=-1&lt;br /&gt;
 &lt;br /&gt;
# EXTERNAL COMMAND FILE&lt;br /&gt;
command_file=/var/lib/nagios3/rw/nagios.cmd&lt;br /&gt;
&lt;br /&gt;
You will need to restart Nagios for these settings to be loaded.&lt;br /&gt;
Configure cgi.cfg&lt;br /&gt;
&lt;br /&gt;
Next, edit the /etc/nagios3/cgi.cfg file and check the following:&lt;br /&gt;
&lt;br /&gt;
# SYSTEM/PROCESS COMMAND ACCESS&lt;br /&gt;
authorized_for_system_commands=nagiosadmin&lt;br /&gt;
 &lt;br /&gt;
# ... Other stuff cut&lt;br /&gt;
 &lt;br /&gt;
# GLOBAL HOST/SERVICE COMMAND ACCESS&lt;br /&gt;
authorized_for_all_service_commands=nagiosadmin&lt;br /&gt;
authorized_for_all_host_commands=nagiosadmin&lt;br /&gt;
&lt;br /&gt;
This enables the user nagiosadmin to submit commands. You can check out the in-file documentation for setting up multiple users.&lt;br /&gt;
&lt;br /&gt;
Restart Apache2 after you have done this.&lt;br /&gt;
Add www-data to the Nagios Group&lt;br /&gt;
&lt;br /&gt;
Next, make sure that the user www-data is in the group nagios. You can check on this in /etc/group.&lt;br /&gt;
Set the Permissions&lt;br /&gt;
&lt;br /&gt;
This last item is the tricky one. You need to set the correct permissions for the command pipe file (this is the file set in nagios.cfg). Nagios uses this pipe to pass data from the CGI to the backend daemon.&lt;br /&gt;
&lt;br /&gt;
This file is located in /var/lib/nagios3/rw/nagios.cmd.&lt;br /&gt;
&lt;br /&gt;
By default, it should have the following permissions:&lt;br /&gt;
&lt;br /&gt;
# ls -l /var/lib/nagios3/rw/nagios.cmd &lt;br /&gt;
prw-rw---- 1 nagios nagios 0 2010-01-13 10:17 /var/lib/nagios3/rw/nagios.cmd&lt;br /&gt;
&lt;br /&gt;
Notice that the group ownership is nagios. That's why you added www-data to the nagios group above.&lt;br /&gt;
&lt;br /&gt;
But even with these permissions, you may (will?) still get an error. The reason for this is that the parent directory, rw, does not allow any user but nagios to access its contents:&lt;br /&gt;
&lt;br /&gt;
# ls -lh /var/lib/nagios3&lt;br /&gt;
total 92K&lt;br /&gt;
-rw-r--r-- 1 nagios nagios    33K 2010-01-04 17:06 objects.precache&lt;br /&gt;
-rw------- 1 nagios www-data  48K 2010-01-13 10:17 retention.dat&lt;br /&gt;
drwx------ 2 nagios www-data 4.0K 2010-01-13 10:17 rw&lt;br /&gt;
drwxr-x--- 3 nagios nagios   4.0K 2010-01-04 16:00 spool&lt;br /&gt;
&lt;br /&gt;
All you need to do to fix this is add the execute bit (x) to the rw directory:&lt;br /&gt;
&lt;br /&gt;
# chmod g+x /var/lib/nagios3/rw&lt;br /&gt;
&lt;br /&gt;
Now any member of the nagios group (including www-data) should be able to access the contents of the rw directory.&lt;br /&gt;
&lt;br /&gt;
At this point, you should be able to execute Nagios Service Commands through the web interface. (If not, try doing a stop/start of nagios and try again).&lt;br /&gt;
&lt;br /&gt;
===Command not defined ===&lt;br /&gt;
'''Problem:'''&lt;br /&gt;
You monitor a remote server with Nagios or Icinga and see the following errors in your Nagios/Icinga web interface:&lt;br /&gt;
&lt;br /&gt;
NRPE: Command 'check_all_disks' not defined&lt;br /&gt;
NRPE: Command 'check_mysql_cmdlinecred' not defined&lt;br /&gt;
NRPE: Command 'check_procs' not defined&lt;br /&gt;
&lt;br /&gt;
'''Lösung:'''&lt;br /&gt;
&lt;br /&gt;
 vi /etc/nagios/nrpe.cfg&lt;br /&gt;
&lt;br /&gt;
... and add command definitions for each service check that gives and error (e.g. check_procs):&lt;br /&gt;
&lt;br /&gt;
 [...]&lt;br /&gt;
 command[check_procs]=/usr/lib/nagios/plugins/check_procs -w 250 -c 400&lt;br /&gt;
 command[check_all_disks]=/usr/lib/nagios/plugins/check_disk -w '20%' -c '10%' -e&lt;br /&gt;
 command[check_mysql_cmdlinecred]=/usr/lib/nagios/plugins/check_mysql -H localhost -u 'nagios' -p 'howtoforge'&lt;br /&gt;
 [...]&lt;br /&gt;
&lt;br /&gt;
Save the file and restart the NRPE server:&lt;br /&gt;
&lt;br /&gt;
 /etc/init.d/nagios-nrpe-server restart&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* http://nagios.manubulon.com/traduction/docs14en/templatetricks.html&lt;br /&gt;
* http://www.nagios-wiki.de/nagios/howtos/nagiosgrapher&lt;br /&gt;
* http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=571801&lt;br /&gt;
* http://osdir.com/ml/network.nagios.plugins/2008-05/msg00070.html&lt;/div&gt;</summary>
		<author><name>Thomas</name></author>
	</entry>
</feed>