Este sensor abaixo pode ser comprado nos sites da china por menos de R$40,00.
yum install gcc libusb-devel libusb # download software: wget https://blog.abratel.com.br/wp-content/uploads/2014/11/pcsensor-master.tar # unzip tar -zvf pcsensor-master.tar cd pcsensor-master make clean make cd /usr/src/pcsensor ./pcsensor 2014/11/13 12:57:38 Temperature 81.72F 27.62C [root@zeus uferes]# whereis lsusb lsusb: /sbin/lsusb /usr/share/man/man8/lsusb.8.gz [root@zeus uferes]# /sbin/lsusb Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub Bus 005 Device 002: ID 0557:2304 ATEN International Co., Ltd Bus 006 Device 001: ID 0000:0000 Bus 008 Device 001: ID 0000:0000 Bus 003 Device 005: ID 0c45:7401 Microdia TEMPer Temperature Sensor
Criar script para nagios check_temper
#!/bin/bash # script para checar a temperatura do DC # exit 1 = warning; exit 2 = Critico; exit 3 = Unknown tempe=$(/usr/local/bin/pcsensor | awk '{print $5} ' | cut -c 1-2) temperatura=$(/usr/local/bin/pcsensor) if [ $tempe -lt "32" ] ; then # se for menor (is less) echo "Temperatura atual do Data Center: $temperatura" exit 0; elif [ $tempe -lt "34" ] ; then echo "Temperatura no Data Center: $temperatura" exit 1; elif [ $tempe -lt "60" ] ; then echo "Temperatura no Data Center: $temperatura" exit 2; else echo "Aguarde nova checagem de temperatura em 2 minutos..." exit 3; fi exit 3;
Para testar o termometro ligado em outro servidor:
services.cfg define service{ use local-service ; Name of service template to use host_name servidor_em_que_esta_o_termometro service_description Checa a temperatura no DataCenter check_command check_themper_by_ssh check_period 24x7 } define command { command_name check_themper_by_ssh command_line $USER1$/check_by_ssh -H $HOSTADDRESS$ -4 -C "sudo /usr/src/pcsensor/check_themper" }
Para usar no nagios do proprio servidor:
define service{ use local-service ; Name of service template to use host_name localhost service_description Checa a temperatura no DataCenter check_command check_themper check_period 24x7 } define command { command_name check_themper_by_ssh command_line $USER1$/check_themper }