CentOS nagios monitoring data center temperature

Source: Internet
Author: User

CentOS nagios monitoring data center temperature

In the IDC of your company, the air conditioner is badly used, and there is no linkage, no power-on and self-starting. Experienced the circuit switching locks at night. When you know it, it's just a boiler room.
This method uses the Switch Temperature to determine whether the air conditioner is powered off.
1. temperature value of the secondary CT interactive login Switch

[root@nagios opt]# cat 123.exp#!/usr/bin/expect -fset user userset passwd passwordspawn telnet 192.168.0.254expect "Username:"send -- "$user\r"expect "Password:"send -- "$passwd\r"expect ""send -- "dis env\r"expect ""send -- "quit\r"expect eof

2. Add a nagios monitoring script

[root@nagios opt]# cat /usr/local/nagios/libexec/check_temp#!/bin/bashexpect /opt/123.exp >/opt/123.logtemp=`awk '/hotspot/ {print $3}' /opt/123.log`STATE_OK=0STATE_WARNING=1STATE_CRITICAL=2STATE_UNKNOWN=3if [ "$#" == "4" ]then#Set variablesarg=${4}w=$2c=$4if [ $temp -ge $w -a $temp -lt $c ]thenecho "Warning :Room temperature $temp°C "exitstatus=$STATE_WARNINGelif [ $temp -ge $c ]thenecho "Critical :Room temperature $temp°C"exitstatus=$STATE_CRITICALelseecho "OK :Room temperature $temp°C."exitstatus=$STATE_OKfifiexit $exitstatus

3. Add command

[root@nagios opt]# tail -5 /usr/local/nagios/etc/objects/commands.cfg# 'check_temp' command definitiondefine command{command_name check_tempcommand_line $USER1$/check_temp -w $ARG1$ -c $ARG2$}

4. Modify nrpe. cfg

[root@nagios opt]# grep "temp" /usr/local/nagios/etc/nrpe.cfgcommand[check_temp]=/usr/local/nagios/libexec/check_temp -w 30 -c 33

5. Add a Monitoring Project

[root@nagios opt]# tail -6 /usr/local/nagios/etc/objects/localhost.cfgdefine service{use generic-servicehost_name localhostservice_description check_tempcheck_command check_nrpe!check_temp}

<A data-cke-saved-href = "http://www.xmydlinux.org/wp-content/uploads/2014/02/11.jpg" href = "http://www.xmydlinux.org/wp-content/uploads/2014/02/11.jpg" class = "cboxElement" rel = "example4" 773 "=" "style =" text-decoration: none; color: rgb (1,150,227); ">

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.