tag:blogger.com,1999:blog-31704255540944578962024-02-19T02:26:19.803-08:00Open SourceShahnawaz Saifihttp://www.blogger.com/profile/00369616200651338297noreply@blogger.comBlogger14125tag:blogger.com,1999:blog-3170425554094457896.post-70474455162191323072011-07-28T02:18:00.000-07:002011-07-28T02:33:18.779-07:00Installing Munin On CentOS<div dir="ltr" style="text-align: left;" trbidi="on"><h2><span style="font-family: "Calibri","sans-serif"; font-size: 15pt;">Configuring Munin On CentOS </span><i style="mso-bidi-font-style: normal;"><span style="font-family: "Calibri","sans-serif"; font-size: 11pt;">x86_64 </span></i><span style="font-family: "Calibri","sans-serif"; font-size: 16pt;">:</span><span style="font-family: "Calibri","sans-serif"; font-size: 15pt;"></span></h2><div class="MsoNormal" style="font-family: Verdana,sans-serif; text-align: justify; text-indent: 0.5in;"><span style="font-size: x-small;">Munin is a monitoring tool for servers. It uses RRDtool to log and graph data from your servers. The plugin API is very easy to grasp. Actually, I haven’t read the API documentation yet. I just looked at the output of the plugins and it looks easy to achieve. The data can be accessed through the web.</span></div><div class="MsoNormal" style="font-family: Verdana,sans-serif; text-align: justify;"><span style="font-size: x-small;">Munin works by polling your servers for the data hence two applications, Munin and Munin Node. The former periodically gathers data (crond) and the latter serves the data to the former. Please refer to the following for our example configuration. You can make up a domain if you want Munin to group your servers similar to the live demo.</span></div><ul style="font-family: Verdana,sans-serif; text-align: left;"><li><span style="font-size: x-small;"><span style="-moz-font-feature-settings: normal; -moz-font-language-override: normal; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"></span>Munin “Munin Server” – shah.example.com (192.168.1.1)</span></li>
<li><span style="font-size: x-small;"><span style="-moz-font-feature-settings: normal; -moz-font-language-override: normal; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"></span>A Munin Node – king.example.com (192.168.1.2)</span></li>
</ul><div class="MsoNormal" style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: x-small;"><b>- INSTALLING AND CONFIGURING MUNIN</b></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"> </div><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;"> In this section, we set it up on shah.example.com</div><span style="background: none repeat scroll 0% 0% silver;"> </span><br />
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt; text-indent: 0.5in;"><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">mkdir ~/downloads</span></code></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-indent: .5in;"><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">cd ~/downloads</span></code></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoListParagraph" style="font-family: Verdana,sans-serif; line-height: normal; margin: 0in 0in 0.0001pt 13.5pt; text-indent: -9pt;"><span style="font-size: x-small;">-<span style="-moz-font-feature-settings: normal; -moz-font-language-override: normal; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span><b>Download munin server rpm from </b><a href="http://www.4shared.com/file/Ki8OA9am/munin-125-2el5rfnoarch.html"><b><span style="color: windowtext; text-decoration: none;">http://www.4shared.com/file/Ki8OA9am/munin-125-2el5rfnoarch.html</span></b></a></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-indent: .5in;"><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">ls ~/downloads</span></code><code></code></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="font-family: Courier; font-size: 10pt;"> </span><code><span style="font-size: 10pt;"><span style="background: none repeat scroll 0% 0% silver;">munin-1.2.5-2.el5.rf.noarch.rpm</span></span></code></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">-Install dag repo to get dependencies:</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">rpm -ivh </span></code><code><span style="background: none repeat scroll 0% 0% silver; font-size: 9pt;">http://download.fedora.redhat.com/pub/epel/5Server/x86_64/epel-release-5-4.noarch.rpm</span></code><code></code></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">-To install Munin server: </div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">yum localinstall munin-1.2.5-2.el5.rf.noarch.rpm --nogpgcheck -y</span></code><code></code></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">-After installing above rpm list <span style="font-family: Courier;">/var/www/munin</span>. If it exists refer <span style="font-family: Courier;">/etc/httpd/conf.d/munin.conf</span> to set apache configuration.</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-indent: .5in;"><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">vim /etc/httpd/conf.d/munin.conf</span></code><code></code></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;">ScriptAlias /munin/cgi "/var/www/munin/cgi/"</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"><directory "="" cgi"="" munin="" var="" www=""></directory></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"># SSLRequireSSL</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"> Options ExecCGI</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"> AllowOverride None</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"> Order allow,deny</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"> Allow from all</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"># Order deny,allow</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"># Deny from all</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"># Allow from 127.0.0.1</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"> AuthName "Munin Access"</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"> AuthType Basic</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"> AuthUserFile /var/www/munin/passwd</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"> Require valid-user</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;">Alias /munin "/var/www/munin/"</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"><directory "="" munin"="" var="" www=""></directory></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"># SSLRequireSSL</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"> Options None</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"> AllowOverride None</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"> Order allow,deny</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"> Allow from all</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"># Order deny,allow</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"># Deny from all</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"># Allow from 127.0.0.1</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"> AuthName "Munin Access"</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"> AuthType Basic</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"> AuthUserFile /var/www/munin/passwd</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"> Require valid-user</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 8pt;"></span><span style="font-family: "Courier New"; font-size: 8pt;"></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">-Create a user for UI authentication using following:</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-indent: .5in;"><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">htpasswd -c /var/www/munin/passwd munin</span></code><code></code></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">- Set permission to munin user:</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-indent: .5in;"><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">chown -R munin:munin /var/www/munin</span></code><code></code></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">-Start apache/httpd and crond service</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-indent: .5in;"><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">service httpd start && service crond restart</span></code></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-indent: .5in;"><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">chkconfig httpd on</span></code><code></code></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;">-You can check if it’s working through your browser (i.e. <a href="http://192.168.1.1/munin">http://192.168.1.1/munin</a>). It will prompt for user/password which we defined above with htpasswd. So put user/password accordingly to access munin UI.</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><b style="mso-bidi-font-weight: normal;">================================</b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><b style="mso-bidi-font-weight: normal;">ADDING LOCALHOST IN MUNIN SERVER TO GET LOCALHOST GRAPHS:</b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">- Make sure you have installed dag repo before following below steps.</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-indent: .5in;"><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">cd ~/downloads</span></code></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 9.0pt; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -9.0pt;">-<span style="font: 7pt "Times New Roman";"> </span><b style="mso-bidi-font-weight: normal;">Download munin-node rpm from </b><a href="http://www.4shared.com/file/-soV7Hsu/munin-node-125-2el5rfnoarch.html"><b style="mso-bidi-font-weight: normal;">http://www.4shared.com/file/-soV7Hsu/munin-node-125-2el5rfnoarch.html</b></a></div><div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">yum localinstall munin-node-1.2.5-2.el5.rf.noarch.rpm --nogpgcheck -y</span></code><code></code></div><div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;">-Edit Munin’s configuration on the graph (<code><span style="font-size: 10pt;">shah.example.com</span></code>) server (<code><span style="font-size: 10pt;">/etc/munin/munin.conf</span></code>) and add following.</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-indent: .5in;"><span style="background: none repeat scroll 0% 0% silver; font-family: Courier;">[localhost]</span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-indent: .5in;"><span style="background: none repeat scroll 0% 0% silver; font-family: Courier;">address 127.0.0.1</span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-indent: .5in;"><span style="background: none repeat scroll 0% 0% silver; font-family: Courier;">use_node_name yes</span><span style="font-family: Courier;"></span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;">- Edit munin-node config file:</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto; text-indent: .5in;"><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">vim /etc/munin/munin-node.conf</span></code><code></code></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-indent: .5in;"><span style="background: none repeat scroll 0% 0% silver; font-family: Courier;"> allow ^127\.0\.0\.1$</span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto; text-indent: .5in;"><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">service munin-node start</span></code><code><span style="font-size: 10pt;"> </span></code></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto; text-indent: .5in;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto; text-indent: .5in;"><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">chkconfig munin-node on</span></code><code></code></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto; text-align: justify;"> -Now wait for 5minutes and check your browser with <a href="http://192.168.1.1/munin">http://192.168.1.1/munin</a> for localhost. It will show default graphs for localhost. If you are willing to add other graphs for apache and so which is explained next while adding other host as node.</div><div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><b style="mso-bidi-font-weight: normal;"> ================================</b></div><div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"><b style="mso-bidi-font-weight: normal;">Add a Node </b>(<i style="mso-bidi-font-style: normal;">i.e.<b style="mso-bidi-font-weight: normal;"> </b>king.example.com)</i></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 9.0pt; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -9.0pt;">-<span style="font: 7pt "Times New Roman";"> </span><b style="mso-bidi-font-weight: normal;">Make sure you have installed Dag repo and munin-node rpms, follow above steps to do so.</b></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 9.0pt; margin-right: 0in; margin-top: 0in; mso-add-space: auto;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;">After installing above, edit <code><span style="font-size: 10pt;">/etc/munin/munin-node.conf</span></code> on remote host (i.e. king.example.com):</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;"><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">allow ^192\.168\.1\.1$</span></code><br />
<code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">hostname king.example.com </span></code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;"># required only if you don’t have DNS in-place</span><span style="font-size: 10pt;"> </span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;">Start munin-node service:</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto; text-indent: .5in;"><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">service munin-node start</span></code><code></code></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto; text-indent: .5in;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto; text-indent: .5in;"><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">chkconfig munin-node on</span></code><code></code></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"><br />
</div><div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;">Check log file to make sure it works fine:</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">tail -f /var/log/munin/munin-node.log</span></code><code></code></div><div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"><span style="background: none repeat scroll 0% 0% silver; font-family: Courier; font-size: 10pt;">2011/07/28-12:00:05 CONNECT TCP Peer: "192.168.1.1:58652" Local: "192.168.1.2:4949"</span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;">If you find something unusual, resolve the dependency issue related to plug-ins which can be found at <span style="background: none repeat scroll 0% 0% silver; font-family: Courier; font-size: 10pt;">/usr/share/munin/plugins </span><span style="background: none repeat scroll 0% 0% silver;"></span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;">-Now wait for five minutes and check your browser with <a href="http://192.168.1.1/munin%20for%20king.example.com">http://192.168.1.1/munin for king.example.com</a>.</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"><b style="mso-bidi-font-weight: normal;">ADDING PLUG-INS </b></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;">Suppose this host is running httpd/apache service and we want to get graphs for it, here we go:</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto; text-indent: .5in;"><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">ln</span></code><span style="background: none repeat scroll 0% 0% silver;"> </span><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">-s /usr/share/munin/plugins/apache_* /etc/munin/plugins/</span></code></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;">It doesn’t work default by just adding apache plug-ins to path to make it work. </div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto; text-align: justify;"><b style="mso-bidi-font-weight: normal;">mod_status</b> module provides performance during load testing or for allowing a monitoring program like munin or mrtg to gather activity data for later aggregation. We need to configure apache to “ExtendedStatus”, let’s see how:</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto; text-align: justify;">To make sure about mod_status “LoadModule status_module modules/mod_status.so” in /etc/httpd/conf/httpd.conf. And refer next.</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;">- Edit using vi or nano /etc/httpd/conf/httpd.conf and search for server-status, you will find:</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto;"><span style="background: none repeat scroll 0% 0% silver; font-family: Courier; font-size: 10pt;"><br />
<location server-status=""></location></span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto;"><span style="background: none repeat scroll 0% 0% silver; font-family: Courier; font-size: 10pt;"># SetHandler server-status</span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto;"><span style="background: none repeat scroll 0% 0% silver; font-family: Courier; font-size: 10pt;"># Order deny,allow</span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto;"><span style="background: none repeat scroll 0% 0% silver; font-family: Courier; font-size: 10pt;"># Deny from all</span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto;"><span style="background: none repeat scroll 0% 0% silver; font-family: Courier; font-size: 10pt;"># Allow from .example.com</span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-indent: .5in;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;">- Change it to below:</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto;"><span style="background: none repeat scroll 0% 0% silver; font-family: Courier; font-size: 10pt;"><location server-status=""></location></span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto;"><span style="background: none repeat scroll 0% 0% silver; font-family: Courier; font-size: 10pt;">SetHandler server-status</span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto;"><span style="background: none repeat scroll 0% 0% silver; font-family: Courier; font-size: 10pt;">Order deny,allow</span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto;"><span style="background: none repeat scroll 0% 0% silver; font-family: Courier; font-size: 10pt;">Deny from all</span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto;"><span style="background: none repeat scroll 0% 0% silver; font-family: Courier; font-size: 10pt;">Allow from localhost</span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-indent: .5in;"><span style="background: none repeat scroll 0% 0% silver; font-family: Courier; font-size: 10pt;"></span><span style="font-family: Courier; font-size: 10pt;"></span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-indent: .5in;"><br />
</div><div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto; text-align: justify;">One more change we may want to make is to enable the ExtendedStatus setting in apache. This setting adds more information to the status page apache returns, like CPU use and requests per second. Enabling ExtendedStatus makes apache do a little extra work when it gets a status request, so you might weigh the extra information gained against the potential performance hit to a busy server.</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">Many monitoring applications that record performance over time, like munin, require that ExtendedStatus be enabled before they can monitor apache.</div><div class="MsoListParagraph" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">The ExtendedStatus setting must be set at the server level and applies to all virtual hosts running under apache. To enable it edit the httpd.conf file and look for the following entry:</div><div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;"><br />
</div><div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-indent: .5in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 10pt;">#ExtendedStatus On</span><span style="font-family: "Courier New";"></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
Uncomment that last line to enable ExtendedStatus, changing the configuration block to:</div><div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-indent: .5in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New"; font-size: 10pt;">ExtendedStatus On</span><span style="font-family: "Courier New"; font-size: 10pt;"></span></div><div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">Restart apache, now that we've made sure the apache server status page is enabled and configured the way we want it, we'll need to restart apache:</div><div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-indent: .5in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New";">service httpd restart</span></div><div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><b style="mso-bidi-font-weight: normal;">Install lynx</b></div><div class="MsoListParagraph" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;">With apache's server status page restricted to localhost-only access we won't be able to see the page from our desktop's web browser. Luckily the server status page is just a bunch of text with no graphics, letting us use a simple approach: Run a text-based web browser while logged into the slice itself.</div><div class="MsoListParagraph" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">To try this option out we'll need to install a browser on the slice first. The browser we'll use is called "lynx", and you can install it with the following command:</div><div class="MsoListParagraph" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; text-indent: .5in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New";">yum install lynx</span><span style="font-family: "Courier New";"> </span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;">No configuration is necessary, but lynx is keyboard-controlled so it's handy to know a few basic keystrokes when using it. There is a list of the most frequently-used commands at the bottom of the screen while lynx is running. If you visit a site with lynx you can navigate with the up and down keys and follow a highlighted link by hitting enter. Hit "q" to quit (and hit "y" to confirm the quit). Hit "h" to access lynx's documentation.</div><div class="MsoListParagraph" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><b style="mso-bidi-font-weight: normal;">View the status page</b></div><div class="MsoListParagraph" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;">The URL of the apache status page will be your domain name with "/server-status" tacked onto the end. In this section we're assuming you've configured your default server instance or virtual host to accept connections from the localhost only. Tell lynx to view your apache status page with the following command:</div><div class="MsoListParagraph" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; text-indent: .5in;"><span style="background: none repeat scroll 0% 0% silver; font-family: "Courier New";">lynx http://localhost/server-status</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;">You will see something like the following page if you have ExtendedStatus enabled (the example server was running, but it should look similar for all recent versions of Linux and Apache). With ExtendedStatus disabled the page will look similar, but with a few lines missing.</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">Srv PID Acc M CPU SS Req Conn Child Slot Client VHost Request</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;"> 0-0 10742 0/209/4209 _ 39.22 393 0 0.0 636.62 5435.21 127.0.0.1 king.example.comGET /server-status?auto HTTP/1.1</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;"> 1-0 4096 0/1006/5006 _ 1.98 93 0 0.0 1.03 2424.31 127.0.0.1 king.example.comGET /server-status?auto HTTP/1.1</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;"> 2-0 4095 0/1076/5076 _ 40.79 94 0 0.0 638.28 1678.18 127.0.0.1 king.example.comGET /server-status?auto HTTP/1.1</span><span style="font-size: 10pt;"></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">So, if above things go fine. Let’s move to apache plug-in for Munin:</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">ln</span></code><span style="background: none repeat scroll 0% 0% silver;"> </span><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">-s /usr/share/munin/plugins/apache_* /etc/munin/plugins/</span></code><code></code></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; text-indent: .5in;"><code><span style="background: none repeat scroll 0% 0% silver; font-size: 10pt;">service munin-node restart</span></code><code></code></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">Now, wait for five minutes and you will be able to see apache related graphs.</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div></div>Shahnawaz Saifihttp://www.blogger.com/profile/00369616200651338297noreply@blogger.com2tag:blogger.com,1999:blog-3170425554094457896.post-52838646228802510252011-06-03T01:58:00.000-07:002011-06-03T02:22:48.639-07:00PNP4Nagios with CentOS<h1 class="western"><meta equiv="CONTENT-TYPE" content="text/html; charset=utf-8"> <title></title> <meta name="GENERATOR" content="LibreOffice 3.3 (Unix)"> <style type="text/css"> <!-- @page { margin: 0.79in } P { margin-bottom: 0.08in } H1 { margin-bottom: 0.08in } H1.western { font-family: "Liberation Serif", serif } H1.cjk { font-family: "Droid Sans Fallback" } H1.ctl { font-family: "Lohit Hindi" } CODE.cjk { font-family: "Droid Sans Fallback", monospace } A:link { so-language: zxx } --> </style> </h1><h1 class="western"><span class="Apple-style-span">PNP4Nagios with CentOS:</span></h1> <p style="margin-bottom: 0.16in; border: none; padding: 0in"><span><span style="text-decoration: none"><span><span style="font-size: 9pt"><span style="font-style: normal"><b>PNP</b></span></span></span></span></span><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"> is an addon to Nagios which analyzes performance data provided by plugins and stores them automatically into RRD-databases</span></span></span></span></span></p> <p style="margin-bottom: 0.16in; border: none; padding: 0in"><strong><span><span><span style="font-size: 9pt"><span style="font-style: normal">Prerequisites</span></span></span></span></strong></p> <p style="margin-bottom: 0in; border: none; padding: 0in"><a href="http://oss.oetiker.ch/rrdtool/"><span><span style="text-decoration: none"><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">RRDtool</span></span></span></span></span></span></a><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"> is the OpenSource industry standard, high performance data logging and graphing system for time series data. Use it to write your custom monitoring shell scripts or create whole applications using its Perl, Python, Ruby, TCL or PHP bindings.</span></span></span></span></span>
<br /><span><span><span style="font-style: normal; "><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: 9pt; font-weight: normal;">Our CentOS server needed a few devel libraries installed for RRDtool:</span></span></span></span></span></p><p style="margin-bottom: 0in; border: none; padding: 0in"><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"><span style="background: #eeeeee">yum -y install cairo-devel glib2-devel pango-devel</span></span></span></span></span></span></code></p><p style="margin-bottom: 0in; border: none; padding: 0in"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">Download the </span></span></span></span></span><a href="http://oss.oetiker.ch/rrdtool/pub/" target="_blank"><span><span style="text-decoration: none"><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">latest source</span></span></span></span></span></span></a><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"> for RRDtool</span></span></span></span></span></p><p style="margin-bottom: 0in; border: none; padding: 0in"><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"><span style="background: #eeeeee">mkdir ~/downloads && cd ~/downloads
<br />wget </span></span></span></span></span></span></code><code class="western"><a href="http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.3.tar.gz"><span><span style="text-decoration: none"><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"><span style="background: #eeeeee">http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.3.tar.gz</span></span></span></span></span></span></span></a></code><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"><span style="background: #eeeeee">
<br />tar zxf rrdtool-1.4.3.tar.gz
<br />cd rrdtool-1.4.3</span></span></span></span></span></span></code></p><p style="margin-bottom: 0in; border: none; padding: 0in; font-style: normal; font-weight: normal"><span><span><span style="font-size: 9pt">Configure it with a few adjustments for our setup:</span></span></span></p><p style="margin-bottom: 0in; border: none; padding: 0in"><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"><span style="background: #eeeeee">./configure --prefix=/usr/local/rrdtool</span></span></span></span></span></span></code></p><p style="margin-bottom: 0in; border: none; padding: 0in; font-style: normal; font-weight: normal"><span><span><span style="font-size: 9pt">If everything is ok, then build and install it</span></span></span></p><p style="margin-bottom: 0in; border: none; padding: 0in"><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"><span style="background: #eeeeee">make
<br />make install</span></span></span></span></span></span></code></p><span><span class="Apple-style-span" style="color: rgb(0, 0, 0); "><span><span><span style="font-size: 9pt"><span style="font-style: normal"><h1 class="western" style="font-weight: normal; "><span><span class="Apple-style-span" style="color: rgb(0, 0, 0); "><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">
<br /></span></span></span></span></span></span></span></h1>Zlib support for PHP - </span></span></span></span><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal">--with-zlib</span></span></span></span></code></span>
<br /></span> <p style="margin-bottom: 0.16in; border: none; padding: 0in"><strong><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">Installation</span></span></span></span></span></strong><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">
<br />Download the </span></span></span></span></span><a href="http://sourceforge.net/projects/pnp4nagios/files/"><span><span style="text-decoration: none"><span><span style="font-size: 9pt"><span style="font-style: normal"><b>latest version</b></span></span></span></span></span></a><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"> of PNP4Nagios:</span></span></span></span></span></p> <p style="margin-bottom: 0.16in; border: none; padding: 0in"><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"><span style="background: #eeeeee">cd /extra/src
<br />wget </span></span></span></span></span></span></code><code class="western"><a href="http://sourceforge.net/projects/pnp4nagios/files/PNP-0.6/pnp4nagios-0.6.3.tar.gz/download%3Cbr%20/%3Etar"><span><span style="text-decoration: none"><span><span style="font-size: 9pt"><span style="font-style: normal"><b><span style="background: #eeeeee">http://sourceforge.net/projects/pnp4nagios/files/PNP-0.6/pnp4nagios-0.6.3.tar.gz/download
<br />tar</span></b></span></span></span></span></span></a></code><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"><span style="background: #eeeeee"> zxf pnp4nagios-0.6.3.tar.gz
<br />cd pnp4nagios-0.6.3</span></span></span></span></span></span></code></p> <p style="margin-bottom: 0.16in; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0in; padding-right: 0in; padding-bottom: 0in; padding-left: 0in; font-style: normal; "><span><span><span style="font-size: 9pt; ">Configure it:</span></span></span></p> <p style="margin-bottom: 0.16in; border: none; padding: 0in"><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"><span style="background: #eeeeee">./configure \
<br />--with-rrdtool=/usr/local/rrdtool/bin/rrdtool \
<br />--with-httpd-conf=/usr/local/apache2/conf/extra \
<br />--with-perl_lib_path=/usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi</span></span></span></span></span></span></code></p> <p style="margin-bottom: 0.16in; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0in; padding-right: 0in; padding-bottom: 0in; padding-left: 0in; font-style: normal; "><span><span><span style="font-size: 9pt; ">Then build and install:</span></span></span></p> <p style="margin-bottom: 0.16in; border: none; padding: 0in"><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"><span style="background: #eeeeee">make all
<br />make install</span></span></span></span></span></span></code></p> <p style="margin-bottom: 0.16in; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0in; padding-right: 0in; padding-bottom: 0in; padding-left: 0in; font-style: normal; "><span><span><span style="font-size: 9pt; ">Copy the sample config files:</span></span></span></p> <p style="margin-bottom: 0.16in; border: none; padding: 0in"><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"><span style="background: #eeeeee">make install-config</span></span></span></span></span></span></code></p> <p style="margin-bottom: 0.16in; border: none; padding: 0in; font-style: normal; font-weight: normal"><span><span><span style="font-size: 9pt">Add pnp4nagios to your Apache configuration:</span></span></span></p> <p style="margin-bottom: 0in; border: none; padding: 0in"><span><span><span style="font-size: 9pt"><span style="font-style: normal">Install the Apache config file into </span></span></span></span><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal">/etc/httpd/conf.d/pnp4nagios.conf</span></span></span></span></code><span><span><span style="font-size: 9pt"><span style="font-style: normal">:</span></span></span></span></p><p style="margin-bottom: 0in; border: none; padding: 0in"><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"><span style="background: #eeeeee">make install-webconf</span></span></span></span></span></span></code></p><p style="margin-bottom: 0in; border: none; padding: 0in"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">Then edit </span></span></span></span></span><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">/etc/httpd/conf/httpd.conf</span></span></span></span></span></code><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"> and add a line to load the PNP4Nagios conf file:</span></span></span></span></span></p><p style="margin-bottom: 0in; border: none; padding: 0in"><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"><span style="background: #eeeeee">Include conf.d/pnp4nagios.conf</span></span></span></span></span></span></code></p><p style="margin-bottom: 0in; border: none; padding: 0in"><em><span><span style="text-decoration: none"><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">or </span></span></span></span></span></span></em><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">can add the contents of </span></span></span></span></span><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">httpd.conf</span></span></span></span></span></code><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"> to your Nagios VirtualHost directive:</span></span></span></span></span></p><p style="margin-bottom: 0in; border: none; padding: 0in"><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"><span style="background: #eeeeee">Alias /pnp4nagios "/usr/local/pnp4nagios/share"
<br />
<br /><directory usr="" local="" pnp4nagios="">
<br />AllowOverride None
<br />Order allow,deny
<br />Allow from all
<br /> #
<br /># Use the same value as defined in nagios.conf
<br /> #
<br />AuthName "Nagios Access"
<br />AuthType Basic
<br />AuthUserFile /usr/local/nagios/etc/htpasswd.users
<br /> Require valid-user
<br /><ifmodule c="">
<br /> # Turn on URL rewriting
<br /> RewriteEngine On
<br /> Options FollowSymLinks
<br /> # Installation directory
<br /> RewriteBase /pnp4nagios/
<br /> # Protect application and system files from being viewed
<br /> RewriteRule ^(application|modules|system) - [F,L]
<br /> # Allow any files or directories that exist to be displayed directly
<br /> RewriteCond %{REQUEST_FILENAME} !-f
<br /> RewriteCond %{REQUEST_FILENAME} !-d
<br /> # Rewrite all other URLs to index.php/URL
<br /> RewriteRule .* index.php/$0 [PT,L]
<br /> </ifmodule>
<br /></directory></span></span></span></span></span></span></code></p> <p style="margin-bottom: 0.16in; border: none; padding: 0in"><span class="Apple-style-span" style="color: rgb(68, 68, 68); font-family: 'Trebuchet MS', 'Helvetica neue', Helvetica, Arial, Verdana, sans-serif; font-size: 12px; font-weight: normal; ">- It might show error related to php-5.2, if it shows such issue add CentOS-Test repository and add following configuration as:</span></p> <p style="margin-bottom: 0.16in; border: none; padding: 0in"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">vi /etc/yum.repos.d/CentOS-Test-repo </span></span></span></span></span> </p><p style="margin-bottom: 0.16in; border: none; padding: 0in"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"> <meta equiv="CONTENT-TYPE" content="text/html; charset=utf-8"> <title></title> <meta name="GENERATOR" content="LibreOffice 3.3 (Unix)"> <style type="text/css"> <!-- @page { margin: 0.79in } P { margin-bottom: 0.08in } A:link { so-language: zxx } --> </style> </span></span></span></span></span></p><p style="margin-bottom: 0in"><span><span><span style="font-size: 9pt">[CentOS-testing]</span></span></span></p><span><span><span> <p style="font-size: 9pt; margin-bottom: 0in; ">name=CentOS-5 Testing</p> <p style="font-size: 9pt; margin-bottom: 0in; ">baseurl=<a href="http://dev.centos.org/centos/5/testing/$basearch/">http://dev.centos.org/centos/5/testing/$basearch</a>/</p> <p style="font-size: 9pt; margin-bottom: 0in; ">enabled=1</p> <p style="font-size: 9pt; margin-bottom: 0in; ">gpgcheck=1</p> <p style="font-size: 9pt; margin-bottom: 0in; ">gpgkey=http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing
<br /><span class="Apple-style-span" style="font-family: 'Liberation Serif', serif; font-size: 32px; font-weight: bold; color: rgb(0, 0, 0); "><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">
<br /></span></span></span></span></span></span></p><p style="font-size: 9pt; margin-bottom: 0in; "><span class="Apple-style-span" ><b>update php:</b></span></p><p style="margin-bottom: 0in; "><span class="Apple-style-span" ><span class="Apple-style-span" style="font-size: 12px;"><meta equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="font-family: monospace; ">yum update php</span></span></span></p><p style="margin-bottom: 0in; "><span class="Apple-style-span" ><span class="Apple-style-span" style="font-size: 12px;"><span class="Apple-style-span" style="font-family: monospace; "><b>
<br /></b></span></span></span></p><p style="margin-bottom: 0in; "><span class="Apple-style-span" ><span class="Apple-style-span" style="font-size: 12px;"><span class="Apple-style-span" style="font-family: monospace; "><b>Restart httpd service:</b></span></span></span></p><p style="margin-bottom: 0in; "><span class="Apple-style-span" ><span class="Apple-style-span" style="font-size: 12px;"><span class="Apple-style-span" style="font-family: monospace; ">service httpd restart</span></span></span></p><p style="font-size: 9pt; margin-bottom: 0in; "><span class="Apple-style-span" style="font-family: 'Liberation Serif', serif; font-size: 32px; font-weight: bold; color: rgb(0, 0, 0); "><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">
<br /></span></span></span></span></span></span></p><p style="font-size: 9pt; margin-bottom: 0in; "><span class="Apple-style-span" style="font-family: 'Liberation Serif', serif; font-size: 32px; font-weight: bold; color: rgb(0, 0, 0); "><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">Access the </span></span></span></span></span><em><span><span style="text-decoration: none"><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">PNP4Nagios Environment Tests</span></span></span></span></span></span></em><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"> by going to </span></span></span></span></span><em><span><span style="text-decoration: none"><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">http://localhost/pnp4nagios</span></span></span></span></span></span></em><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">. If it passes all the tests, remove the </span></span></span></span></span><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">install.php</span></span></span></span></span></code><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"> file:</span></span></span></span></span></span></p></span></span></span><p></p><h1 class="western"> <p style="margin-bottom: 0.16in; border: none; padding: 0in"><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"><span style="background: #eeeeee">mv /usr/local/pnp4nagios/share/install.php /usr/local/pnp4nagios/share/old.install.php</span></span></span></span></span></span></code></p> <p style="margin-bottom: 0.16in; border: none; padding: 0in"><strong><span><span><span style="font-size: 9pt"><span style="font-style: normal">NPCD Daemon</span></span></span></span></strong><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">
<br />
<br />Copy the sample NPCD config file:</span></span></span></span></span></p> <p style="margin-bottom: 0.16in; border: none; padding: 0in"><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"><span style="background: #eeeeee">cp /usr/local/pnp4nagios/etc/npcd.cfg-sample /usr/local/pnp4nagios/etc/npcd.cfg</span></span></span></span></span></span></code></p> <p style="margin-bottom: 0.16in; border: none; padding: 0in"><strong><span><span><span style="font-size: 9pt"><span style="font-style: normal">Data Collection :</span></span></span></span></strong><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">
<br />Nagios needs to be </span></span></span></span></span><a href="http://docs.pnp4nagios.org/pnp-0.6/config" target="_blank"><span><span style="text-decoration: none"><span><span style="font-size: 9pt"><span style="font-style: normal"><b>configured</b></span></span></span></span></span></a><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"> to trigger the data collector by editing </span></span></span></span></span><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">/usr/local/nagios/etc/nagios.cfg</span></span></span></span></span></code><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"> and editing/uncommenting some lines:</span></span></span></span></span></p> <p style="margin-bottom: 0.16in; border: none; padding: 0in"><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"><span style="background: #eeeeee">process_performance_data=1
<br />service_perfdata_command=process-service-perfdata
<br />host_perfdata_command=process-host-perfdata</span></span></span></span></span></span></code></p> <p style="margin-bottom: 0.16in; border: none; padding: 0in"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">Edit </span></span></span></span></span><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">/usr/local/nagios/etc/objects/commands.cfg</span></span></span></span></span></code><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"> and </span></span></span></span></span><strong><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">remove the existing </span></span></span></span></span></strong><em><span><span style="text-decoration: none"><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">process-service-perfdata</span></span></span></span></span></span></em><strong><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"> and </span></span></span></span></span></strong><em><span><span style="text-decoration: none"><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">process-host-perfdata</span></span></span></span></span></span></em><strong><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">commands</span></span></span></span></span></strong><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">. Then add the new PNP4Nagios commands for service and host performance data logging:</span></span></span></span></span></p> <p style="margin-bottom: 0.16in; border: none; padding: 0in"><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"><span style="background: #eeeeee">define command {
<br /> command_name process-service-perfdata
<br /> command_line /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl
<br />}
<br />
<br />define command {
<br /> command_name process-host-perfdata
<br /> command_line /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA
<br />}</span></span></span></span></span></span></code></p> <p style="margin-bottom: 0.16in; border: none; padding: 0in"><strong><span><span><span style="font-size: 9pt"><span style="font-style: normal">Nagios Web Front-End Integration :</span></span></span></span></strong><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">
<br />In order to easily view the graphs from your Nagios server, we can take advantage of Nagios' external URL features in extended info configs. There are two ways of doing it - regular links or Javascript pop-ups:</span></span></span></span></span></p> <p style="margin-bottom: 0in; border: none; padding: 0in"><strong><span><span><span style="font-size: 9pt"><span style="font-style: normal">Regular Links</span></span></span></span></strong><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">
<br /><span class="Apple-style-span" style="font-family: 'Liberation Serif', serif; font-size: 32px; font-weight: bold; color: rgb(0, 0, 0); "><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">Edit </span></span></span></span></span><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">/usr/local/nagios/etc/objects/templates.cfg</span></span></span></span></span></code><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"> and add:</span></span></span></span></span></span></span></span></span></span></span></p><p style="margin-bottom: 0in; border: none; padding: 0in"><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"><span style="background: #eeeeee"># PNP4Nagios host/service definitions
<br />define host {
<br /> name host-pnp
<br /> action_url /pnp4nagios/graph?host=$HOSTNAME$&srv=_HOST_
<br /> register 0
<br />}
<br />
<br />define service {
<br /> name srv-pnp
<br /> action_url /pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$
<br /> register 0
<br />}</span></span></span></span></span></span></code></p> <p style="margin-bottom: 0in; border: none; padding: 0in"><span class="Apple-style-span" style="color: rgb(68, 68, 68); font-family: 'Trebuchet MS', 'Helvetica neue', Helvetica, Arial, Verdana, sans-serif; font-size: 12px; font-weight: normal; ">OR</span></p> <p style="margin-bottom: 0in; border: none; padding: 0in"><strong><span><span><span style="font-size: 9pt"><span style="font-style: normal">Javascript pop-ups :</span></span></span></span></strong><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">
<br />Copy </span></span></span></span></span><em><span><span style="text-decoration: none"><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">status-header.ssi</span></span></span></span></span></span></em><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"> to your Nagios web files:</span></span></span></span></span></p><p style="margin-bottom: 0in; border: none; padding: 0in"><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"><span style="background: #eeeeee">cp /downloads/pnp4nagios-0.6.3/contrib/ssi/status-header.ssi \
<br />/usr/local/nagios/share/ssi/</span></span></span></span></span></span></code></p><p style="margin-bottom: 0in; border: none; padding: 0in"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">Edit </span></span></span></span></span><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal">/usr/local/nagios/etc/objects/templates.cfg</span></span></span></span></span></code><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"> and add:</span></span></span></span></span></p><p style="margin-bottom: 0in; border: none; padding: 0in"><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"><span style="background: #eeeeee">define host {
<br /> name host-pnp
<br /> action_url /pnp4nagios/graph?host=$HOSTNAME$&srv=_HOST_' class='tips' rel='/pnp4nagios/popup?host=$HOSTNAME$&srv=_HOST_
<br /> register 0
<br />}
<br />
<br />define service {
<br /> name srv-pnp
<br /> action_url /pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/popup?host=$HOSTNAME$&srv=$SERVICEDESC$
<br /> register 0
<br />}</span></span></span></span></span></span></code></p> <p style="margin-bottom: 0.16in; border: none; padding: 0in; font-style: normal; font-weight: normal"> <span><span><span style="font-size: 9pt">To use them, add them to your host/service definitions with something similiar to:</span></span></span></p> <p style="margin-bottom: 0.16in; border: none; padding: 0in"><code class="western"><span><span><span style="font-size: 9pt"><span style="font-style: normal"><span style="font-weight: normal"><span style="background: #eeeeee">define host{
<br /> use linux-server,host-pnp ; Name of host templates to use
<br /> ; This host definition will inherit all variables that are defined
<br /> ; in (or inherited by) the linux-server host template definition.
<br /> host_name localhost
<br /> alias localhost
<br /> address 127.0.0.1
<br /> }
<br />
<br />define service{
<br /> use local-service,srv-pnp ; Name of service template to use
<br /> host_name localhost
<br /> service_description PING
<br /> check_command check_ping!100.0,20%!500.0,60%
<br /> }</span></span></span></span></span></span></code></p></h1>Shahnawaz Saifihttp://www.blogger.com/profile/00369616200651338297noreply@blogger.com2tag:blogger.com,1999:blog-3170425554094457896.post-21052827608531764502011-06-01T22:54:00.000-07:002011-06-01T23:46:54.439-07:00SWAP Memory (Creating Swap file)<meta equiv="content-type" content="text/html; charset=utf-8"><p style="color: rgb(51, 51, 51); font-size: 14px; line-height: 22px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 15px; margin-right: 0px; margin-bottom: 18px; margin-left: 0px; "><strong style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="Apple-style-span"></span></strong></p><span><span> <meta equiv="CONTENT-TYPE" content="text/html; charset=utf-8"> <title></title> <meta name="GENERATOR" content="LibreOffice 3.3 (Unix)"> <style type="text/css"> <!-- @page { margin: 0.79in } P { margin-bottom: 0.08in } --> </style> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; widows: 2; orphans: 2"> <span><span><span><b>What is swap?</b></span></span></span></p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2">Swap space is an area on disk that temporarily holds a process memory image. When physical memory demand is sufficiently low, process memory images are brought back into physical memory from the swap area on disk. Having sufficient swap space enables the system to keep some physical memory free at all times.</p> <p align="JUSTIFY" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2">There are three types of swap: device swap, file system swap and pseudo swap. Device swap is a separate partition allocated when the disk is configured. File system swap allows you to use the existing file system to allocate swap space. Pseudo swap is allocated from system memory on some systems.</p> <p align="JUSTIFY" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2"><b>How can I create swap on these machines?</b></p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2">Though we cannot create device swap, we can still create create file system swap. Steps are given below to create swap file:log-in as root and check your existing mounted partitions to create swap file using disk usage utility :</p> <p align="JUSTIFY" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2">[root@shah-lp ~]# df -h</p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2"> <span><span><span>Filesystem Size Used Avail Use% Mounted on </span></span></span></p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2"> <span><span><span>/dev/sda1 9.9G 7.8G 1.6G 84% / </span></span></span></p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2"> <span><span><span>none 7.6G 0 7.6G 0% /dev/shm </span></span></span></p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2"> <span><span><span>/dev/sdb1 414G 32G 362G 8% /share </span></span></span></p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2">As we can see above /dev/sdb1 is mounted at /share and it got enough space to create swap file.</p><p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2">Assume my machine got 4GB physical RAM & 2GB of SWAP. Now we are looking to increase it to 8GB, 6GB more. follow below steps:</p><p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2">[root@shah-lp ~]# dd if=/dev/zero of=/share/swapfile bs=1G count=5</p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2"> <span><span><span>5+0 records in </span></span></span></p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2"> <span><span><span>5+0 records out </span></span></span></p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2"> <span><span><span>5368709120 bytes (5.4 GB) copied, 64.3235 seconds, 83.5 MB/s </span></span></span></p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2">[root@shah-lp ~]# mkswap /share/swapfile</p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2">[root@shah-lp ~]# swapon /share/swapfile</p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2">[root@shah-lp ~]# echo " /share/swapfile swap swap defaults 0 0" >> /etc/fstab</p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2">[root@shah-lp ~]# mount -a</p><p align="LEFT" style="margin-bottom: 0in; widows: 2; orphans: 2">To confirm run :</p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2">[root@shah-lp ~]# free -m</p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2"> <span> <span><span>total used free shared buffers cached </span></span></span></p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2"> <span><span><span>Mem: 15367 11428 3938 0 53 10378 </span></span></span></p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2"> <span><span><span>-/+ buffers/cache: 996 14370 </span></span></span></p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2"> <span><span><span>Swap: 23551 0 23551 </span></span></span></p> <p align="LEFT" style="margin-bottom: 0in; widows: 2; orphans: 2"><span><span><span><span style="font-style: normal"><span style="font-weight: normal">[root@shah-lp ~]# swapon -s</span></span></span></span></span></p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2"> <span> <span><span>total used free shared buffers cached </span></span></span></p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2"> <span><span><span>Mem: 15367 11428 3938 0 53 10378 </span></span></span></p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2"> <span><span><span>-/+ buffers/cache: 996 14370 </span></span></span></p> <p align="LEFT" style="margin-bottom: 0in; font-style: normal; font-weight: normal; widows: 2; orphans: 2"> <span><span><span>Swap: 23551 0 23551 </span></span></span></p>
<br /></span></span><p style="color: rgb(51, 51, 51); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 14px; line-height: 22px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 15px; margin-right: 0px; margin-bottom: 18px; margin-left: 0px; ">
<br /></p>Shahnawaz Saifihttp://www.blogger.com/profile/00369616200651338297noreply@blogger.com0tag:blogger.com,1999:blog-3170425554094457896.post-84239172683735517872011-04-14T04:17:00.000-07:002011-04-18T22:39:40.592-07:00Pre-Commit Hook Script for Subversion<div><div>#!/usr/bin/perl</div><div><br /></div><div>use strict;</div><div># config section</div><div>my $minchars = 4;</div><div>my $svnlook = '/usr/bin/svnlook';</div><div><br /></div><div>#--------------------------------------------</div><div>my $repos = $ARGV[0];</div><div>my $txn = $ARGV[1];</div><div>$\="\n";</div><div>my @comment = `$svnlook log -t "$txn" "$repos"`;</div><div>my @reviewer = ();</div><div>my @unit = ();</div><div>my @tp = ();</div><div>my @reviewer1 = ();</div><div>my @unit1 = ();</div><div>my @tp1 = ();</div><div><br /></div><div>foreach my $line (@comment)</div><div>{ </div><div> chomp($line);</div><div> @reviewer1=split(':', $line) if ($line =~/Reviewer/i);</div><div> @reviewer=split(/\s+/, $reviewer1[1]);</div><div> @unit1=split(':', $line) if ($line =~/Unit/i);</div><div> @unit=split(/\s+/, $unit1[1]);</div><div> @tp1=split(':', $line) if ($line =~/TP/i);</div><div> @tp=split(/\s+/, $tp1[1]);</div><div> </div><div>}</div><div><br /></div><div>if ( length($comment[0]) == 0 ) {</div><div> print STDERR "A comment is required!";</div><div> exit(1);</div><div> }</div><div>if ( $#reviewer == 0 ) {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>print STDERR "A code reviewer is required! e.g. Code reviewer: some text<some value="">";</some></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>exit(1);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>} </div><div>if(!($reviewer[1] =~ /\w/i))</div><div>{</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>print STDERR "A code reviewer name is required! e.g. Code reviewer: some text<some value="">";</some></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>exit(1);</div><div>}</div><div>print $unit[0];</div><div>if ( $#unit == 0 ) {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>print STDERR "A Unit Test is required! e.g. Unit Test: N/A";</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>exit(1);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>} </div><div>if(!($unit[1] =~ /\w/i))</div><div>{</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>print STDERR "A unit test value is required! e.g. Unit Test: N/A";</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>exit(1);</div><div>}</div><div>if ( $#tp == 0 ) {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>print STDERR "A Nature of TP is required! e.g. Nature of change (TP#): some text<some value=""> ";</some></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>exit(1);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>} </div><div>if(!($tp[1] =~ /\w/i))</div><div>{</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>print STDERR "A nature of tp value is required! e.g. Nature of change (TP#): some text<some value="">";</some></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>exit(1);</div><div>}</div><div>exit(0);</div></div>Shahnawaz Saifihttp://www.blogger.com/profile/00369616200651338297noreply@blogger.com0tag:blogger.com,1999:blog-3170425554094457896.post-87994631143789782012011-03-25T11:42:00.000-07:002011-03-25T12:19:08.405-07:00Configuring SAMBA on CentOS/RHEL<span style="font-size:130%;"><span style="font-weight: bold;font-family:arial;" >Configuring Samba on CentOS/RHEL to share data with Windows</span></span><br /><br /><span style="font-size:100%;"><span style="font-family:arial;"></span><span style="font-family:verdana;">suppose we want to share one directory with multiple users e.g. shah and king.</span></span><br /><br /><span style="font-size:85%;"><span style="font-weight: bold;font-family:courier new;" ># groupadd share</span><br /><br /><span style="font-weight: bold;font-family:courier new;" ># useradd -G share shah</span><br /><span style="font-weight: bold;font-family:courier new;" ># useradd -G share king</span><br /><br /><span style="font-weight: bold;font-family:courier new;" ># mkdir /data</span><br /><br /><span style="font-weight: bold;font-family:courier new;" ># chgrp share /data</span><br /><br /><span style="font-weight: bold;font-family:courier new;" ># chmod g+rwx,o-rwx /data</span><br /><br /></span><span style="font-family:verdana;">Now if you are looking to enable group in-inheritance on directory:</span><br /><br /><span style="font-weight: bold;font-size:85%;" ><span style="font-family:courier new;"># chmod g+s /data</span></span><br /><br /><span style="font-family:verdana;">If you want to enable sticky bit to keep data secure from other member of group or you do not want other members to delete sub-content of directory:</span><br /><br /><span style="font-weight: bold;font-family:courier new;font-size:85%;" ># chmod o+s /data</span><br /><br /><span style="font-family:verdana;">Now, install following rpms using Yum:</span><br /><span style=";font-family:courier new;font-size:85%;" ><br /><span style="font-weight: bold;"># yum install samba samba-client samba-common -y</span></span><br /><br /><span style="font-family:verdana;"><br />Edit samba config file:</span><br /><br /><span style="font-weight: bold;font-family:courier new;font-size:85%;" ># vim /etc/samba/smb.conf</span><br /><br /><span style="font-family:verdana;"><br />Put following content:</span><br /><br /><span style="font-weight: bold;font-size:85%;" ><span style="font-family:courier new;">[share] </span><br /><span style="font-family:courier new;">comment = Share Group's Stuff </span><br /><span style="font-family:courier new;">path = /data </span><br /><span style="font-family:courier new;">valid user= shah , king </span><br /><span style="font-family:courier new;">public = yes </span><br /><span style="font-family:courier new;">writable = yes </span><br /><span style="font-family:courier new;">printable = no </span><br /><span style="font-family:courier new;">write list = +staff </span><br /></span><br /><span style="font-family: verdana; font-weight: bold;">Details of Config:</span><br /><br /><span style="font-weight: bold;font-size:85%;" ><span style="font-family:courier new;">[share] - #share name to be visible on windows </span></span><br /><span style="font-weight: bold;font-size:85%;" ><span style="font-family:courier new;">comment - #User prompt message for windows</span></span><br /><span style="font-weight: bold;font-size:85%;" ><span style="font-family:courier new;">valid user - #User name which you want to use for access</span></span><br /><span style="font-weight: bold;font-size:85%;" ><span style="font-family:courier new;">path - #Path of dir which you are looking to share</span></span><br /><span style="font-weight: bold;font-size:85%;" ><span style="font-family:courier new;">public - #share should be visible to other users</span></span><br /><span style="font-weight: bold;font-size:85%;" ><span style="font-family:courier new;">writable - #User should allowed to write from windows or smb shell</span></span><br /><span style="font-weight: bold;font-size:85%;" ><span style="font-family:courier new;">printable - #It is a share not printer</span></span><br /><span style="font-weight: bold;font-size:85%;" ><span style="font-family:courier new;">write list - #list of users or group who is allowed to write on share</span></span><br /><br /><br /><span style="font-family:verdana;"> Search for </span>"<span style="font-family:courier new;">hosts allow</span>" <span style="font-family:verdana;">in </span><span style="font-family:courier new;">smb.conf </span><span style="font-family:verdana;">to define hosts access :</span><br /><br /><span style="font-weight: bold;font-size:85%;" ><span style="font-family:courier new;"> hosts allow = 127. 192.168.12. 192.168.13. 192.168.1.20</span></span><br /><br /><span style="font-family:verdana;">Save and close the file. And define samba user's passwords:</span><br /><br /><span style=";font-family:courier new;font-size:85%;" ><span style="font-weight: bold;"># smbpasswd -a shah</span><br /><br /><span style="font-weight: bold;"># smbpasswd -a king</span><br /><br /></span><br /><span style="font-family:verdana;">Start samba service:</span><br /><br /><span style="font-weight: bold;font-family:courier new;font-size:85%;" ># service smb start</span><br /><br /><span style="font-family:verdana;">Enable samba service at boot-up:</span><br /><br /><span style="font-weight: bold;font-family:courier new;font-size:85%;" ># chkconfig smb on</span><br /><br /><span style="font-family:verdana;">To verify shared dir or config:</span><br /><br /><span style="font-weight: bold;font-family:courier new;font-size:85%;" ># testparm</span><br /><br /><span style="font-family:verdana;">Now access share on windows:</span><br /><span style=";font-family:courier new;font-size:85%;" ><br /><span style="font-weight: bold;">Windows--> run --> \\smb-server_or_ip.ad.dr.ess</span></span><br /><br /><span style="font-family:trebuchet ms;">It will prompt for the user/password. Enter ;) and have fun.</span>Shahnawaz Saifihttp://www.blogger.com/profile/00369616200651338297noreply@blogger.com0tag:blogger.com,1999:blog-3170425554094457896.post-31857431287921650772011-01-14T02:03:00.000-08:002011-01-14T02:44:31.579-08:00Apache and Subversion authentication with Microsoft Active Directory<span style="font-weight: bold;font-family:verdana;" >Apache and Subversion authentication with Microsoft Active Directory on CentOS:</span><br /><br /><span style=";font-family:verdana;font-size:100%;" >1) Create an user account on AD as <span style="font-size:85%;">ldapbind </span>under <span style="font-size:85%;">Users </span>OU<br /><br />2) On CentOS Box, Install following packages:<br /><br /><span style="font-weight: bold;font-size:85%;" > # yum install httpd subversion openldap openssl mod_dav_svn mod_authz_svn mod_ssl</span><br /><br />3) Create a repo:<br /><br /><span style="font-size:85%;"> # svnadmin create /svn/repo1</span><br /><br />4) Edit <span style="font-size:85%;">/etc/httpd/conf.d/subversion.conf</span> file with following parameters:<br /><br /><span style="font-weight: bold;"> </span><span style="font-weight: bold;font-size:85%;" ># vim /etc/httpd/conf.d/subversion.conf</span></span><span style=";font-family:verdana;font-size:85%;" ><br /><location><br /><(Location /svn)><location><location><br /> <location>DAV svn<br />SVNParentPath /svn<br />AuthBasicProvider ldap<br />AuthType Basic<br />AuthzLDAPAuthoritative off<br />AuthName "My Subversion Server"<br />AuthLDAPURL "ldap://server.example.com:389/DC=example,DC=com?sAMAccountName?sub?(objectClass=*)"<br />AuthLDAPBindDN "ldapbind@example.com"<br />AuthLDAPBindPassword "password"<br />require valid-user<br />Order allow,deny<br />AllowOverride None<br />Allow from all<br /></location></location></location></location></span><span style="font-size:85%;"><span style="font-family:verdana;">< / L o c a t i o n ></span></span><br /><br /><br /><span style="font-family:verdana;">5) Edit <span style="font-weight: bold;font-size:85%;" >/etc/openldap/ldap.conf</span> :</span><br /><span style="font-family:verdana;"> </span><br /><span style="font-family:verdana;"> <span style="font-size:85%;"> REFERRALS off</span></span><br /><br /><span style="font-family:verdana;">6) Restart httpd service and try to access on UI: </span><br /><br /><span style="font-size:85%;"><span style="font-family:verdana;"> # service httpd start</span><br /><span style="font-family:verdana;"> # chkconfig httpd on<br /><br /></span></span><span style="font-family:verdana;">7) Access on UI: <span style="font-weight: bold;font-size:85%;" >https://example.com/svn/repo1</span> </span>Shahnawaz Saifihttp://www.blogger.com/profile/00369616200651338297noreply@blogger.com0tag:blogger.com,1999:blog-3170425554094457896.post-64584334195560473752010-12-29T04:11:00.000-08:002010-12-29T04:26:14.753-08:00NDOUtils installation on CentOS for Nagios<!--[if gte mso 9]><xml> <w:worddocument> <w:view>Normal</w:View> <w:zoom>0</w:Zoom> <w:trackmoves/> <w:trackformatting/> <w:punctuationkerning/> <w:validateagainstschemas/> <w:saveifxmlinvalid>false</w:SaveIfXMLInvalid> <w:ignoremixedcontent>false</w:IgnoreMixedContent> <w:alwaysshowplaceholdertext>false</w:AlwaysShowPlaceholderText> <w:donotpromoteqf/> <w:lidthemeother>EN-US</w:LidThemeOther> <w:lidthemeasian>X-NONE</w:LidThemeAsian> <w:lidthemecomplexscript>X-NONE</w:LidThemeComplexScript> <w:compatibility> <w:breakwrappedtables/> <w:snaptogridincell/> <w:wraptextwithpunct/> <w:useasianbreakrules/> <w:dontgrowautofit/> <w:splitpgbreakandparamark/> <w:enableopentypekerning/> <w:dontflipmirrorindents/> <w:overridetablestylehps/> <w:usefelayout/> </w:Compatibility> <m:mathpr> <m:mathfont val="Cambria Math"> <m:brkbin val="before"> <m:brkbinsub val="--"> <m:smallfrac val="off"> <m:dispdef/> <m:lmargin val="0"> <m:rmargin val="0"> <m:defjc val="centerGroup"> <m:wrapindent val="1440"> <m:intlim val="subSup"> <m:narylim val="undOvr"> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"> <w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"> <w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"> <w:lsdexception locked="false" priority="39" name="toc 1"> <w:lsdexception locked="false" priority="39" name="toc 2"> <w:lsdexception locked="false" priority="39" name="toc 3"> <w:lsdexception locked="false" priority="39" name="toc 4"> <w:lsdexception locked="false" priority="39" name="toc 5"> <w:lsdexception locked="false" priority="39" name="toc 6"> <w:lsdexception locked="false" priority="39" name="toc 7"> <w:lsdexception locked="false" priority="39" name="toc 8"> <w:lsdexception locked="false" priority="39" name="toc 9"> <w:lsdexception locked="false" priority="35" qformat="true" name="caption"> <w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"> <w:lsdexception locked="false" priority="1" name="Default Paragraph Font"> <w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"> <w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"> <w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"> <w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"> <w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"> <w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"> <w:lsdexception locked="false" unhidewhenused="false" name="Revision"> <w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"> <w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"> <w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"> <w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"> <w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"> <w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"> <w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"> <w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"> <w:lsdexception locked="false" priority="37" name="Bibliography"> <w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"> </w:LatentStyles> </xml><![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} </style> <![endif]--> <div style="border-width: medium medium 1pt; border-style: none none solid; border-color: -moz-use-text-color -moz-use-text-color rgb(79, 129, 189); padding: 0in 0in 4pt; color: rgb(0, 0, 102); font-weight: bold; font-family: verdana;"> <p class="MsoTitle"><span style="">NDOUtils installation on CentOS</span></p> </div> <p style="font-family: verdana;" class="MsoSubtitle"><span style=";font-size:100%;" >NDOUtils Requirements</span></p> <ul style="font-family: courier new;" type="disc"><li class="MsoNormal" style="line-height: normal;"><span style=";font-size:100%;" >GCC-C++ </span></li><li class="MsoNormal" style="line-height: normal;"><span style=";font-size:100%;" >MySQL </span></li><li class="MsoNormal" style="line-height: normal;"><span style=";font-size:100%;" >MySQL-Devel </span></li><li class="MsoNormal" style="line-height: normal;"><span style=";font-size:100%;" >MySQL-Server </span></li></ul> <p class="MsoSubtitle"><a name="Installing_MySQL"></a><span style=""><span style=""> </span>Installing MySQL</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># yum -y install mysql mysql-devel mysql-server gcc-c++</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># /etc/init.d/mysqld start</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># chkconfig --add mysqld</span></p> <p class="MsoNormal" style="line-height: normal;"><span style=";font-family:";font-size:100%;" ><br /></span></p><p class="MsoNormal" style="line-height: normal;"><span style=";font-family:";font-size:100%;" >-> make sure it's running </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># ps -ef | grep mysql</span></p> <p class="MsoSubtitle"><a name="Creating_MySQL_DB"></a><span style=""> </span></p> <p class="MsoSubtitle"><span style=""><br /></span></p><p class="MsoSubtitle"><span style="">-> Creating MySQL DB</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >mysql -u root</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >(no password</span></p> <p class="MsoNormal" style="line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >#Now, inside MySQL shell </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >mysql>create database nagios;</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" > </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >Query OK, 1 row affected (0.00 sec)</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >mysql>show databases;</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" > </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >+----------+</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >| Database |</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >+----------+</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >| database |</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >| mysql<span style=""> </span>|</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >| nagios<span style=""> </span>|</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >| test<span style=""> </span>|</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >+----------+</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >4 rows in set (0.01 sec)</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" > </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >mysql></span></p> <p class="MsoNormal" style="line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >Create a username/password that has at least the following privileges for the database: SELECT, INSERT, UPDATE, DELETE" </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >mysql> GRANT ALL ON nagios.* TO nagios@localhost IDENTIFIED BY "example";</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >Query OK, 0 rows affected (0.00 sec)</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" > </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >mysql> FLUSH PRIVILEGES;</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >Query OK, 0 rows affected (0.00 sec)</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" > </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >mysql> quit</span></p> <p class="MsoSubtitle"><a name="NDOUtils_Install"></a><span style=""><br /></span></p><p style="font-family: arial; font-weight: bold;" class="MsoSubtitle"><span style="">-> NDOUtils Install</span></p> <p class="MsoNormal" style="line-height: normal; font-weight: bold;"><a name="Download_and_untar"></a><span class="MsoSubtleEmphasis">Download and untar</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># cd /usr/local/nagios/var/</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># wget http://internap.dl.sourceforge.net/sourceforge/nagios/ndoutils-1.4b9.tar.gz</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># tar zxfv ndoutils-1.4b9.tar.gz</span></p> <p style="font-family: arial; font-weight: bold;" class="MsoSubtitle"><br /></p><p style="font-family: arial; font-weight: bold;" class="MsoSubtitle">-> <span style="font-family: courier new;font-size:100%;" ><a name="Compiling"></a></span><span style="">Compiling</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># cd ndoutils-1.4b9</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># ./configure</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># make</span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" ><br /></span></p><p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" >Look through config.log for problems. </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># less config.log</span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" >(If problems, run "make clean" to blow away bad binaries) </span></p> <p style="font-family: arial; font-weight: bold;" class="MsoSubtitle"><br /></p><p style="font-family: arial; font-weight: bold;" class="MsoSubtitle">-> <span style="font-size:100%;"><a name="Copying_Binaries"></a></span><span style="">Copying Binaries</span></p> <p class="MsoNormal" style="line-height: normal;"><span style="font-size:100%;"><a name="ndomod"></a><b><span style=";font-family:";" ><span style=""> </span>ndomod</span></b></span></p> <p class="MsoNormal" style="line-height: normal;"><span style=";font-family:";font-size:100%;" >There are two different versions of the NDOMOD module that get compiled, so make sure you use the module that matches the version of Nagios you are running, and adjust the directions given below to fit the name of the module version you're using. </span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" >ndomod-2x.o = NDOMOD module for Nagios 2.x ndomod-3x.o = NDOMOD module for Nagios 3.x (unstable) </span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" >In our CentOS example, we use the stable 2.x version </span></p> <p class="MsoNormal" style="line-height: normal; font-family: courier new; font-weight: bold;"><span style=";font-size:100%;" ># /</span><span style=";font-size:100%;" >usr/local/nagios/var/ndoutils-1.4b9/src/ndomod-2x.o</span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" >Copy the compiled NDOMOD module to your Nagios installation: </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># cp </span><span style=";font-size:100%;" >/</span><span style=";font-size:100%;" >usr/local/nagios/var/ndoutils-1.4b9/src/ndomod-3x.o /usr/local/nagios/bin/ndomod.o</span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style="font-size:100%;"><b><span style="">ndo2db</span></b></span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" >There are two different versions of the NDO2DB daemon that get compiled, so make sure you use the daemon that matches the version of Nagios you are running, and adjust the directions given below to fit the name of the daemon you're using. </span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" >ndo2db-2x.o = NDO2DB daemon for Nagios 2.x ndo2db-3x.o = NDO2DB daemon for Nagios 3.x (unstable) </span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" >Copy the compiled NDO2DB daemon to your Nagios installation: </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># cp </span><span style=";font-size:100%;" >/</span><span style=";font-size:100%;" >usr/local/nagios/var/ndoutils-1.4b9/src/ndo2db-2x </span><span style=";font-size:100%;" >/</span><span style=";font-size:100%;" >usr/local/nagios/bin/ndo2db</span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" ><span style=""> </span></span></p> <p style="font-family: arial; font-weight: bold;" class="MsoSubtitle"><span style="font-size:100%;"><a name="Creating_NDO_database"></a></span><span style=";font-size:100%;" >-> Creating NDO database</span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" >It's time now to create the NDO MySql database Run the DB installation script in the /tmp/ndoutils-1.4b9/db/ subdirectory of the NDO distribution to create the necessary tables in the database. </span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" >(-u = user; -p = password; -h = name of computer; -d = MySQL DB) </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: georgia;"><span style=";font-size:100%;" ># cd </span><span style=";font-size:100%;" >/</span><span style=";font-size:100%;" >usr/local/nagios/var/ndoutils-1.4b9/db</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># ./installdb -u nagios -p password -h localhost -d nagios</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: arial;"><span style=";font-size:100%;" >DBD::mysql::db do failed: Table 'nagios.nagios_dbversion' doesn't exist at ./installdb line 51.</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: arial;"><span style=";font-size:100%;" >** Creating tables for version 1.4b9</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: arial;"><span style=";font-size:100%;" ><span style=""> </span>Using mysql.sql for installation...</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: arial;"><span style=";font-size:100%;" >** Updating table nagios_dbversion</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: arial;"><span style=";font-size:100%;" >Done!</span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" >We'll need to later make sure that the database name, prefix, and username/password we created and setup match the variable specified in our NDO2DB config file (which will ultimately live in /etc/nagios/) </span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" > </span></p> <p style="font-family: arial;" class="MsoSubtitle"><span style="font-size:100%;"><a name="CFG_File_Changes_for_CentOS-MySQL_Enviro"></a></span><span style=";font-size:100%;" >CFG File Changes for CentOS-MySQL Environment</span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style="font-size:100%;"><a name="ndo2db.cfg"></a><b><span style="">ndo2db.cfg</span></b></span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># cp /</span><span style=";font-size:100%;" >/</span><span style=";font-size:100%;" >usr/local/nagios/var/ndoutils-1.4b9/config/ndo2db.cfg /usr/local/nagios/etc/</span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" ><br /></span></p><p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" >->in ndo2db.cfg </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># SOCKET TYPE</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># This option determines what type of socket the daemon will create</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># an accept connections from.</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># Value:</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >#<span style=""> </span>unix = Unix domain socket (default)</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >#<span style=""> </span>tcp<span style=""> </span>= TCP socket</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" > </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >socket_type=unix</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >#socket_type=tcp</span></p> <p class="MsoNormal" style="line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >. . . </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># SOCKET NAME</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># This option determines the name and path of the UNIX domain </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># socket that the daemon will create and accept connections from.</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># This option is only valid if the socket type specified above</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># is "unix".</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" > </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >socket_name=/usr/local/nagios/var/ndo.sock</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >#socket_name=/var/run/nagios/ndo.sock</span></p> <p class="MsoNormal" style="line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >. . . </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># DATABASE USERNAME/PASSWORD</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># This is the username/password that will be used to authenticate to the DB.</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># The user needs at least SELECT, INSERT, UPDATE, and DELETE privileges on</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># the database.</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" > </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" > </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >#db_user=ndouser</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >#db_pass=ndopassword</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >db_user=nagios</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >db_pass=password</span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style="font-size:100%;"><b><span style="">ndomod.cfg</span></b></span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" >Copy the sample NDOMOD config file to your Nagios installation </span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" ><span style=""> </span>Note: this config is not ready yet; we will need to modify it later to our environment. </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># cp /</span><span style=";font-size:100%;" >/</span><span style=";font-size:100%;" >usr/local/nagios/var/ndoutils-1.4b9/config/ndomod.cfg /usr/local/nagios/etc/</span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" >Add a line similiar to the following to the *main* Nagios config file (usually /usr/local/nagios/etc/nagios.cfg): </span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" >nagios.cfg file (all one one line, this cfg_file!=confg_file variable) </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg</span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" ><br />The config directive above will cause Nagios to load the NDOMOD event broker the next time it starts. Of course, this requres that you compiled Nagios with support for the event broker in the first place, which is not a problem if we installed via package (via RPMforge repository). </span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" >Make sure you have a line similar to the following in the *main* Nagios config file (usually<span style="font-family: courier new;"> /usr/local/nagios/etc/nagios.cfg</span>): </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: arial;"><span style=";font-size:100%;" ><span style=""> </span><span style="font-family: courier new;">event_broker_options=-1</span></span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" >That directive will cause the Nagios daemon to send data to the NDOMOD module. Without that option, NDOMOD won't get any information. Finaly make sure that output parameter in ndomod.cfg is set up to </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >output=//usr/local/nagios/var/ndo.sock</span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" >It's very important that <i>output</i> parameter has exactly the same value as <i>socket_name</i> parameter in ndo2db.cfg file. If not, you will get this message when starting nagios daemon. </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: arial;"><span style=";font-size:100%;" >[1192222122] ndomod: Error writing to data sink!<span style=""> </span>Some output may get lost...</span></p> <p style="font-family: arial;" class="MsoSubtitle"><span style="font-size:100%;"><a name="Start_NDO2DB_daemon"></a></span><span style=";font-size:100%;" ><span style=""> </span>Start NDO2DB daemon</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># /usr/local/nagios/bin/ndo2db -c /usr/local/Nagios/etc/nagios/ndo2db.cfg</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >[root@localhost nagios]# ps -ef | grep ndo2db</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >nagios<span style=""> </span>26516<span style=""> </span>1<span style=""> </span>0 19:36 ?<span style=""> </span>00:00:00 ndo2db -c /etc/nagios/ndo2db.cfg</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >root<span style=""> </span>26536 26460<span style=""> </span>0 19:40 pts/0<span style=""> </span>00:00:00 grep ndo</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new; font-weight: bold;"><span style=";font-size:100%;" >[root@localhost nagios]#</span></p> <p class="MsoNormal" style="line-height: normal; font-family: courier new;"><span style=";font-size:100%;" >restart Nagios </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># /etc/init.d/nagios restart</span></p> <p class="MsoNormal" style="line-height: normal; font-family: arial;"><span style=";font-size:100%;" >Proof it's working: </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: courier new;"><span style=";font-size:100%;" ># tail /var/log/nagios/nagios.log</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: arial;"><span style=";font-size:100%;" >[1192222138] ndomod: Successfully reconnected to data sink!<span style=""> </span>0 items lost, 68 queued items to flush.</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: arial;"><span style=";font-size:100%;" >[1192222138] ndomod: Successfully flushed 68 queued items to data sink.</span></p> <p class="MsoNormal"> </p>Shahnawaz Saifihttp://www.blogger.com/profile/00369616200651338297noreply@blogger.com0tag:blogger.com,1999:blog-3170425554094457896.post-78545342009173956272010-12-29T04:06:00.000-08:002010-12-29T04:10:21.525-08:00Nagios and nrpe setup CentOs<span style="font-weight: bold; font-family: verdana;"></span><!--[if gte mso 9]><xml> <o:officedocumentsettings> <o:allowpng/> </o:OfficeDocumentSettings> </xml><![endif]--><!--[if gte mso 9]><xml> <w:worddocument> <w:view>Normal</w:View> <w:zoom>0</w:Zoom> <w:trackmoves/> <w:trackformatting/> <w:punctuationkerning/> <w:validateagainstschemas/> <w:saveifxmlinvalid>false</w:SaveIfXMLInvalid> <w:ignoremixedcontent>false</w:IgnoreMixedContent> <w:alwaysshowplaceholdertext>false</w:AlwaysShowPlaceholderText> <w:donotpromoteqf/> <w:lidthemeother>EN-US</w:LidThemeOther> <w:lidthemeasian>X-NONE</w:LidThemeAsian> <w:lidthemecomplexscript>X-NONE</w:LidThemeComplexScript> <w:compatibility> <w:breakwrappedtables/> <w:snaptogridincell/> <w:wraptextwithpunct/> <w:useasianbreakrules/> <w:dontgrowautofit/> <w:splitpgbreakandparamark/> <w:enableopentypekerning/> <w:dontflipmirrorindents/> <w:overridetablestylehps/> </w:Compatibility> <m:mathpr> <m:mathfont val="Cambria Math"> <m:brkbin val="before"> <m:brkbinsub val="--"> <m:smallfrac val="off"> <m:dispdef/> <m:lmargin val="0"> <m:rmargin val="0"> <m:defjc val="centerGroup"> <m:wrapindent val="1440"> <m:intlim val="subSup"> <m:narylim val="undOvr"> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"> <w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"> <w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"> <w:lsdexception locked="false" priority="39" name="toc 1"> <w:lsdexception locked="false" priority="39" name="toc 2"> <w:lsdexception locked="false" priority="39" name="toc 3"> <w:lsdexception locked="false" priority="39" name="toc 4"> <w:lsdexception locked="false" priority="39" name="toc 5"> <w:lsdexception locked="false" priority="39" name="toc 6"> <w:lsdexception locked="false" priority="39" name="toc 7"> <w:lsdexception locked="false" priority="39" name="toc 8"> <w:lsdexception locked="false" priority="39" name="toc 9"> <w:lsdexception locked="false" priority="35" qformat="true" name="caption"> <w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"> <w:lsdexception locked="false" priority="1" name="Default Paragraph Font"> <w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"> <w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"> <w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"> <w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"> <w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"> <w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"> <w:lsdexception locked="false" unhidewhenused="false" name="Revision"> <w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"> <w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"> <w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"> <w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"> <w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"> <w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"> <w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"> <w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"> <w:lsdexception locked="false" priority="37" name="Bibliography"> <w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"> </w:LatentStyles> </xml><![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} </style> <![endif]--> <h3><u style=""><span style="font-family: "Arial","sans-serif"; color: rgb(51, 51, 51);">Nagios and nrpe setup CentOs 5.3</span></u><span style="font-family: "Arial","sans-serif"; color: rgb(51, 51, 51);"> :</span></h3> <h3><span style="font-family: "Calibri","sans-serif"; color: rgb(51, 51, 51);">Nagios/nrpe how to :</span></h3> <p class="MsoNormal" style="line-height: normal;"><span style="font-size: 12pt;">For this session, I am demonstrating a basic Nagios set up of nrpe.</span></p> <p class="MsoNormal" style="line-height: normal;"><span style="font-size: 12pt;">There are two hosts involved.<br />1. The nagios host. (the master node; where the nagios web ui is)<br />2. The remote host (the node you want to monitor remotely from the master node)</span></p> <p class="MsoNormal" style="line-height: normal;"><span style="font-size: 12pt;">Software Versions involved:<br />both hosts: CentOS release 5.3 (Final) (64 bit)</span></p> <p class="MsoNormal" style="line-height: normal;"><b><span style="font-size: 12pt;">master node:</span></b><span style="font-size: 12pt;"><br /></span><span style="font-size: 12pt; font-family: "Times New Roman","serif";">Nagios® Core™ Version 3.2.0<br />nagios.x86_64 3.2.0-1.el5.rf (yum install)</span></p> <p class="MsoNormal" style="line-height: normal;"><b><span style="font-size: 12pt;">remote host:</span></b><span style="font-size: 12pt;"><br /></span><span style="font-size: 12pt; font-family: "Times New Roman","serif";">nagios-nrpe.x86_64 2.12-1.el5.rf (yum install)</span></p> <p class="MsoNormal" style="line-height: normal;"><span style="font-size: 12pt; font-family: "Times New Roman","serif";">(I assume you have a basic nagios set up already - this is just to enable nrpe)</span></p> <p class="MsoNormal" style="line-height: normal;"><b><span style="font-size: 12pt;">nagios host: (master)</span></b><span style="font-size: 12pt;"></span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">$ sudo yum install nagios-plugins-nrpe<span style=""> </span>nrpe</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">$ sudo chown nagios.nagios /etc/nagios/nrpe.cfg</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">$ sudo vi<span style=""> </span>/etc/nagios/objects/commands.cfg</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"># add</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">define command{</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span>command_name<span style=""> </span>check_nrpe</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span>command_line<span style=""> </span>$USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">}</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"> </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">$ sudo vi /etc/nagios/objects/myremote_host.cfg</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"># add</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">define service{</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span>use<span style=""> </span><span style=""> </span>remote-service</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span>host_name<span style=""> </span>example.com</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span>service_description<span style=""> </span>Check Remote Users</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span>check_command<span style=""> </span>check_nrpe!check_users</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">}</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"># nrpe (remote checks) syntax is check_nrpe(as defined above) ! 'command to</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span>run' (as defined on remote host, see below)</span></p> <p class="MsoNormal" style="line-height: normal;"><b><span style="font-size: 12pt;">remote host: (node to be remotely monitored)</span></b><span style="font-size: 12pt; font-family: "Times New Roman","serif";"><br /><i>(NOTE: nagios itself should not be installed on this host)</i></span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">$ sudo yum install nagios-nrpe</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">$ cd /etc/nagios</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">$ sudo chown nagios.nagios *.cfg</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">$ sudo vim /etc/xinetd.d/nrpe</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"># add</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">service nrpe</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">{</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span>flags<span style=""> </span>= REUSE</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span>type<span style=""> </span>= UNLISTED</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span>port<span style=""> </span>= 5666</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span>socket_type<span style=""> </span>= stream</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span>wait<span style=""> </span>= no</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span>user<span style=""> </span>= nagios</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span>group<span style=""> </span>= nagios</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span>server<span style=""> </span>= /usr/sbin/nrpe</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span>server_args<span style=""> </span>= -c /etc/nagios/nrpe.cfg --inetd</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span>log_on_failure<span style=""> </span>+= USERID</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span>disable<span style=""> </span>= no<span style=""> </span># was yes</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span>only_from<span style=""> </span>= NAGIOS_MASTER_IP (master nagios host you want to</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">connect from) # was localhost</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">}</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">$ sudo vim cat /etc/hosts.allow</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"># add same ip from xinetd above</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">NAGIOS_MASTER_IP</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"> </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">$ sudo vim<span style=""> </span>/etc/nagios/nrpe.cfg</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">#allowed_hosts=127.0.0.1<span style=""> </span>#</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"># add same ip from xinetd above</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">allowed_hosts=NAGIOS_MASTER_IP<span style=""> </span></span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"> </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">$ sudo vim /etc/services</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"># append this line to the file</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"># Local services</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">nrpe<span style=""> </span>5666/tcp<span style=""> </span># nrpe (nagios)</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">$ sudo /sbin/service nrpe start</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">Starting Nagios NRPE daemon (nrpe):<span style=""> </span>[<span style=""> </span>OK<span style=""> </span>]</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">$ sudo /etc/init.d/xinetd reload</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">$ sudo /sbin/chkconfig --list |grep nrpe</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">nrpe<span style=""> </span><span style=""> </span>0:off<span style=""> </span>1:off<span style=""> </span>2:off<span style=""> </span>3:off<span style=""> </span>4:off<span style=""> </span>5:off<span style=""> </span>6:off</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span>nrpe:<span style=""> </span><span style=""> </span>off</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">$ sudo /sbin/chkconfig --levels 35 nrpe on</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">$ sudo /sbin/chkconfig --list |grep nrpe</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">nrpe<span style=""> </span><span style=""> </span>0:off<span style=""> </span>1:off<span style=""> </span>2:off<span style=""> </span>3:on<span style=""> </span>4:off<span style=""> </span>5:on<span style=""> </span>6:off</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span>nrpe:<span style=""> </span><span style=""> </span>off</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"> </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">$ netstat -an | grep 5666</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">tcp<span style=""> </span>0<span style=""> </span>0 0.0.0.0:5666<span style=""> </span>0.0.0.0:*<span style=""> </span>LISTEN</span></p> <p class="MsoNormal" style="line-height: normal;"><span style="font-size: 12pt; font-family: "Times New Roman","serif";">ok, good, it's running</span></p> <p class="MsoNormal" style="line-height: normal;"><b><span style="font-size: 12pt;">now from nagios (master) server: </span></b><span style="font-size: 12pt;"><br /></span><i><span style="font-size: 12pt; font-family: "Times New Roman","serif";">(can we see it's running too?)</span></i><span style="font-size: 12pt; font-family: "Times New Roman","serif";"><br /></span><span style="font-size: 10pt; font-family: "Courier New";">telnet REMOTE_HOST_WE_JUST_CONFIGURED_IP 5666</span><span style="font-size: 12pt; font-family: "Times New Roman","serif";"></span></p> <p class="MsoNormal" style="line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">$ /usr/lib64/nagios/plugins/check_nrpe -H REMOTE_HOST_WE_JUST_CONFIGURED_IP -p5666 -c check_disk1</span><span style="font-size: 12pt; font-family: "Times New Roman","serif";"></span></p> <p class="MsoNormal" style="line-height: normal;"><span style="font-size: 12pt; font-family: "Times New Roman","serif";">to add new commands to be run via nrpe, we must add those to the remote host, nrpe.cfg file:</span></p> <p class="MsoNormal" style="line-height: normal;"><b><span style="font-size: 12pt;">added new test on remote host:</span></b><span style="font-size: 12pt;"><br /></span><span style="font-size: 10pt; font-family: "Courier New";">$ sudo vim /etc/nagios/nrpe.cfg<br />command[check_mapper]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda5</span><span style="font-size: 12pt; font-family: "Times New Roman","serif";"></span></p> <p class="MsoNormal" style="line-height: normal;"><b><span style="font-size: 12pt;">test from master node:</span></b><span style="font-size: 12pt;"><br /></span><span style="font-size: 10pt; font-family: "Courier New";">$ /usr/lib64/nagios/plugins/check_nrpe -H REMOTE_HOST_WE_JUST_CONFIGURED_IP -p5666 -c check_mapper<br />DISK OK - free space: / 41180 MB (50% inode=99%);| /=40614MB;68993;77617;0;86242</span><span style="font-size: 12pt; font-family: "Times New Roman","serif";"></span></p> <p class="MsoNormal" style="line-height: normal;"><i><span style="font-size: 12pt;">helpful master node commands:</span></i><span style="font-size: 12pt;"><br /><i>server config test:</i><br /></span><span style="font-size: 10pt; font-family: "Courier New";">$ sudo /usr/bin/nagios -v /etc/nagios/nagios.cfg<br />#start/stop/restart:<br />$ sudo /sbin/service nagios restart<br />#command line check commands against remote host:<br />$ /usr/lib64/nagios/plugins/check_nrpe -H REMOTE_SERVER_IP -p5666 -c check_disk1</span><span style="font-size: 12pt; font-family: "Times New Roman","serif";"></span></p> <p class="MsoNormal"> </p>Shahnawaz Saifihttp://www.blogger.com/profile/00369616200651338297noreply@blogger.com0tag:blogger.com,1999:blog-3170425554094457896.post-69342487349941180612010-12-15T01:05:00.000-08:002010-12-15T01:10:54.457-08:00Installing Nagios on CentOS1. First we make sure these prerequisites are installed and up to date<br />Run these commands from a command line: <br />-> yum install httpd <br />-> yum install gcc <br />-> yum install glibc glibc-common <br />-> yum install gd gd-devel<br /><br />2. Elevate to root<br />From command line: <br />-> su -<br /><br />3. Create a new nagios user account and give it a password <br />From command line: <br />-> /usr/sbin/useradd -m nagios <br />-> passwd nagios <br />Type the new password twice.<br /><br />4.Create a new nagcmd group for external commands<br />From Command line: <br />-> /usr/sbin/groupadd nagcmd <br />-> /usr/sbin/usermod -a -G nagcmd nagios <br />-> /usr/sbin/usermod -a -G nagcmd apache<br /><br />5. Create a directory to install Nagios <br />From command line: <br />-> mkdir downloads <br />-> cd dowloads/<br /><br />6. Download source code from http://www.nagios.org/download/ <br />These commands will download version 3.2.0 of the Core Nagios files and version 1.4.13 of the Nagios plugins. <br />From command line: <br />-> wget http://downloads.sourceforge.net/project/nagios/nagios-3.x/nagios-3.2.0/nagios-3.2.0.tar.gz?use_mirror=softlayer <br />-> wget http://downloads.sourceforge.net/project/nagiosplug/nagiosplug/1.4.13/nagios-plugins-1.4.13.tar.gz?use_mirror=softlayer<br /><br />7. Extract and compile nagios-3.0.6.tar.gz<br />From Command line: <br />-> tar -xzvf nagios-3.0.6.tar.gz <br />-> cd nagios-3.0.6 <br />-> ./configure --with-command-group=nagcmd <br />-> make all <br />-> make install <br />-> make install-init <br />-> make install-config <br />-> make install-commandmode<br /><br />8. Edit the /usr/local/nagios/etc/objects/contacts.cfg config file. Change the email address associated with the nagiosadmin contact to the address you'd like to use for receiving alerts.<br />From command line: <br />-> vi /usr/local/nagios/etc/objects/contacts.cfg<br /><br />9. Install the Nagios web config file in the Apache conf.d directory<br />From command line: <br />-> make install-webconf<br /><br />10. Create a nagiosadmin account for logging into the Nagios web interface<br />From command line: <br />-> htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin<br /><br />11. Restart Apache <br />From command line: <br />-> service httpd restart<br /><br />12. Compile and Install the Nagios Plugins<br />From command line: <br />-> cd downloads/ <br />-> tar xzf nagios-plugins-1.4.11.tar.gz <br />-> cd nagios-plugins-1.4.11 <br />-> ./configure --with-nagios-user=nagios --with-nagios-group=nagios <br />-> make <br />-> make install<br /><br />13. Add Nagios to the list of system services<br />From command line: <br />-> chkconfig --add nagios <br />-> chkconfig nagios on<br /><br />14. Check for config errors<br />From command line: <br />-> /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg<br /><br />15. Start Nagios<br />From command line: <br />-> service nagios start<br /><br />16. Login to the Web Interface using username (nagiosadmin) and password you specified earlier <br />From your internet browser navigate to the following URL: <br />http://<your server name or IP>/nagiosShahnawaz Saifihttp://www.blogger.com/profile/00369616200651338297noreply@blogger.com1tag:blogger.com,1999:blog-3170425554094457896.post-15575561396396976362010-08-21T07:51:00.000-07:002010-08-21T07:57:45.505-07:00Configuring BIND on CentOS 51. Install packages :<br />yum install bind bind-chroot bind-libs bind-utils caching-nameserver<br />2. Configure RNDC :<br />cd /var/named/chroot/etc<br />rndc-confgen > rndc.key<br />chown root:named rndc.key<br />Edit rndc.key so it looks like this :<br />key "rndckey" {<br />algorithm hmac-md5;<br />secret "SGsvd1dF+mv+yU4ywCCkkg==";<br />};<br />You DON’T NEED anything else in the file (you must remove some option lines!)<br />A symlink in /etc exists and points to the rndc.key file we’ve just created, named expects that file there in order to be able to authenticate against rndc.<br />3. Configure /var/named/chroot/etc/named.conf<br />// we include the rndckey (copy-paste from rndc.key created earlier)<br />key "rndckey" {<br /> algorithm hmac-md5;<br /> secret "SGsvd1dF+mv+yU4ywCCkkg==";<br />};<br /><br />// we assume our server has the IP 192.168.254.207 serving the 192.168.10.0/24 subnet<br />controls {<br /> inet 127.0.0.1 allow { 127.0.0.1; } keys { "rndckey"; };<br /> inet 192.168.10.10 allow { 192.168.10.0/24; } keys { "rndckey"; };<br />};<br /><br />options {<br /> directory "/var/named";<br /> pid-file "/var/run/named/named.pid";<br /><br /> recursion yes;<br /><br /> allow-recursion {<br /> 127.0.0.1;<br /> 192.168.10.0/24;<br /> };<br /><br /> // these are the opendns servers (optional)<br /> forwarders {<br /> 208.67.222.222;<br /> 208.67.220.220;<br /> };<br /><br /> listen-on {<br /> 127.0.0.1;<br /> 192.168.10.10;<br /> };<br /><br /> /*<br /> * If there is a firewall between you and nameservers you want<br /> * to talk to, you might need to uncomment the query-source<br /> * directive below. Previous versions of BIND always asked<br /> * questions using port 53, but BIND 8.1 uses an unprivileged<br /> * port by default.<br /> */<br /> query-source address * port 53;<br /><br /> // so people can't try to guess what version you're running<br /> version "REFUSED";<br /><br /> allow-query {<br /> 127.0.0.1;<br /> 192.168.10.0/24;<br /> };<br /> };<br /><br />server 192.168.10.10 {<br /> keys { rndckey; };<br /> };<br /><br />zone "." IN {<br /> type hint;<br /> file "named.ca";<br /> };<br /><br />// forward zone<br />zone "example.com" IN {<br /> type master;<br /> file "data/example.zone";<br /> allow-update { none; };<br /> // we assume we have a slave dns server with the IP 192.168.10.11<br /> allow-transfer { 192.168.10.11; };<br /> };<br /><br />// reverse zone<br />zone "10.168.192.in-addr.arpa" IN {<br /> type master;<br /> file "data/192.168.10.zone";<br /> allow-update { none; };<br /> allow-transfer { 192.168.10.11; };<br /> };<br />4. Our first zone<br />Let’s say I own the domain example.com<br />We create our first zone under /var/named/chroot/var/named/data/example.zone<br />Here’s an example :<br />$ttl 38400<br />example.com. IN SOA ns.example.com. admin.example.com. (<br /> 2007020400 ; Serial<br /> 10800 ; Refresh after 3 hours<br /> 3600 ; Retry after 1 hour<br /> 604800 ; Expire after 1 week<br /> 86400 ) ; Minimum TTL of 1 day<br />example.com. IN NS ns.example.com.<br /><br />example.com. IN MX 1 mx.example.com.<br />example.com. IN MX 5 mx2.example.com.<br /><br />www.example.com. IN A 192.168.10.5<br />ns.example.com. IN A 192.168.10.10<br />mx.example.com. IN A 192.168.10.20<br />mx2.example.com. IN A 192.168.10.21<br />mail.example.com. IN CNAME mx.example.com.<br />Here’s the corresponding reverse zone under /var/named/chroot/var/named/data/192.168.10.zone :<br />$TTL 86400<br />10.168.192.in-addr.arpa. IN SOA ns.example.com. admin.example.com. (<br /> 2007032000<br /> 10800<br /> 900<br /> 604800<br /> 3600 )<br /><br />10.168.192.in-addr.arpa. IN NS ns.example.com.<br /><br />20.10.168.192.in-addr.arpa. IN PTR mx.example.com.<br />5.10.168.192.in-addr.arpa. IN PTR www.example.com.<br />5. Start the service and make sure it’ll start at boot<br />service named start<br />chkconfig named on<br />Make sure it’s running: <br /># rndc status<br />number of zones: 1<br />debug level: 0<br />xfers running: 0<br />xfers deferred: 0<br />soa queries in progress: 0<br />query logging is OFF<br />recursive clients: 0/1000<br />tcp clients: 0/100<br />server is up and running<br />6. Query<br /># nslookup mx.example.com. 127.0.0.1<br />Server: 127.0.0.1<br />Address: 127.0.0.1#53<br /><br />Name: mx.example.com<br />Address: 192.168.10.20<br /><br /># nslookup www.google.com. 127.0.0.1<br />Server: 127.0.0.1<br />Address: 127.0.0.1#53<br /><br />Non-authoritative answer:<br />www.google.com canonical name = www.l.google.com.<br />Name: www.l.google.com<br />Address: 216.239.59.99<br />Name: www.l.google.com<br />Address: 216.239.59.103<br />Name: www.l.google.com<br />Address: 216.239.59.104<br />Name: www.l.google.com<br />Address: 216.239.59.147<br />7. /etc/resolv.conf<br />If the query made on the previous point is working, you can set up /etc/resolv.conf on the server.<br />It should look like this :<br />search example.com<br />nameserver 127.0.0.1Shahnawaz Saifihttp://www.blogger.com/profile/00369616200651338297noreply@blogger.com0tag:blogger.com,1999:blog-3170425554094457896.post-89849944377757550682010-04-07T02:27:00.000-07:002010-04-07T02:43:31.031-07:00Vsftpd FTP Server With Virtual Users ( Berkeley DB + PAM )<meta equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 14"><meta name="Originator" content="Microsoft Word 14"><link rel="File-List" href="file:///C:%5CUsers%5CShah%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"><!--[if gte mso 9]><xml> <o:officedocumentsettings> <o:allowpng/> </o:OfficeDocumentSettings> </xml><![endif]--><link rel="themeData" href="file:///C:%5CUsers%5CShah%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"><link rel="colorSchemeMapping" href="file:///C:%5CUsers%5CShah%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"><!--[if gte mso 9]><xml> <w:worddocument> <w:view>Normal</w:View> <w:zoom>0</w:Zoom> <w:trackmoves/> <w:trackformatting/> <w:punctuationkerning/> <w:validateagainstschemas/> <w:saveifxmlinvalid>false</w:SaveIfXMLInvalid> <w:ignoremixedcontent>false</w:IgnoreMixedContent> <w:alwaysshowplaceholdertext>false</w:AlwaysShowPlaceholderText> <w:donotpromoteqf/> <w:lidthemeother>EN-US</w:LidThemeOther> <w:lidthemeasian>X-NONE</w:LidThemeAsian> <w:lidthemecomplexscript>X-NONE</w:LidThemeComplexScript> <w:compatibility> <w:breakwrappedtables/> <w:snaptogridincell/> <w:wraptextwithpunct/> <w:useasianbreakrules/> <w:dontgrowautofit/> <w:splitpgbreakandparamark/> <w:enableopentypekerning/> <w:dontflipmirrorindents/> <w:overridetablestylehps/> </w:Compatibility> <m:mathpr> <m:mathfont val="Cambria Math"> <m:brkbin val="before"> <m:brkbinsub val="--"> <m:smallfrac val="off"> <m:dispdef/> <m:lmargin val="0"> <m:rmargin val="0"> <m:defjc val="centerGroup"> <m:wrapindent val="1440"> <m:intlim val="subSup"> <m:narylim val="undOvr"> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"> <w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"> <w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"> <w:lsdexception locked="false" priority="39" name="toc 1"> <w:lsdexception locked="false" priority="39" name="toc 2"> <w:lsdexception locked="false" priority="39" name="toc 3"> <w:lsdexception locked="false" priority="39" name="toc 4"> <w:lsdexception locked="false" priority="39" name="toc 5"> <w:lsdexception locked="false" priority="39" name="toc 6"> <w:lsdexception locked="false" priority="39" name="toc 7"> <w:lsdexception locked="false" priority="39" name="toc 8"> <w:lsdexception locked="false" priority="39" name="toc 9"> <w:lsdexception locked="false" priority="35" qformat="true" name="caption"> <w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"> <w:lsdexception locked="false" priority="1" name="Default Paragraph Font"> <w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"> <w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"> <w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"> <w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"> <w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"> <w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"> <w:lsdexception locked="false" unhidewhenused="false" name="Revision"> <w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"> <w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"> <w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"> <w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"> <w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"> <w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"> <w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"> <w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"> <w:lsdexception locked="false" priority="37" name="Bibliography"> <w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"> </w:LatentStyles> </xml><![endif]--><style> <!-- /* Font Definitions */ @font-face {font-family:Wingdings; panose-1:5 0 0 0 0 0 0 0 0 0; mso-font-charset:2; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:0 268435456 0 0 -2147483648 0;} @font-face {font-family:Wingdings; panose-1:5 0 0 0 0 0 0 0 0 0; mso-font-charset:2; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:0 268435456 0 0 -2147483648 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-520092929 1073786111 9 0 415 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin-top:0in; margin-right:0in; margin-bottom:10.0pt; margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} h1 {mso-style-priority:9; mso-style-unhide:no; mso-style-qformat:yes; mso-style-link:"Heading 1 Char"; mso-style-next:Normal; margin-top:24.0pt; margin-right:0in; margin-bottom:0in; margin-left:0in; margin-bottom:.0001pt; line-height:115%; mso-pagination:widow-orphan lines-together; page-break-after:avoid; mso-outline-level:1; font-size:14.0pt; font-family:"Cambria","serif"; mso-ascii-font-family:Cambria; mso-ascii-theme-font:major-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:major-fareast; mso-hansi-font-family:Cambria; mso-hansi-theme-font:major-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:major-bidi; color:#376092; mso-themecolor:accent1; mso-themeshade:191; mso-font-kerning:0pt;} span.Heading1Char {mso-style-name:"Heading 1 Char"; mso-style-priority:9; mso-style-unhide:no; mso-style-locked:yes; mso-style-link:"Heading 1"; mso-ansi-font-size:14.0pt; mso-bidi-font-size:14.0pt; font-family:"Cambria","serif"; mso-ascii-font-family:Cambria; mso-ascii-theme-font:major-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:major-fareast; mso-hansi-font-family:Cambria; mso-hansi-theme-font:major-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:major-bidi; color:#376092; mso-themecolor:accent1; mso-themeshade:191; font-weight:bold;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} .MsoPapDefault {mso-style-type:export-only; margin-bottom:10.0pt; line-height:115%;} @page WordSection1 {size:8.5in 11.0in; margin:1.0in 1.0in 1.0in 1.0in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.WordSection1 {page:WordSection1;} /* List Definitions */ @list l0 {mso-list-id:688991758; mso-list-template-ids:179486660;} @list l0:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:.5in; mso-level-number-position:left; text-indent:-.25in; mso-ansi-font-size:10.0pt; font-family:Symbol;} @list l0:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:1.0in; mso-level-number-position:left; text-indent:-.25in; mso-ansi-font-size:10.0pt; font-family:"Courier New"; mso-bidi-font-family:"Times New Roman";} @list l0:level3 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:1.5in; mso-level-number-position:left; text-indent:-.25in; mso-ansi-font-size:10.0pt; font-family:Wingdings;} @list l0:level4 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:2.0in; mso-level-number-position:left; text-indent:-.25in; mso-ansi-font-size:10.0pt; font-family:Wingdings;} @list l0:level5 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:2.5in; mso-level-number-position:left; text-indent:-.25in; mso-ansi-font-size:10.0pt; font-family:Wingdings;} @list l0:level6 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:3.0in; mso-level-number-position:left; text-indent:-.25in; mso-ansi-font-size:10.0pt; font-family:Wingdings;} @list l0:level7 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:3.5in; mso-level-number-position:left; text-indent:-.25in; mso-ansi-font-size:10.0pt; font-family:Wingdings;} @list l0:level8 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:4.0in; mso-level-number-position:left; text-indent:-.25in; mso-ansi-font-size:10.0pt; font-family:Wingdings;} @list l0:level9 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:4.5in; mso-level-number-position:left; text-indent:-.25in; mso-ansi-font-size:10.0pt; font-family:Wingdings;} ol {margin-bottom:0in;} ul {margin-bottom:0in;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} </style> <![endif]--> <p class="MsoNormal" style="margin-bottom: 12pt; text-align: justify; line-height: normal;"><span style="font-size: 21pt;">V</span><span style="font-size: 12pt;">sftpd supports virtual users with PAM (pluggable authentication modules). A virtual user is a user login which does not exist as a real login on the system in /etc/passwd and /etc/shadow file. Virtual users can therefore be more secure than real users, because a compromised account can only use the FTP server but cannot login to system to use other services such as ssh or smtp.<o:p></o:p></span></p> <h1><span style="font-size: 12pt; line-height: 115%; font-family: "Arial","sans-serif";">Required software<o:p></o:p></span></h1> <ul style="margin-top: 0in;" type="disc"><li class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">Berkeley DB (version 4) databases<o:p></o:p></span></li><li class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">pam_userdb.so <o:p></o:p></span></li></ul> <h1><span style="font-size: 12pt; line-height: 115%; font-family: "Arial","sans-serif";">Install Berkeley DB And Utilities Under RHEL / CentOS<o:p></o:p></span></h1> <p class="MsoNormal" style="margin-left: 0.5in; line-height: normal;"><span style="font-size: 12pt;">Type the following command:
<br /></span><b style=""><span style="font-size: 9pt;"># yum install db4-utils db4<o:p></o:p></span></b></p> <h1><span style="font-size: 12pt; line-height: 115%; font-family: "Arial","sans-serif";">Create the Virtual Users Database<o:p></o:p></span></h1> <p class="MsoNormal" style="line-height: normal;"><span style="font-size: 12pt;">To create a "db4" format file, first create a plain text files with the usernames and password on alternating lines. For e.g. create user called "shah" with password called "shahpass" and saif with password "saifpass":</span><b style=""><span style="font-size: 9pt; font-family: "Courier New";"><o:p></o:p></span></b></p> <p class="MsoNormal" style="margin-left: 0.5in; line-height: normal;"><b style=""><span style="font-size: 9pt; font-family: "Courier New";"># cd /etc/vsftpd
<br /># cat > vusers.txt</span></b><b style=""><span style="font-size: 9pt; font-family: "Times New Roman","serif";"><o:p></o:p></span></b></p> <h1><span style="font-size: 12pt; line-height: 115%; font-family: "Arial","sans-serif";">Sample output:<o:p></o:p></span></h1> <p class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in; line-height: normal;"><b style=""><span style="font-size: 9pt; font-family: "Times New Roman","serif";">shah<o:p></o:p></span></b></p> <p class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in; line-height: normal;"><b style=""><span style="font-size: 9pt; font-family: "Times New Roman","serif";">shahpass<o:p></o:p></span></b></p> <p class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in; line-height: normal;"><b style=""><span style="font-size: 9pt; font-family: "Times New Roman","serif";">saif<o:p></o:p></span></b></p> <p class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in; line-height: normal;"><b style=""><span style="font-size: 9pt; font-family: "Times New Roman","serif";">saifpass<o:p></o:p></span></b></p> <p class="MsoNormal" style="line-height: normal;"><span style="font-size: 12pt;">Next, create the actual database file like this:<o:p></o:p></span></p> <p class="MsoNormal" style="margin-left: 0.5in; line-height: normal;"><b style=""><span style="font-size: 9pt; font-family: "Courier New";"># db_load -T -t hash -f vusers.txt vsftpd-virtual-user.db
<br /># chmod 600 vsftpd-virtual-user.db
<br /># rm vusers.txt<o:p></o:p></span></b></p> <h1><span style="font-size: 12pt; line-height: 115%; font-family: "Arial","sans-serif";">Configure VSFTPD for virtual user<o:p></o:p></span></h1> <p class="MsoNormal" style="line-height: normal;"><span style="font-size: 12pt;">Edit the vsftpd configuration file. Add or correct the following configuration options:<o:p></o:p></span></p> <p class="MsoNormal" style="line-height: normal;"><b style=""><span style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 153);">anonymous_enable</span></b><b style=""><span style="font-size: 9pt; font-family: "Courier New";">=<span style="color: rgb(102, 0, 102);">NO</span>
<br /><span style="color: rgb(0, 0, 153);">local_enable</span>=<span style="color: rgb(102, 0, 102);">YES</span>
<br /># Virtual users will use the same privileges as local users.
<br /># It will grant write access to virtual users. Virtual users will use the
<br /># same privileges as anonymous users, which tends to be more restrictive
<br /># (especially in terms of write access).
<br /><span style="color: rgb(0, 0, 153);">virtual_use_local_privs</span>=<span style="color: rgb(102, 0, 102);">YES</span>
<br /><span style="color: rgb(0, 0, 153);">write_enable</span>=<span style="color: rgb(102, 0, 102);">YES</span>
<br />
<br /># Set the name of the PAM service vsftpd will use
<br /># RHEL / centos user should use /etc/pam.d/vsftpd
<br /><span style="color: rgb(0, 0, 153);">pam_service_name</span>=<span style="color: rgb(102, 0, 102);">vsftpd.virtual</span>
<br />
<br /># Activates virtual users
<br /><span style="color: rgb(0, 0, 153);">guest_enable</span>=<span style="color: rgb(102, 0, 102);">YES</span>
<br />
<br /># Automatically generate a home directory for each virtual user, based on a template.
<br /># For example, if the home directory of the real user specified via guest_username is
<br /># /home/virtual/$USER, and user_sub_token is set to $USER, then when virtual user shah
<br /># logs in, he will end up (usually chroot()'ed) in the directory /home/virtual/shah.
<br /># This option also takes affect if local_root contains user_sub_token.
<br /><span style="color: rgb(0, 0, 153);">user_sub_token</span>=<span style="color: rgb(102, 0, 102);">$USER</span>
<br />
<br /># Usually this is mapped to Apache virtual hosting docroot, so that
<br /># Users can upload files
<br /><span style="color: rgb(0, 0, 153);">local_root</span>=<span style="color: rgb(102, 0, 102);">/home/vftp/$USER</span>
<br />
<br /># Chroot user and lock down to their home dirs
<br /><span style="color: rgb(0, 0, 153);">chroot_local_user</span>=<span style="color: rgb(102, 0, 102);">YES</span>
<br /> <!--[if !supportLineBreakNewLine]-->
<br /> <!--[endif]--><o:p></o:p></span></b></p> <p class="MsoNormal" style="line-height: normal;"><b style=""><span style="font-size: 9pt; font-family: "Courier New";"># Hide ids from user
<br /><span style="color: rgb(0, 0, 153);">hide_ids</span>=<span style="color: rgb(102, 0, 102);">YES</span> </span></b><span style="font-size: 12pt;"><o:p></o:p></span></p> <p class="MsoNormal" style="line-height: normal;"><b style=""><span style="">Save and close the file. <o:p></o:p></span></b></p> <h1><span style="font-size: 12pt; line-height: 115%; font-family: "Arial","sans-serif";">Create a PAM File Which Uses Your New Database<o:p></o:p></span></h1> <p class="MsoNormal" style="line-height: normal;"><span style="">The following PAM is used to authenticate users using your new database. Create </span><b style=""><span style="font-size: 9pt; font-family: "Courier New";">/etc/pam.d/vsftpd.virtual:<o:p></o:p></span></b></p> <p class="MsoNormal" style="line-height: normal;"><b style=""><span style="font-size: 9pt; font-family: "Courier New";"># cat > /etc/pam.d/vsftpd.virtual<o:p></o:p></span></b></p> <p class="MsoNormal" style="line-height: normal;"><span style="">Append the following:<o:p></o:p></span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><b style=""><span style="font-size: 9pt; font-family: "Courier New";">#%PAM-1.0<o:p></o:p></span></b></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><b style=""><span style="font-size: 9pt; font-family: "Courier New";">auth required pam_userdb.so db=/etc/vsftpd/vsftpd-virtual-user <o:p></o:p></span></b></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><b style=""><span style="font-size: 9pt; font-family: "Courier New";">account required pam_userdb.so db=/etc/vsftpd/vsftpd-virtual-user <o:p></o:p></span></b></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><b style=""><span style="font-size: 9pt; font-family: "Courier New";">session required pam_loginuid.so <o:p></o:p></span></b></p> <h1><span style="font-size: 12pt; line-height: 115%; font-family: "Arial","sans-serif";">Create The Location Of The Files<o:p></o:p></span></h1> <p class="MsoNormal" style="line-height: normal;"><span style="">You need to set up the location of the files / dirs for the virtual users. Type the following command:</span><span style="font-size: 12pt;"><o:p></o:p></span></p> <p class="MsoNormal" style="margin-left: 0.5in; line-height: normal;"><b style=""><span style="font-size: 9pt; font-family: "Courier New";"># mkdir /home/vftp
<br /># mkdir -p /home/vftp/{shah,saif}
<br /># chown -R ftp:ftp /home/vftp<o:p></o:p></span></b></p> <h1><span style="font-size: 12pt; line-height: 115%; font-family: "Arial","sans-serif";">Restart The FTP Server<o:p></o:p></span></h1> <p class="MsoNormal" style="line-height: normal;"><span style="font-size: 12pt; font-family: "Times New Roman","serif";">Type the following command<o:p></o:p></span></p> <p class="MsoNormal" style="text-indent: 0.5in; line-height: normal;"><b style=""><span style="font-size: 9pt; font-family: "Courier New";"># service vsftpd restart</span></b><b style=""><span style="font-size: 9pt; font-family: "Times New Roman","serif";"><o:p></o:p></span></b></p> <h1><span style="font-size: 12pt; line-height: 115%; font-family: "Arial","sans-serif";">Test Your Setup<o:p></o:p></span></h1> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">Open another shell session and type:<o:p></o:p></span></p> <p class="MsoNormal" style="text-indent: 0.5in; line-height: normal;"><b style=""><span style="font-size: 9pt; font-family: "Courier New";">$ ftp ftp.example.com</span></b><b style=""><span style="font-size: 9pt; font-family: "Times New Roman","serif";"><o:p></o:p></span></b></p> <p class="MsoNormal" style="line-height: normal;"><span style="font-size: 12pt;">Sample output:<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in; line-height: normal;"><b style=""><span style="font-size: 9pt; font-family: "Courier New";">Connected to ftp.example.com.
<br />Name (localhost:root): shah
<br />331 Please specify the password.
<br />Password:
<br />230 Login successful.
<br />Remote system type is UNIX.
<br />Using binary mode to transfer files.
<br />ftp> <o:p></o:p></span></b></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><o:p> </o:p></span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">Sample log from /var/log/secure:<o:p></o:p></span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; text-indent: 0.5in; line-height: normal;"><b style=""><span style="font-size: 9pt; font-family: "Courier New";"># tail -f /var/log/secure
<br /></span></b><span style="font-size: 10pt; font-family: "Courier New";">
<br /> <!--[if !supportLineBreakNewLine]-->
<br /> <!--[endif]--></span><b><span style="font-size: 1pt; font-family: "Arial","sans-serif"; color: rgb(55, 96, 146);"><o:p></o:p></span></b></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 8pt; font-family: "Courier New";">Apr 07 14:54:28 xentest vsftpd: pam_userdb(vsftpd.virtual:auth): user 'shah' granted access<o:p></o:p></span></p> <p class="MsoNormal"><o:p> </o:p></p> Shahnawaz Saifihttp://www.blogger.com/profile/00369616200651338297noreply@blogger.com0tag:blogger.com,1999:blog-3170425554094457896.post-48251141612409204002009-06-15T21:56:00.000-07:002009-06-15T22:34:26.174-07:00Linux Administration Interview Questions<p><span style="font-family:arial;color:#000066;"><strong>Thoroughly asked Linux Administration Interview Questions:-</strong></span></p><ul><li><span style="font-family:verdana;"><span style="font-size:85%;">What are the nfs service daemons?</span><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjI54lkdC9hCmQO0SRCgKmSZEhpBaXFT3CArYnvjqok2zl2MhLlAi88c-37K_KNC4LkDLBTMU03-hnmnzHOLbugLpyNccg1ENrhyphenhyphenFgt-Wqi7jzgYziuJZSUeG313EZo4BPyv6GCdzjQPUo/s1600-h/linux-penguin.jpg"></a></span></li><li><span style="font-family:verdana;font-size:85%;">What is booting sequence?</span></li><li><span style="font-family:verdana;font-size:85%;">What is sed ?</span></li><li><span style="font-family:verdana;font-size:85%;">How to secure a server?</span></li><li><span style="font-family:verdana;font-size:85%;">How to test remote server being client whether it is down or up?</span></li><li><span style="font-family:verdana;font-size:85%;">What is zombie process?</span></li><li><span style="font-family:verdana;font-size:85%;">How to define default route?</span></li><li><span style="font-family:verdana;font-size:85%;">What is software routing (simulation or immolation)?</span></li><li><span style="font-family:verdana;font-size:85%;">What are the main sections in samba configuration file?</span></li><li><span style="font-family:verdana;font-size:85%;">How to enable relay in sendmail?</span></li><li><span style="font-family:verdana;font-size:85%;">How to create forwarder in DNS?</span></li><li><span style="font-family:verdana;font-size:85%;">What are the configuration files in DNS?</span></li><li><span style="font-family:verdana;font-size:85%;">What are the packages required to configure NIS?</span></li><li><span style="font-family:verdana;font-size:85%;">What is the role of NIS?</span></li><li><span style="font-family:verdana;font-size:85%;">What is syslog?</span></li><li><span style="font-family:verdana;font-size:85%;">What is orphan process?</span></li><li><span style="font-family:verdana;font-size:85%;">How to modify rpm?</span></li><li><span style="font-family:verdana;font-size:85%;">How to change log file parameters using library files?</span></li><li><span style="font-family:verdana;font-size:85%;">What is the difference in raid level 0, 1, 5 and 6?</span></li><li><span style="font-family:verdana;font-size:85%;">What are TCP-wrappers?</span></li><li><span style="font-family:verdana;font-size:85%;">What is difference between telnet and ssh?</span></li><li><span style="font-family:verdana;font-size:85%;">How to define thin client settings in dhpc server?</span></li><li><span style="font-family:verdana;font-size:85%;">What is acl in squid?</span></li><li><span style="font-family:verdana;font-size:85%;">What is difference in xen and vmware?</span></li><li><span style="font-family:verdana;font-size:85%;">What is mtr?</span></li><li><span style="font-family:verdana;font-size:85%;">Tell any recent problem which you have faced and solved?</span></li><li><span style="font-family:verdana;font-size:85%;">What is recent shell script which you wrote, explain it?</span></li><li><span style="font-family:verdana;font-size:85%;">How to pass multiple commands with ssh?</span></li><li><span style="font-family:verdana;font-size:85%;">What is dhcp sequence?</span></li><li><span style="font-family:verdana;font-size:85%;">What are differences between ext2 and ext3?</span></li><li><span style="font-family:verdana;font-size:85%;">What is difference between soft and hard link?</span></li><li><span style="font-family:verdana;font-size:85%;">What is journaling in ext3?</span></li><li><span style="font-family:verdana;font-size:85%;">What are seven fundamentals filetypes in Linux? </span></li><li><span style="font-family:Verdana;font-size:85%;">How to update kernel?</span></li></ul>Shahnawaz Saifihttp://www.blogger.com/profile/00369616200651338297noreply@blogger.com1tag:blogger.com,1999:blog-3170425554094457896.post-51500483445696372252008-09-18T15:29:00.000-07:002008-09-18T22:23:57.980-07:00Installing Yum On RHEL 4<div style="text-align: justify;"><span style="color: rgb(51, 0, 153);font-size:85%;" ><span style="font-family:arial;">I have RHEL ES 4 at my office. It irritated me terribly as the machine was never updated and hence having very old versions of softwares. Therefore I decided to upgrade my RHEL ES 4 using yum.</span></span><br /><br /><br /><br /><span style="color: rgb(51, 0, 153);font-size:85%;" ><span style="font-family:arial;">From my work place, internet is only accessible through http proxy, that too with authentication. I tried using up2date by creating an account at redhat's site but it didn’t work( I thought you could update one machine using your redhat account).</span></span><br /><br /><br /><span style="color: rgb(51, 0, 153);font-size:85%;" ><span style="font-family:arial;">The first problem I encountered was that there is no public repository to update RHEL machines i.e you have to pay for it. After googling for a while I discovered that </span><span style="text-decoration: underline;font-family:arial;" >CentOS </span><span style="font-family:arial;">offers public repositories and they work with RHEL 4 as well.</span></span><br /><br /><br /><br /><span style="color: rgb(51, 0, 153);font-size:85%;" ><span style="font-family:arial;">I downloaded </span><span style="font-weight: bold;font-family:arial;" >latest</span><span style="font-family:arial;"> yum rpm, installed it and configured it to use centOS repo. Every time I ran yum, it failed. It couldn’t find repomd.xml file in the CentOS repositories I provided in yum.conf.</span></span><br /><br /><br /><span style="color: rgb(51, 0, 153);font-size:85%;" ><span style="font-family:arial;">After struggling for some time, I discovered that I was accessing older version of repos through the latest yum. Therefore I had to use an older version of yum with RHEL 4, since old repos do not support xml based updating.</span></span><br /><br /><br /><br /><div style="text-align: left;"><span style="color: rgb(51, 0, 153);font-size:85%;" ><span style="font-family:arial;">Now I have a fully updated system. Following is the brief summary of the steps I took:-<br /><br /></span></span><br /><span style="color: rgb(51, 0, 153);font-size:85%;" ><span style="font-family:arial;">1) Since I was behind a proxy I had to export environment variable http_proxy.<br /><br /></span></span><br /><span style="color: rgb(51, 0, 153);font-size:85%;" ><span style="font-family:arial;">2) Downloaded yum-2.0.8-1.noarch.rpm from</span></span><br /><span style="color: rgb(51, 0, 153);font-size:85%;" ><a style="font-family: arial;" href="http://linux.duke.edu/projects/yum/download/2.0/yum-2.0.8-1.noarch.rpm">http://linux.duke.edu/projects/yum/download/2.0/yum-2.0.8-1.noarch.rpm</a><br /><br /></span><br /><span style="color: rgb(51, 0, 153);font-size:85%;" ><span style="font-family:arial;">3) Installed it using</span></span><br /><span style="color: rgb(51, 0, 153);font-size:85%;" ><span style="font-family:arial;"> rpm –i yum-2.0.8-1.noarch.rpm</span></span><br /><br /><br /><span style="color: rgb(51, 0, 153);font-size:85%;" ><span style="font-family:arial;">4) Configured my yum.conf to look like this:<br /><br /></span></span><br /> </div> </div> <div style="color: rgb(51, 0, 153); text-align: justify;font-family:arial;"> <div style="text-align: left;"><span style="font-size:85%;">[main]</span><br /><span style="font-size:85%;">cachedir=/var/cache/yum</span><br /><span style="font-size:85%;">debuglevel=2</span><br /><span style="font-size:85%;">logfile=/var/log/yum.log</span><br /><span style="font-size:85%;">pkgpolicy=newest</span><br /><span style="font-size:85%;">distroverpkg=redhat-release</span><br /><span style="font-size:85%;">tolerant=1</span><br /><span style="font-size:85%;">exactarch=1</span><br /><br /><span style="font-size:85%;">#base]</span><br /><span style="font-size:85%;">#ame=Red Hat Linux $releasever - $basearch - Base</span><br /><span style="font-size:85%;">#aseurl=http://mirror.dulug.duke.edu/pub/yum-repository/redhat/$releasever/$basearch/</span><br /><span style="font-size:85%;">[base]</span><br /><span style="font-size:85%;">name=CentOS-$releasever - Base</span><br /><span style="font-size:85%;">baseurl=http://mirror.centos.org/centos/4/os/i386/</span><br /><span style="font-size:85%;">gpgcheck=1</span><br /><br /><span style="font-size:85%;">[updates]</span><br /><span style="font-size:85%;">name=Red Hat Linux $releasever - Updates</span><br /><span style="font-size:85%;">baseurl=http://mirror.centos.org/centos/4/updates/i386/</span><br /><span style="font-size:85%;">gpgcheck=1</span><br /></div> <span style="font-size:85%;"><br /></span></div> <div style="text-align: justify;"><br /><div style="text-align: left;"><span style="color: rgb(51, 0, 153);font-size:85%;" ><span style="font-family:arial;">5) Downloaded the gpg key for CentOS rpm packages from</span></span><br /><span style="font-family: times new roman;font-size:100%;" ><span style="color: rgb(51, 0, 153);">http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-4</span></span><br /></div> <span style="color: rgb(51, 0, 153);font-size:85%;" ><br /></span><br /><br /><div style="text-align: left;"><span style="color: rgb(51, 0, 153);font-size:85%;" ><span style="font-family:arial;">6) Imported the key like this:</span></span><br /><span style="color: rgb(51, 0, 153);font-size:85%;" ><span style="font-family:arial;">rpm --import RPM-GPG-KEY-CentOS-4<br /><br /></span></span></div><br /><div style="text-align: left;"><span style="color: rgb(51, 0, 153);font-size:85%;" ><span style="font-family:arial;">7) Run “yum –y update”. Now Sit back and enjoy seeing your system being updated.</span></span><br /></div> </div>Shahnawaz Saifihttp://www.blogger.com/profile/00369616200651338297noreply@blogger.com2tag:blogger.com,1999:blog-3170425554094457896.post-24029252512724506452008-08-05T06:59:00.000-07:002008-08-05T07:04:37.869-07:00Introduction to Linux for beginnersShahnawaz Saifihttp://www.blogger.com/profile/00369616200651338297noreply@blogger.com1