{"id":10,"date":"2010-07-17T14:15:58","date_gmt":"2010-07-17T08:45:58","guid":{"rendered":"http:\/\/atuljha.com\/blog\/?p=10"},"modified":"2010-07-18T01:56:51","modified_gmt":"2010-07-17T20:26:51","slug":"installingcompiling-nagios03-on-rhel5","status":"publish","type":"post","link":"https:\/\/atuljha.com\/blog\/2010\/07\/17\/installingcompiling-nagios03-on-rhel5\/","title":{"rendered":"Installing\/Compiling Nagios03 on rhel5"},"content":{"rendered":"<div id=\"_mcePaste\"><strong>Okey i been planning to do this long back.on rhel5 box here is a simple<\/strong><\/div>\n<div id=\"_mcePaste\"><strong>guide i have made which lets you compile nagio3 from source and install<\/strong><\/div>\n<div id=\"_mcePaste\"><strong>in RHEL5 box.<\/strong><\/div>\n<div>Make sure you have these packages installed:&#8211;<\/div>\n<div id=\"_mcePaste\">1.Apache<\/div>\n<div id=\"_mcePaste\">2. GCC compiler<\/div>\n<div id=\"_mcePaste\">3.GD development libraries<\/div>\n<div>You can use &#8220;yum&#8221; to install these packages by running the following<\/div>\n<div id=\"_mcePaste\">commands (<strong>as root<\/strong>):<\/div>\n<div><em>yum install httpd gcc glibc glibc-common gd gd-devel<\/em><\/div>\n<div>Create a new nagios user account and give it a password.<\/div>\n<div><em>\/usr\/sbin\/useradd -m nagios<\/em><\/div>\n<div><em>passwd nagios<\/em><\/div>\n<div>Create a new nagcmd group for allowing external commands to be submitted<\/div>\n<div id=\"_mcePaste\">through the web interface.<\/div>\n<div>Add both the nagios user and the apache user to the group.<\/div>\n<div><em>\/usr\/sbin\/groupadd nagcmd<\/em><\/div>\n<div id=\"_mcePaste\"><em>\/usr\/sbin\/usermod -a -G nagcmd nagios<\/em><\/div>\n<div id=\"_mcePaste\"><em>\/usr\/sbin\/usermod -a -G nagcmd apache<\/em><\/div>\n<div>2) Download Nagios and the Plugins Create a directory for storing the\u00a0downloads.<\/div>\n<div>mkdir ~\/downloads<\/div>\n<div id=\"_mcePaste\">cd ~\/downloads<\/div>\n<div>Download the source code tarballs of both Nagios and the Nagios plugins\u00a0(visit http:\/\/www.nagios.org\/download\/ for links to the latest\u00a0versions).<\/div>\n<div><em>wget\u00a0http:\/\/sourceforge.net\/projects\/nagios\/files\/nagios-3.x\/nagios-3.2.1\/nagios-3.2.1.tar.gz\/download<\/em><\/div>\n<div id=\"_mcePaste\"><em>wget\u00a0http:\/\/sourceforge.net\/projects\/nagiosplug\/files\/nagiosplug\/1.4.14\/nagios-plugins-1.4.14.tar.gz\/download<\/em><\/div>\n<div>3) Compile and Install Nagios Extract the Nagios source code tarball.<\/div>\n<div><em>cd ~\/downloads tar xzf nagios-3.2.1tar.gz <\/em><\/div>\n<div><em>cd nagios-3.2.1<\/em><\/div>\n<div>Run the Nagios configure script, passing the name of the group you\u00a0created earlier like so:<\/div>\n<div><em>.\/configure &#8211;with-command-group=nagcmd<\/em><\/div>\n<div><em><br \/>\n<\/em><\/div>\n<div id=\"_mcePaste\">Compile the Nagios source code. make all Install binaries, init script,\u00a0sample config files and set permissions on the external command\u00a0directory.<\/div>\n<div><em>make install<\/em><\/div>\n<div id=\"_mcePaste\"><em>make install-init<\/em><\/div>\n<div id=\"_mcePaste\"><em>make install-config<\/em><\/div>\n<div id=\"_mcePaste\"><em>make install-commandmode<\/em><\/div>\n<div>Don&#8217;t start Nagios yet &#8211; there&#8217;s still more that needs to be done&#8230;<\/div>\n<div>4) Customize Configuration Sample configuration files have now been\u00a0installed in the \/usr\/local\/nagios\/etc directory. These sample files\u00a0should work fine for getting started with Nagios. You&#8217;ll need to make\u00a0just one change before you proceed&#8230;<\/div>\n<div>Edit the <em>\/usr\/local\/nagios\/etc\/objects\/contacts.cfg config<\/em> file with\u00a0your favorite editor and change the email address associated with the\u00a0nagiosadmin contact definition to the address you&#8217;d like to use for\u00a0receiving alerts.<\/div>\n<div><em>vi \/usr\/local\/nagios\/etc\/objects\/contacts.cfg<\/em><\/div>\n<div>5) Configure the Web Interface Install the Nagios web config file in the\u00a0Apache conf.d directory. make install-webconf<\/div>\n<div>Create a nagiosadmin\u00a0account for logging into the Nagios web interface.\u00a0Remember the password you assign to this account &#8211; you&#8217;ll need it later.<\/div>\n<div><em>htpasswd -c \/usr\/local\/nagios\/etc\/htpasswd<\/em><\/div>\n<div>users nagiosadmin Restart Apache to make the new settings take effect.<\/div>\n<div><em>service httpd restart<\/em><\/div>\n<div><strong>Implementing Digest Authentication <\/strong><\/div>\n<div>The implementation of Digest\u00a0Authentication is simple. You will have to create the new type of\u00a0password file using the &#8216;htdigest&#8217; tool, then modify the Apache\u00a0configuration for nagios (typically \/etc\/httpd\/conf.d\/nagios.conf).<\/div>\n<div id=\"_mcePaste\">Create a new passwords file using the &#8216;htdigest&#8217; tool.\u00a0The difference that you will notice if you are familiar with &#8216;htpasswd&#8217;<\/div>\n<div id=\"_mcePaste\">tools is the requirement to supply a &#8216;realm&#8217; argument. Where &#8216;realm&#8217; in\u00a0this case refers to the value of the &#8216;AuthName&#8217; directive in the Apache\u00a0configuration.<\/div>\n<div><em>htdigest -c \/usr\/local\/nagios\/etc\/.digest_pw &#8220;Nagios<\/em><\/div>\n<div>Access&#8221; nagiosadmin Next, edit the Apache configuration file for Nagios(typically \/etc\/httpd\/conf.d\/nagios.conf) using the following example.<\/div>\n<div>## BEGIN APACHE CONFIG SNIPPET &#8211; NAGIOS.CONF ScriptAlias \/nagios\/cgi-bin<\/div>\n<div id=\"_mcePaste\">&#8220;\/usr\/local\/nagios\/sbin&#8221;<\/div>\n<div id=\"_mcePaste\">Options ExecCGI AllowOverride None Order allow,deny Allow from all<\/div>\n<div id=\"_mcePaste\">AuthType Digest AuthName &#8220;Nagios Access&#8221; AuthUserFile<\/div>\n<div id=\"_mcePaste\">\/usr\/local\/nagios\/etc\/.digest_pw Require valid-user Alias \/nagios<\/div>\n<div id=\"_mcePaste\">&#8220;\/usr\/local\/nagios\/share&#8221; Options None AllowOverride None Order<\/div>\n<div id=\"_mcePaste\">allow,deny Allow from all AuthType Digest AuthName &#8220;Nagios Access&#8221;<\/div>\n<div id=\"_mcePaste\">AuthUserFile \/usr\/local\/nagios\/etc\/.digest_pw Require valid-user<\/div>\n<div id=\"_mcePaste\">## END APACHE CONFIG SNIPPETS<\/div>\n<div>Then, restart the Apache service so the new settings can take effect.<\/div>\n<div><em>\/etc\/init.d\/httpd restart<\/em><\/div>\n<div>6) Compile and Install the Nagios Plugins Extract the Nagios plugins\u00a0source code tarball.<\/div>\n<div><em>cd ~\/downloads tar xzf nagios-plugins-1.4.14.tar.gz<\/em><\/div>\n<div id=\"_mcePaste\"><em>cd nagios-plugins-1.4.14<\/em><\/div>\n<div id=\"_mcePaste\"><em>Compile and install the plugins.<\/em><\/div>\n<div id=\"_mcePaste\"><em>.\/configure &#8211;with-nagios-user=nagios &#8211;with-nagios-group=nagios<\/em><\/div>\n<div id=\"_mcePaste\"><em>make<\/em><\/div>\n<div id=\"_mcePaste\"><em>make install<\/em><\/div>\n<div>7) Start Nagios Add Nagios to the list of system services and have it\u00a0automatically start when the system boots.<\/div>\n<div><em>chkconfig &#8211;add nagios<\/em><\/div>\n<div id=\"_mcePaste\"><em>chkconfig nagios on<\/em><\/div>\n<div>Verify the sample Nagios configuration files.<\/div>\n<div><em>\/usr\/local\/nagios\/bin\/nagios -v \/usr\/local\/nagios\/etc\/nagios.cfg<\/em><\/div>\n<div>If there are no errors, start Nagios.<\/div>\n<div id=\"_mcePaste\"><em>service nagios start<\/em><\/div>\n<div>9) Login to the Web Interface You should now be able to access the \u00a0Nagios web interface at the URL below. You&#8217;ll be prompted for the\u00a0username (nagiosadmin) and password you specified earlier.<\/div>\n<div><em>http:\/\/localhost\/nagios\/<\/em><\/div>\n<div>Click on the &#8220;Service Detail&#8221; navbar link to see details of what&#8217;s being\u00a0monitored on your local machine.<\/div>\n<div>It will take a few minutes for Nagios to check all the services \u00a0associated with your machine, as the checks are spread out over time.<\/div>\n<div>refernce :&#8211; nagios manual<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Okey i been planning to do this long back.on rhel5 box here is a simple guide i have made which lets you compile nagio3 from source and install in RHEL5 box. Make sure you have these packages installed:&#8211; 1.Apache 2. GCC compiler 3.GD development libraries You can use &#8220;yum&#8221; to install these packages by running &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/atuljha.com\/blog\/2010\/07\/17\/installingcompiling-nagios03-on-rhel5\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Installing\/Compiling Nagios03 on rhel5&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/atuljha.com\/blog\/wp-json\/wp\/v2\/posts\/10"}],"collection":[{"href":"https:\/\/atuljha.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/atuljha.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/atuljha.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/atuljha.com\/blog\/wp-json\/wp\/v2\/comments?post=10"}],"version-history":[{"count":8,"href":"https:\/\/atuljha.com\/blog\/wp-json\/wp\/v2\/posts\/10\/revisions"}],"predecessor-version":[{"id":33,"href":"https:\/\/atuljha.com\/blog\/wp-json\/wp\/v2\/posts\/10\/revisions\/33"}],"wp:attachment":[{"href":"https:\/\/atuljha.com\/blog\/wp-json\/wp\/v2\/media?parent=10"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atuljha.com\/blog\/wp-json\/wp\/v2\/categories?post=10"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atuljha.com\/blog\/wp-json\/wp\/v2\/tags?post=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}