<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>epicblog &#187; nagios</title> <atom:link href="http://www.rickwargo.com/category/nagios/feed/" rel="self" type="application/rss+xml" /><link>http://www.rickwargo.com</link> <description>Acquiring information, one day at a time.</description> <lastBuildDate>Fri, 14 Oct 2011 01:23:12 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Executing mailq as the nagios user on Fedora 12</title><link>http://www.rickwargo.com/2010/01/13/executing-mailq-as-the-nagios-user-on-fedora-12/</link> <comments>http://www.rickwargo.com/2010/01/13/executing-mailq-as-the-nagios-user-on-fedora-12/#comments</comments> <pubDate>Wed, 13 Jan 2010 16:45:53 +0000</pubDate> <dc:creator>Rick Wargo</dc:creator> <category><![CDATA[nagios]]></category> <category><![CDATA[WILT]]></category> <guid
isPermaLink="false">http://www.rickwargo.com/?p=193</guid> <description><![CDATA[I added a new check command to nagios to check the sendmail mail queue but received an error while executing within nagios: /usr/bin/mailq = can not chdir(/var/spool/mqueue/): Permission denied Program mode requires special privileges, e.g., root or TrustedUser. CRITICAL: Error code 78 returned from /usr/bin/mailq This is because the nagios process (which runs as the [...]]]></description> <content:encoded><![CDATA[<p>I added a new check command to nagios to check the sendmail mail queue but received an error while executing within nagios:</p><blockquote><p>/usr/bin/mailq = can not chdir(/var/spool/mqueue/): Permission denied<br
/> Program mode requires special privileges, e.g., root or TrustedUser.<br
/> CRITICAL: Error code 78 returned from /usr/bin/mailq</p></blockquote><p>This is because the nagios process (which runs as the nagios user) does not have the permissions to look at the spool directory for mail (/var/spool/mqueue) &#8211; the permissions on that directory are 700 and owned by root.</p><p>The fix is to permit nagios to execute this command as root and also to run the /usr/bin/mailq program with sudo in the check_mailq perl script.</p><p><strong>Step 1: Modify check_mailq</strong><br
/> Edit the check_mailq file, after making a backup of the file. Search for the place where the mailq is opened for reading from the pipe and add /usr/bin/sudo prior to the command. The resulting line looks like the following (note: this is does using sendmail as the MTA):</p><p><code>if (! open (MAILQ, "/usr/bin/sudo $utils::PATH_TO_MAILQ | " ) ) {</code></p><p><strong>Step 2: Modify sudoers</strong><br
/> Edit the sudoers file to give nagios permission to execute /usr/bin/mailq as root without requiring a password. I accomplished this by adding the following line to the end of the file:</p><p><code>nagios  ALL= (root)     NOPASSWD: /usr/bin/mailq<br
/> </code></p><p>Test prior to reloading nagios by executing the check_mailq command as nagios:</p><p><code>su nagios -c "./check_mailq -w 5 -c 10"</code></p><p>If you see an error message about a tty, like:</p><blockquote><p>sudo: sorry, you must have a tty to run sudo</p></blockquote><p>or in nagios:</p><blockquote><p>CRITICAL: Error code 1 returned from /usr/bin/mailq</p></blockquote><p>you will need to either comment out the line about requiring the tty (Defaults requiretty), or add a new line not requiring the tty for nagios:</p><p><code>Defaults:nagios  !requiretty<br
/> </code></p> ]]></content:encoded> <wfw:commentRss>http://www.rickwargo.com/2010/01/13/executing-mailq-as-the-nagios-user-on-fedora-12/feed/</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>Nagios and checking samba disks &#8211; check_disk_smb</title><link>http://www.rickwargo.com/2010/01/06/nagios-and-checking-samba-disks-check_disk_smb/</link> <comments>http://www.rickwargo.com/2010/01/06/nagios-and-checking-samba-disks-check_disk_smb/#comments</comments> <pubDate>Wed, 06 Jan 2010 15:31:16 +0000</pubDate> <dc:creator>Rick Wargo</dc:creator> <category><![CDATA[nagios]]></category> <category><![CDATA[WILT]]></category> <guid
isPermaLink="false">http://www.rickwargo.com/?p=175</guid> <description><![CDATA[The following is useful when the linux machine is not correctly joined to a domain: I have noticed a number of PROBLEM alerts from my Nagios 3.2.0 implementation on Fedora 12 when checking the available disk space on a WinXP share such as: Result from smbclient not suitable No Answer from Client This used to [...]]]></description> <content:encoded><![CDATA[<p>The following is useful when the linux machine is not correctly joined to a domain:</p><p>I have noticed a number of PROBLEM alerts from my Nagios 3.2.0 implementation on Fedora 12 when checking the available disk space on a WinXP share such as:</p><ul><li>Result from smbclient not suitable</li><li>No Answer from Client</li></ul><p>This used to work before upgrading both my Nagios and Fedora implementations.</p><p>To get this working once again, I&#8217;ve had to do two things &#8211; allow Nagios to login and specify the domain name as part of the user name on the check_disk_smb command.</p><p>To permit login to nagios, edit the passwd file with sudo vipw and change the shell to /bin/sh for nagios (should have been /sbin/nologin).</p><p>Next, in the private configuration file for Nagios, change the USER variable to be DOMAIN\\\\User; note the four backslashes are necessary. If that USER variable is being used elsewhere where the the new value would alter the results from other Nagios checks, add a new USER variable and update the configuration files accordingly.</p> ]]></content:encoded> <wfw:commentRss>http://www.rickwargo.com/2010/01/06/nagios-and-checking-samba-disks-check_disk_smb/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Cannot update Fedora 8 via yum</title><link>http://www.rickwargo.com/2008/04/23/cannot-update-fedora-8-via-yum/</link> <comments>http://www.rickwargo.com/2008/04/23/cannot-update-fedora-8-via-yum/#comments</comments> <pubDate>Wed, 23 Apr 2008 23:54:23 +0000</pubDate> <dc:creator>Rick Wargo</dc:creator> <category><![CDATA[nagios]]></category> <category><![CDATA[WILT]]></category> <guid
isPermaLink="false">http://www.rickwargo.com/?p=130</guid> <description><![CDATA[I&#8217;ve been having difficulties trying to update a Fedora 8 installation with yum. When I execute &#8220;yum update&#8221; I received the following error: Transaction Check Error: file /usr/lib/libsensors.so.3 from install of lm_sensors-2.10.6-1.fc8.i386 conflicts with file from package libsensors3-2.10.5-52.fc6.i386 When I try to remove lm_sensors, a bunch of dependant packages want to be removed, too (but [...]]]></description> <content:encoded><![CDATA[<p>I&#8217;ve been having difficulties trying to update a Fedora 8 installation with yum. When I execute &#8220;<code>yum update</code>&#8221; I received the following error:</p><blockquote><p>Transaction Check Error:<br
/> file /usr/lib/libsensors.so.3 from install of lm_sensors-2.10.6-1.fc8.i386 conflicts with file from package libsensors3-2.10.5-52.fc6.i386</p></blockquote><p>When I try to remove lm_sensors, a bunch of dependant packages want to be removed, too (but that is not what I want).</p><p>I noticed there was a nagios plugin that was being updated called nagios-plugins-sensors. Removing that allowed me to successfully perform a yum update!</p><p>So, I typed <code>yum erase nagios-plugins-sensors</code> and yum removed the following:</p><blockquote><p>=============================================================================<br
/> Package                 Arch       Version          Repository        Size<br
/> =============================================================================<br
/> Removing:<br
/> nagios-plugins-sensors  i386       1.4.8-9.fc8      installed         1.1 k<br
/> Removing for dependencies:<br
/> nagios-plugins-all      i386       1.4.8-9.fc8      installed          0.0</p></blockquote><p>Success!</p> ]]></content:encoded> <wfw:commentRss>http://www.rickwargo.com/2008/04/23/cannot-update-fedora-8-via-yum/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>nagios: Checking a samba share without a password</title><link>http://www.rickwargo.com/2006/10/29/nagios-checking-a-samba-share-without-a-password/</link> <comments>http://www.rickwargo.com/2006/10/29/nagios-checking-a-samba-share-without-a-password/#comments</comments> <pubDate>Sun, 29 Oct 2006 23:36:13 +0000</pubDate> <dc:creator>Rick Wargo</dc:creator> <category><![CDATA[nagios]]></category> <category><![CDATA[WILT]]></category> <guid
isPermaLink="false">http://www.rickwargo.com/2006/10/29/nagios-checking-a-samba-share-without-a-password/</guid> <description><![CDATA[I was getting errors (Access Denied) when I tried to check a samba share that had no password (I know &#8211; bad practice). Turns out I needed to add a new entry in checkcommands.cfg specifically to test for no password. define command{ command_name check_samba_disk_nopw command_line $USER1$/check_disk_smb --hostname="$HOSTADDRESS$" --share="$ARG1$" -u "$ARG2$" -p "''" -w 85 -c [...]]]></description> <content:encoded><![CDATA[<p>I was getting errors (Access Denied) when I tried to check a samba share that had no password (I know &#8211; bad practice). Turns out I needed to add a new entry in checkcommands.cfg specifically to test for no password.<br
/> <code><br
/> define command{<br
/> command_name    check_samba_disk_nopw<br
/> command_line    $USER1$/check_disk_smb --hostname="$HOSTADDRESS$" --share="$ARG1$" -u "$ARG2$" -p "''" -w 85 -c 95<br
/> }<br
/> </code></p><p>The trick is passing the nested empty quotes to check_disk_smb. This will make it work. Unfortunately, typing the command on the command line works, even without the nested quotes. It must be some internal parsing nagios does to the command_line parameter.</p> ]]></content:encoded> <wfw:commentRss>http://www.rickwargo.com/2006/10/29/nagios-checking-a-samba-share-without-a-password/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>FC6, SELinux and Nagios</title><link>http://www.rickwargo.com/2006/10/29/fc6-selinux-and-nagios/</link> <comments>http://www.rickwargo.com/2006/10/29/fc6-selinux-and-nagios/#comments</comments> <pubDate>Sun, 29 Oct 2006 21:26:02 +0000</pubDate> <dc:creator>Rick Wargo</dc:creator> <category><![CDATA[nagios]]></category> <category><![CDATA[SELinux]]></category> <category><![CDATA[WILT]]></category> <guid
isPermaLink="false">http://www.rickwargo.com/2006/10/29/fc6-selinux-and-nagios/</guid> <description><![CDATA[I love Nagios, but have been having issues with it running under SELinux targeted. I&#8217;ve finally made it work with no more AVC&#8217;s or other errors (so far!). Here is what I have done to get it to work: Install nagios. sudo yum install nagios sudo yum install 'nagios-plugins-*' Make changes to nagios configuration to [...]]]></description> <content:encoded><![CDATA[<p>I love Nagios, but have been having issues with it running under SELinux targeted. I&#8217;ve finally made it work with no more AVC&#8217;s or other errors (so far!). Here is what I have done to get it to work:</p><ol><li>Install nagios.</li><ol><li><code>sudo yum install nagios</code></li><li><code>sudo yum install 'nagios-plugins-*'</code></li></ol><li>Make changes to nagios configuration to account for your situation.</li><li>Make certain the permissions are correct.</li><ol><li>User <em>apache</em> needs read access to cfg files in /etc/nagios.</li><li>User <em>apache</em> needs read access to web site files under /usr/share/nagios/html.</li><li>If using resouces.cfg, only nagios needs access to read, not apache!</li><li>For the nagios.cmd fifo pipe (under /var/spool/nagios/cmd), permissions are 660, owner = nagios, group = apache.</li><li>cgi files need to be executable by apache</li><li>plugins need to be executable by nagios</li></ol><li>Set security contexts on files (all sone with sudo, of course)</li><ol><li><code>chcon -R -t httpd_sys_content_t /usr/share/nagios/html</code></li><li><code>chcon -R -t nagios_etc_t /etc/nagios</code></li><li><code>chcon -R -t nagios_log_t /var/log/nagios</code></li><li><code>chcon -R -t var_spool_t /var/spool/nagios</code></li><li><code>chcon -R -t bin_t /usr/lib/nagios/plugins</code></li><li><code>chcon -t nagios_cgi_exec_t /usr/lib/nagios/cgi-bin/*.cgi</code></li><li>/usr/sbin/nagios has a security domain type of sbin_t</li></ol><li>Apache alias is in /etc/httpd/conf.d/nagios.conf. Inspect and make changes as necessary. Restart httpd service.</li><li>The check_mem plugin was not working for me, it couldn&#8217;t find utils.pm. I had to add the following line to near the top of the script:</li><ol><li><code>use lib "/usr/lib/nagios/plugins" ;</code></li></ol><li>I needed to add some local security policy. Read on for details.</li></ol><p>There seems to be some holes in the policy for nagios. These are easily corrected with a little help from checkmodule.</p><p>First, need to install the SELinux tools to create new policies. These are not installed by default.</p><ol><li><code>sudo yum install checkpolicy</code></li><li><code>sudo yum install selinux-policy-devel</code></li></ol><p>There is a nice tool for troubleshooting policy called <a
title="setroubleshoot wiki" target="_blank" href="http://fedoraproject.org/wiki/SELinux/setroubleshoot">setroubleshoot</a>. It is available at Dan Walsh&#8217;s yum repo. See <a
title="Dan Walsh's blog describing repository for selinux stuff" target="_blank" href="http://danwalsh.livejournal.com/7435.html">his blog entry</a> for details. The <a
title="Treysys SETools Home Page" target="_blank" href="http://oss.tresys.com/projects/setools">setools</a> are also quite helpful at inspecting policy (although I believe you need at least version 3 to inspect policy on fc6 where version 2.4 can inspect the audit logs).</p><p>I then went through the process of running/using nagios, inspecting the audit.log and taking the appropriate lines and running them through audit2allow -M</p><p>to generate the proper policy and then load the policy module. I had to do this process a number of times to make certain I captured all the AVC&#8217;s. I ended up with the following policy module (I&#8217;ve named it local, feel free to change its name if it conflicts. If you do, you need to make a change in the file, too).</p><p><code>module local 1.0.0;<br
/> require {<br
/> class fifo_file read;<br
/> class fifo_file getattr;<br
/> class fifo_file write;<br
/> class dir search;<br
/> class process { sigkill signal };<br
/> type httpd_t;<br
/> type nagios_cgi_t;<br
/> type ping_t;<br
/> type var_spool_t;<br
/> role system_r;<br
/> };</code></p><p>allow ping_t var_spool_t:fifo_file read;<br
/> allow httpd_t nagios_cgi_t:process { sigkill signal };<br
/> allow nagios_cgi_t var_spool_t:fifo_file getattr;<br
/> allow nagios_cgi_t var_spool_t:dir search;<br
/> allow nagios_cgi_t var_spool_t:fifo_file write;<br
/> After capturing this in the file local.te, make the policy package with:</p><p>% <code>make -f /usr/share/selinux/devel/Makefile</code></p><p>This will ultimately create local.pp which then can be loaded by executing:</p><p>% <code>sudo semodule -i local.pp</code></p><p>A good review of all of this can be found in the <a
title="SELinux FAQ (FC5)" href="http://fedora.redhat.com/docs/selinux-faq-fc5/">Red Hat SELinux FAQ</a>.</p> ]]></content:encoded> <wfw:commentRss>http://www.rickwargo.com/2006/10/29/fc6-selinux-and-nagios/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> </channel> </rss>
