Nagios Event Mechanism Practice

Source: Internet
Author: User

Nagios Event Mechanism Practice

Blog Address: Http://www.cnblogs.com/caoguo

I. Event-Triggered execution script

[Email protected] ~]# cd/usr/local/nagios/libexec/eventhandlers/[[email protected] eventhandlers]# Touch Process_snapshot.sh[[email protected] eventhandlers]# VI Process_ snapshot.sh #!/bin/Bash Case " $" inchOK);; WARNING)/usr/local/nagios/libexec/check_nrpe-h $4-c process_snapshot;;    UNKNOWN);; CRITICAL)/usr/local/nagios/libexec/check_nrpe-h $4-c process_snapshot;; Esacexit0[email protected] eventhandlers]# chmod+x process_snapshot.sh [[email protected] eventhandlers]# chown-R nagios.nagios/usr/local/nagios/libexec/eventhandlers/

Two. Configuring the Nagios Host File

~]# vi/etc/nagios/objects/nrpehost.cfgdefine service{        use                             generic-service                 HOST_NAME                       nrpehost        service_description             CHECK LOAD        check_command                   Check_nrpe!  Check_load        notifications_enabled            1        event_handler                    process_snapshot        }
" enable_event_handlers " /etc/nagios/nagios.cfg enable_event_handlers=1

Three. Configure the Nrpe node

~]# vi/etc/nrpe/Nrpe.cfgcommand[process_snapshot]1 | Tail-n +8 | Sort-rn-k9 | Head-n20 >/tmp/proc_snap.log# allow command with parameter Dont_blame_nrpe=1

Four. Test remote execution

# See if a file can be created

Five. Experiment Test adjustment

' Load ' /etc/nrpe/nrpe.cfgcommand[check_load]0.7,0.6,0.51,3 ,5~]# vi/etc/nagios/objects/templates.cfgnormal_check_interval           1 

Six. Results

if=/dev/zero of=test

Reference: http://www.ttlsa.com/nagios/nagios-event-handlers-application/

Nagios Event Mechanism Practice

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.