Monitoring System NAGIOS+NCONF+PNP4

Source: Internet
Author: User
Tags rrdtool snmp

Configuring nconf to manage Nagios is simpler and more efficient

Refer to the post of the previous Nagios SNMP mode monitoring system to install the lamp environment and Nagios.

I. Software required for the case of this article

Nconf-1.2.6-0.tgz

Pnp4nagios-0.6.18.tar.gz

nsclient++

Cgilib-0.6.tar.gz

RRDtool

Pnp4nagios-0.6.7.tar.gz

Two. Installing nconf

1. Unzip the installation package

TAR-XF nconf-1.2.6-0.tgz-c/var/www/html/

2. Configure the database-level authorized users required for nconf

mysql> CREATE DATABASE nconf;
Query OK, 1 row affected (0.01 sec)

Mysql> GRANT all on nconf.* to ' nconf ' @ ' localhost ' identified by ' nconf ';
Query OK, 0 rows Affected (0.00 sec)

mysql> FLUSH privileges;
Query OK, 0 rows Affected (0.00 sec)

3. Modify Directory User Rights

Chown-r Apache.apache config/temp/static_cfg/output/

4. Visit nconf http://ip/nconf

650) this.width=650; "Style=" background-image:none; border-right-0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6F/04/ Wkiol1wp1tkhbcveaagcmw1dxlm156.jpg "width=" 951 "height=" 426 "/>

650) this.width=650; "Style=" background-image:none; border-right-0px; margin:0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6F/04/ Wkiol1wp1tpiwk8qaagcmw1dxlm132.jpg "width=" 951 "height=" 426 "/>

650) this.width=650; "Style=" background-image:none; border-right-0px; margin:0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6F/04/ Wkiol1wp1ttdwxceaaiynkmmzgq875.jpg "width=" 915 "height=" 435 "/>

650) this.width=650; "Style=" background-image:none; border-right-0px; margin:0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6F/04/ Wkiol1wp1tbimqleaajhxlx1qpy596.jpg "width=" 1091 "height=" 415 "/>

650) this.width=650; "Style=" background-image:none; border-right-0px; margin:0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6F/04/ Wkiol1wp1tiqxxm1aajrmth_f-q335.jpg "width=" 1092 "height=" 408 "/>

............

5. Delete to install files as required

6. Test Login

650) this.width=650; "Style=" background-image:none; border-right-0px; margin:0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6F/04/ Wkiol1wp1tqa9gawaal0zsic1r0877.jpg "width=" 916 "height=" 482 "/>

Two. Configure nconf

1. Unable to connect to database

650) this.width=650; "Style=" background-image:none; border-right-0px; margin:0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6F/04/ Wkiol1wp1tutntpraaggl6wwo4u893.jpg "width=" 906 "height=" 290 "/>

2. Configure nconf link database and Execute script

Ln-s/usr/local/nagios/bin/nagios Bin/nagios
chmod +x/var/www/html/nconf/bin/generate_config.pl
Chown-r Apache.apache bin/
chmod +x/usr/local/nagios/bin/nagios
chmod +x/var/www/html/nconf/add-ons/deploy_local.sh

vim/var/www/html/nconf/add-ons/deploy_local.sh//Modify the Nagios path within the environment, no modifications needed here

650) this.width=650; "Style=" background-image:none; border-right-0px; margin:0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6F/04/ Wkiol1wp1t7jdlsbaaldlcf3wwu808.jpg "width=" 975 "height=" 438 "/>

3. Execute the script, generate two directories under/usr/local/nagios/etc/Default_collector and global monitoring resources for storing generic nconf definitions

CD add-ons/
./deploy_local.sh
Running configuration Check...done.
Reloading Nagios Configuration...done

4. Add to Crontab and let it execute every other minute

*/1 * * * */bin/sh/var/www/html/nconf/add-ons/deploy_local.sh

5. Modify the Nagios.cfg configuration file plus comments, add the following two lines

Vim/usr/local/nagios/etc/nagios.cfg

650) this.width=650; "Style=" background-image:none; border-right-0px; margin:0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6F/04/ Wkiol1wp1t6zrfbyaaeefddqlca057.jpg "width=" 668 "height=" 173 "/>

650) this.width=650; "Style=" background-image:none; border-right-0px; margin:0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6F/04/ Wkiol1wp1t6hznccaac1m5dayf0477.jpg "width=" 618 "height=" 185 "/>

6. Restart Nagios

650) this.width=650; "Style=" background-image:none; border-right-0px; margin:0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6F/08/ Wkiom1wp1r-hfw4gaaccpbnntdy656.jpg "width=" 605 "height="/>

7. The above nconf configuration is complete, install the client to manually add monitoring resource test

8. Install the Windows client on the monitored machine.

650) this.width=650; "Style=" background-image:none; border-right-0px; margin:0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M02/6F/04/wKioL1WP1t_ Ygz-naadptys_rri927.jpg "width=" 504 "height=" 243 "/>

9. Configure the INI file to fill in the Nagios address, and then restart the client

650) this.width=650; "Style=" background-image:none; border-right-0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6F/04/ Wkiol1wp1uccjm1uaacph_hlt8o410.jpg "width=" 468 "height=" 159 "/>

10. Adding Monitoring resources

650) this.width=650; "Style=" background-image:none; border-right-0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6F/04/ Wkiol1wp1upxop61aasieraeyoe156.jpg "width=" 1216 "height=" 573 "/>

650) this.width=650; "Style=" background-image:none; border-right-0px; margin:0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6F/04/ Wkiol1wp1uxjx0v7aajssj8afcu366.jpg "width=" 1100 "height=" 349 "/>

650) this.width=650; "Style=" background-image:none; border-right-0px; margin:0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6F/04/ Wkiol1wp1uaqabozaadzbgsu3y4477.jpg "width=" 753 "height=" 315 "/>

11. Omit only the parameter values for each property listed here

Cpu

650) this.width=650; "Style=" background-image:none; border-right-0px; margin:0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6F/08/ Wkiom1wp1sbqnxfbaaciehgt8ty960.jpg "width=" 671 "height=" 178 "/>

Memory

650) this.width=650; "Style=" background-image:none; border-right-0px; margin:0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6F/08/ Wkiom1wp1sbijfw6aachqvxwple019.jpg "width=" 610 "height=" 199 "/>

12. Custom Ports

650) this.width=650; "Style=" background-image:none; border-right-0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6F/08/ Wkiom1wp1seawiflaaksrwfua3e866.jpg "width=" 1013 "height=" 403 "/>

13. Configure the mail alarm, will wait for three-party program SendEmail incoming monitor and add Execute permission (use please refer to the previous Nagios SNMP monitoring blog post, here no longer repeat)

650) this.width=650; "Style=" background-image:none; border-right-0px; margin:0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6F/08/ Wkiom1wp1sjqrvagaajfext1m4y341.jpg "width=" 754 "height=" 349 "/>

14. Fill in the following items separately

650) this.width=650; "Style=" background-image:none; border-right-0px; margin:0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6F/08/ Wkiom1wp1sjdenk6aai-rax7c0a447.jpg "width=" 906 "height=" 364 "/>

/usr/bin/printf "%b" "* * * * Nagios *****\n\nnotification Type: $NOTIFICATIONTYPE $\nhost: $HOSTNAME $\nstate: $HOSTSTATE $\naddress: $HOSTADDRESS $\ninfo: $HOSTOUTPUT $\n\ndate/time: $LONGDATETIME $\n "| /usr/local/bin/sendemail-f [email protected]-T $CONTACTEMAIL $-S 1.1.1.1-u "* * $NOTIFICATIONTYPE $ Address: $HOSTADDRESS $ is $HOSTSTATE $ * * "

/usr/bin/printf "%b" "* * * * Nagios *****\n\nnotification Type: $NOTIFICATIONTYPE $\n\nservice: $SERVICEDESC $\nhost: $ Hostalias$\naddress: $HOSTADDRESS $\nstate: $SERVICESTATE $\n\ndate/time: $LONGDATETIME $\n\nadditional info:\n\n$ serviceoutput$ "| /usr/local/bin/sendemail-f [email protected]-T $CONTACTEMAIL $-S 1.1.1.1-u "* * $NOTIFICATIONTYPE $ Address: $HOSTADDRESS $ Servicealert: $SERVICEDESC $ is $SERVICESTATE $ * * "

15. Test the email notification function, first define the parameter value is 20 warning, 30 critical (mail notification a little delay)

650) this.width=650; "Style=" background-image:none; border-right-0px; margin:0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6F/08/ Wkiom1wp1sihdnjuaacotlevglw212.jpg "width=" 696 "height=" 196 "/>

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6F/08/ Wkiom1wp1srgh7vuaaiadmc2k4w024.jpg "" 1070 "height=" 163 "/>

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6F/05/ Wkiol1wp1uqsuvxqaafgotepp5o023.jpg "" 736 "height=" 453 "/>

Three. Installing Pnp4nagios

1. Installing Cgilib

TAR-ZXVF cgilib-0.6.tar.gz

CD cgilib-0.6

Make

CP aux.h/usr/include/

CP cgi.h/usr/include/

CP libcgi.a/usr/lib/

2. Installing RRDtool

Yum–y Localinstall rrdtool-*

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6F/05/ Wkiol1wp1uuwqt9raaep54fo318292.jpg "" 861 "height="/>

3. Installing Pnp4nagios

Cd/usr/lib/perl5/5.8.8/i386-linux-thread-multi

cp/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/rrds.pm/usr/lib/perl5/5.8.8/i386-linux-thread-multi/

Test: Perl-mrrds-le ' Print Q (ok!) '

Note: Please ignore the above steps when installing RRDtool with RPM package

TAR-ZXVF pnp4nagios-0.6.18.tar.gz

CD pnp4nagios-0.6.18/

./configure--with-nagios-user=nagios--with-nagios-group=nagios--with-rrdtool=/usr/bin/rrdtool-- With-perfdata-dir=/usr/local/nagios/share/perfdata

Make;make All

Make install

Make install-webconf (can not be installed)

Make Install-config

Make Install-init (can not be installed)

(Make fullinstall-This command to install all of the above steps)

4. Configure Apache

Vi/etc/httpd/conf/httpd.conf

Add the following information at the end

Alias/pnp4nagios "/usr/local/pnp4nagios/share"

<directory "/usr/local/pnp4nagios/share" >

AllowOverride None

Order Allow,deny

Allow from all

AuthName "Nagios Access"

AuthType Basic

Authuserfile/usr/local/nagios/etc/htpasswd.user

Require Valid-user

<ifmodule mod_rewrite.c>

Rewriteengine on

Options FollowSymLinks

rewritebase/pnp4nagios/

Rewriterule ^ (application|modules|system)-[f,l]

Rewritecond%{request_filename}!-f

Rewritecond%{request_filename}!-d

Rewriterule. * index.php/$0 [pt,l]

</IfModule>

</Directory>

Restart Apache service after saving: service httpd restart

http://192.168.1.109/pnp4nagios/index.php

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6F/05/ Wkiol1wp1uug5kwpaacxbydtiwe471.jpg "" 716 "height=" Bayi "/>

rm-rf/usr/local/pnp4nagios/share/install.php

5. Configuring NCONF Support PnP

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6F/05/ Wkiol1wp1u7coezwaat9gp3cuzw318.jpg "" 1153 "height=" 564 "/>

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6F/08/ Wkiom1wp1s6r2xxjaaeido3saig183.jpg "" 603 "height=" 203 "/>

6. Fill in the following content

/pnp4nagios/index.php/graph?host= $HOSTNAME $&srv=_host_ ' class= ' tips ' rel= '/pnp4nagios/index.php/popup?host=$ Hostname$&srv=_host_

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6F/05/ Wkiol1wp1vhildlxaas895wy1l0226.jpg "" 1189 "height=" 501 "/>

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6F/05/ Wkiol1wp1vgtcr5jaadhkjzwwic757.jpg "" 517 "height=" 167 "/>

7. Fill in the following content

/pnp4nagios/index.php/graph?host= $HOSTNAME $&srv= $SERVICEDESC $ ' class= ' tips ' rel= '/pnp4nagios/index.php/popup ? host= $HOSTNAME $&srv= $SERVICEDESC $

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6F/08/ Wkiom1wp1tljk7z9aaix0cehzr4845.jpg "" 824 "height=" 377 "/>

8. Enter the following content separately

Process-host-perfdata

/usr/bin/perl/usr/local/pnp4nagios/libexec/process_perfdata.pl-d Hostperfdata

Process-service-perfdata

/usr/bin/perl/usr/local/pnp4nagios/libexec/process_perfdata.pl-d Hostperfdata

9. Create Host-pnp and srv-php templates

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6F/05/ Wkiol1wp1vlzvfolaac0adsqbc8999.jpg "" 662 "height=" 146 "/>

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6F/08/ Wkiom1wp1tpgauqwaacgatsrrjs209.jpg "" 640 "height=" 121 "/>

10. Select the Action_url as defined above, execute the test profile option without error, and you can plot it later

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6F/08/ Wkiom1wp1tpacsjkaaiqocujohq723.jpg "" 917 "height=" 302 "/>

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6F/05/ Wkiol1wp1vtrvu3jaadrizxqyd4509.jpg "" 577 "height=" 144 "/>

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6F/08/ Wkiom1wp1tat9ou7aaieyy8huls197.jpg "" 703 "height=" 387 "/>

Monitoring System NAGIOS+NCONF+PNP4

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.