Nagios&温度

我目前正在Linux上运行Nagios 3,Windows客户端使用NSClient ++。 Windows客户端(8)将被置于潮湿的高温环境中。 我有所有基本检查工作在Nagios下的CPU,内存等。 但我需要find一种方法来监视CPU温度,然后将这些值报告给Linux服务器。 我已经看到了一些解决scheme,但他们是模糊的。 所有的Windows机器都有Supermicro MOBO。 任何意见,将不胜感激。

我不确定CPU监控,但你也应该考虑在你把这个服务器的任何空间进行环境监控。 它可以让你更好地了解这个空间正在发生的事情,除了CPU温度外,还有更多的检查

http://nagios.org/products/environmental/

在Linux下有一个读取温度/电压/风扇传感器的工具,命名为lm-sensors。 你可以简单地做一个bash脚本,从传感器获取信息。 此外,还有一个perl脚本,为你做这项工作,请检查这个插件,但首先你必须安装lm-sensors。

如果你有SuperMicro IPMI卡,那么这里的一位先生写了一个Nagios插件来查询IPMI接口的这些指标。

#!/usr/bin/php -q <? /* * check_ipmi for checking Supermicro IPMI on remote machine * Gary Stimson 28aug2006 */ $sIpmiTool = '/usr/bin/ipmitool'; if ($argc!=4) { print "Usage: ".$argv[0]." user password host\n"; exit(3); } $sUser = $argv[1]; $sPass = $argv[2]; $sHost = $argv[3]; $rExec = 0; $aChassisLines= array(); $sCmd = "$sIpmiTool -U $sUser -P $sPass -H $sHost chassis status"; $s = exec($sCmd, &$aChassisLines, &$rExec); if ($rExec) { print "Warning: Error running ipmitool command: $sCmd:" . implode("\n",$aChassisLines) . "\n"; exit(1); } $aChassisStatus=array(); foreach($aChassisLines as $sLine) { $aMatch = array(); if (preg_match('/(.*): (.*)/', $sLine, $aMatch)) { $aChassisStatus[trim($aMatch[1])] = $aMatch[2]; } } if (count($aChassisStatus) < 8) { print "CRITICAL: Could not parse output from chassis list."; exit(2); } if ($aChassisStatus['System Power'] != 'on') { print "OK: Switched off"; exit(0); } $iR = 0; $asR = array(); $aChassisChecks = array('Power Overload', 'Main Power Fault', 'Power Control Fault', 'Drive Fault', 'Cooling/Fan Fault'); foreach ($aChassisChecks as $sCheck) { if ($aChassisStatus[$sCheck] != 'false') { $iR = 2; $asR[] = $sCheck; } } $rExec = 0; $aSDRLines = array(); $sCmd = "$sIpmiTool -U $sUser -P $sPass -H $sHost sdr list"; $s = exec($sCmd, &$aSDRLines, &$rExec); if ($rExec) { print "Warning: Error running ipmitool command: $sCmd:" . implode("\n",$aSDRLines) . "\n"; exit(1); } if (count($aSDRLines) < 10) { $iR = 2; $sR = "Could not get sdr list. Machine uncontactable or other fault."; } $bParseErrorDone = false; foreach($aSDRLines as $sLine) { $aFields = explode('|',$sLine); if (count($aFields) < 3) { continue; } $sCaption = trim($aFields[0]); $sDetail = trim($aFields[1]); $sStatus = trim($aFields[2]); // Power supply always seems to have 'cr' status so omit it from this check // It is checked by the chassis check anyway // Ignore Intrusion as well. if ($sCaption != 'Power Supply' && $sCaption != 'Intrusion' && $sStatus != 'ok') { $iR = 2; $asR[] = "$sCaption status '$sStatus': $sDetail"; } } $sR = implode('; ', $asR); switch($iR) { case 0: print "OK\n"; exit(0); case 1: print "Warning: $sR\n"; exit(1); case 2: print "CRITICAL: $sR\n"; exit(2); } ?>