{"id":399,"date":"2009-12-07T13:16:59","date_gmt":"2009-12-07T18:16:59","guid":{"rendered":"http:\/\/it.thelibrarie.com\/weblog\/?p=399"},"modified":"2011-07-27T08:52:00","modified_gmt":"2011-07-27T13:52:00","slug":"install-nagios-on-ubuntu-9-x","status":"publish","type":"post","link":"https:\/\/it.thelibrarie.com\/weblog\/2009\/12\/install-nagios-on-ubuntu-9-x\/","title":{"rendered":"Install Nagios on Ubuntu 9.x, Client on Windows"},"content":{"rendered":"<p>This is how I got nagios to install on my Ubuntu 9.10 x86 server (LAMP):<br \/>\n***EDIT*** I&#8217;ve upgraded the 9.10 x86 server to 10.04LTS x86 and Nagios is still running like a champ.  FYI.<\/p>\n<p>This assumes you&#8217;ve already got LAMP up and running on the box and have at least a little common sense when it comes to linux commands.  I still use putty to connect via SSH to my box.  I also cheated and made it so I don&#8217;t do sudo (sudo passwd root, then su into root).  If you don&#8217;t want to do that, just add &#8216;sudo&#8217; in front of all the commands.<\/p>\n<p>Update your box:<br \/>\n<code>apt-get update<\/code><br \/>\n<code>apt-get upgrade<\/code><br \/>\n<code>apt-get dist-upgrade<\/code><\/p>\n<p>Install the GCC compiler development libraries:<br \/>\n<code>apt-get install build-essential<\/code><\/p>\n<p>Install GD development libraries:<br \/>\n<code>apt-get install libgd2-xpm-dev<\/code><\/p>\n<p>Create a new user &#8220;nagios&#8221;:<br \/>\n<code>useradd -m -s \/bin\/bash nagios<\/code><\/p>\n<p>Make a password for the new user:<br \/>\n<code>passwd nagios<\/code><\/p>\n<p>Create a new group &#8220;nagcmd&#8221;<br \/>\n<code>groupadd nagcmd<\/code><br \/>\n<code>usermod -a -G nagcmd nagios<\/code><br \/>\n<code>usermod -a -G nagcmd www-data<\/code><\/p>\n<p>Download the nagios files &#8211; I use \/home\/username as my download point:<br \/>\n<code>wget http:\/\/prdownloads.sourceforge.net\/sourceforge\/nagios\/nagios-3.2.0.tar.gz<\/code><br \/>\n<code>wget http:\/\/prdownloads.sourceforge.net\/sourceforge\/nagiosplug\/nagios-plugins-1.4.14.tar.gz<\/code><\/p>\n<p>Extract and compile the files:<br \/>\n<code>tar xzf nagios-3.2.0.tar.gz<\/code><br \/>\n<code>cd nagios-3.2.0<\/code><br \/>\n<code>.\/configure --with-command-group=nagcmd<\/code><br \/>\n<code>make all<\/code><br \/>\n<code>make install<\/code><br \/>\n<code>make install-init<\/code><br \/>\n<code>make install-config<\/code><br \/>\n<code>make install-commandmode<\/code><br \/>\n<code>make install-webconf<\/code><\/p>\n<p>Create a nagiosadmin account for the web interface:<br \/>\n<code>htpasswd -c \/usr\/local\/nagios\/etc\/htpasswd.users nagiosadmin<\/code><\/p>\n<p>Restart Apache<br \/>\n<code>apache2ctl restart<\/code><\/p>\n<p>That should be it for the installation phase of the main application.  You can verify that everything works by viewing the site: http:\/\/localhost\/nagios (or http:\/\/ipofserver\/nagios) and logging in using nagiosadmin\/thepasswordyoupicked.  But now we should probably put the plugins in place before actually going through any other setup.<\/p>\n<p>Unpack the plugins:<br \/>\n<code>tar xzf nagios-plugins-1.4.14.tar.gz<\/code><br \/>\n<code>cd nagios-plugins-1.4.14<\/code><\/p>\n<p>Configure and install the plugins:<br \/>\n<code>.\/configure --with-nagios-user=nagios --with-nagios-group=nagios<\/code><br \/>\n<code>make<\/code><br \/>\n<code>make install<\/code><\/p>\n<p>Verify that the sample nagios configuration files are fine:<br \/>\n<code>\/usr\/local\/nagios\/bin\/nagios -v \/usr\/local\/nagios\/etc\/nagios.cfg<\/code><\/p>\n<p>If there are no errors you can start nagios:<br \/>\n<code>\/etc\/init.d\/nagios start<\/code><\/p>\n<p>http:\/\/localhost\/nagios<br \/>\nClick on the Tactical Overview navbar link to see all that&#8217;s monitored right now.  This may take a few moments to load as to not &#8220;kill&#8221; the machine with requests.<\/p>\n<p>http:\/\/www.monitoringexchange.org\/<\/p>\n<p><strong>INSTALL CLIENT ON WINDOWS MACHINE(S):<\/strong><br \/>\nI&#8217;ve installed on WindowsXP 32, Windows Server 2003 32\/64, and Windows 7 64bit without any issues.<\/p>\n<p>Setting up for Windows Machine monitoring is a little more in depth:<\/p>\n<p>Download the NSClient++:<br \/>\n<code>http:\/\/nsclient.org\/nscp\/downloads<\/code><br \/>\n<code>Extract to the C:\\ directory<\/code><br \/>\n<code>Open a CMD prompt and navigate to C:\\NSClient++-0.3.7-Win32<\/code><\/p>\n<p>Install the Service and System Tray:<br \/>\nThe system tray gave me some issues on a Windows 7 x64 box.  FYI.<br \/>\n<code>nsclient++ \/install<\/code><br \/>\n<code>nsclient++ SysTray -install<\/code><\/p>\n<p>Configure the NSClientpp Service:<br \/>\n<code>Open up services (services.msc) and find NSCLientpp (Nagios)<\/code><br \/>\n<code>Right-Click and select properties<\/code><br \/>\n<code>Click on the Log On tab and make sure the Local System account can interact with the desktop<\/code><\/p>\n<p>Edit the INI file:<br \/>\n<code>Navigate to C:\\NSClient++*\\<\/code><br \/>\n<code>Edit NSC.INI<\/code><\/p>\n<p>Uncomment the following:<\/p>\n<blockquote><p>FileLogger.dll<br \/>\nCheckSystem.dll<br \/>\nCheckDisk.dll<br \/>\nNSClientListener.dll<br \/>\nNRPEListener.dll<br \/>\nSysTray.dll<br \/>\nCheckEventLog.dll<br \/>\nCheckHelpers.dll<\/p><\/blockquote>\n<p>Uncomment the hosts allowed file &#8211; either add the IP address of the Nagios server or just leave it blank and it will accept from all IPs.<\/p>\n<p>Save the file, Start the service &#8211; I&#8217;ve had it work without interact with desktop, but it was recommended by Nagios to enable that feature.<\/p>\n<p>Back on the Nagios server, edit the \/usr\/local\/nagios\/etc\/objects\/windows.cfg file to the liking of your windows machine.<br \/>\nYou may have to add the host name\/ip to your \/etc\/hosts file to rid yourself of errors<\/p>\n<p>Verify your setup can run:<br \/>\n<code>\/usr\/local\/nagios\/bin\/nagios -v \/usr\/local\/nagios\/etc\/nagios.cfg<\/code><br \/>\nThen restart nagios:<br \/>\n<code>\/etc\/init.d\/nagios restart<\/code><\/p>\n<p>Now you should be done.  Login to your http:\/\/serverip\/nagios site with your nagiosadmin\/passwordyouchoseearlier account information.<\/p>\n<p>As a side note, I also edited \/usr\/local\/nagios\/etc\/nagios.cfg for the admin_email= to send email to my account.  I already have postfix installed from another project, so it *should* send me alert emails.  AND I found that you have to edit \/usr\/local\/nagios\/etc\/objects\/contacts.cfg as well.  After editing make sure you restart the nagios service.<\/p>\n<p>***EDIT***<\/p>\n<p>I was receiving the emails just fine, but they were coming from the &#8220;wrong domain&#8221;.  Ubuntu\/debian puts the domain name by default in the \/etc\/mailname file.  Edit that file and then reload postfix.<br \/>\n<code>nano \/etc\/mailname<\/code><br \/>\n<code>postfix reload<\/code><\/p>\n<p>If the file does not exist (you&#8217;re creating a new file with nano), type in your domain name (ie thelibrarie.com), and then save the file.  Then edit the postfix configuration and uncomment myorgin.<br \/>\n<code>nano \/etc\/mailname<\/code><br \/>\n<code>nano \/etc\/postfix\/main.c<\/code><\/p>\n<blockquote><p>myorigin = \/etc\/mailname<\/p><\/blockquote>\n<p>And then try it again.  You can test it out by sending yourself some mail:<br \/>\n<code>mail -s test username@domain.tld<\/code><br \/>\n<code>body<\/code><br \/>\n<code>Control + D<\/code><br \/>\n<code>Control + D<\/code><\/p>\n<p>I also realized that I put how to install the client on Windows machines, so I should probably mention that in the subject, eh?<\/p>\n<p>***EDIT***<br \/>\nOK, I had to add another user to be able to view the status of the systems.<br \/>\nAdd the User:<br \/>\nSSH to your nagios system<br \/>\n<code>htpasswd \/usr\/local\/nagios\/etc\/htpasswd.users USERNAMEHERE<\/code><br \/>\n<code>apache2ctl restart<\/code><\/p>\n<p>Add the permissions:<br \/>\n<code>nano \/usr\/local\/nagios\/etc\/cgi.cfg<\/code><br \/>\nSearch under GLOBAL HOST\/SERVICE VIEW ACCESS<br \/>\nChange:<br \/>\n<code>authorized_for_all_services=nagiosadmin<\/code><br \/>\n<code>authorized_for_all_hosts=nagiosadmin<\/code><br \/>\nto:<br \/>\n<code>authorized_for_all_services=*<\/code><br \/>\n<code>authorized_for_all_hosts=*<\/code><\/p>\n<p>Or you can comma-delimit the users.  Either way, I win.<\/p>\n<p>Restart nagios.<br \/>\n<code>\/etc\/init.d\/nagios restart<\/code><\/p>\n<p>***EDIT 2***<br \/>\nNeed more plugins?  <a href=\"http:\/\/nagios.manubulon.com\/\">http:\/\/nagios.manubulon.com\/<\/a><\/p>\n<p>***EDIT 3***<br \/>\nThere will be a new post regarding editing Nagios to add images to the map\/new users\/parents of configurations etc.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is how I got nagios to install on my Ubuntu 9.10 x86 server (LAMP): ***EDIT*** I&#8217;ve upgraded the 9.10 x86 server to 10.04LTS x86 and Nagios is still running like a champ. FYI. This assumes you&#8217;ve already got LAMP up and running on the box and have at least a little common sense when &hellip; <a href=\"https:\/\/it.thelibrarie.com\/weblog\/2009\/12\/install-nagios-on-ubuntu-9-x\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Install Nagios on Ubuntu 9.x, Client on Windows<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,8,1],"tags":[],"class_list":["post-399","post","type-post","status-publish","format-standard","hentry","category-linux","category-microsoft","category-miscellaneous"],"_links":{"self":[{"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/posts\/399","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/comments?post=399"}],"version-history":[{"count":13,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/posts\/399\/revisions"}],"predecessor-version":[{"id":760,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/posts\/399\/revisions\/760"}],"wp:attachment":[{"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/media?parent=399"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/categories?post=399"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/tags?post=399"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}