我目前在 Linux 上运行 Nagios 3,Windows 客户端使用 NSClient++。Windows 客户端 (8) 将置于炎热潮湿的环境中。我在 Nagios 下对 CPU、RAM 等进行了所有基本检查。但我需要找到一种方法来监控 CPU 温度,然后将这些值报告回 Linux 服务器。我见过一些解决方案,但它们很模糊。所有 Windows 机器都有 Supermicro MOBO。任何建议都将不胜感激。
答案1
我不太确定 CPU 监控,但你也应该考虑在放置此服务器的任何空间中进行环境监控。这将使你更好地了解空间中发生的事情,并且除了 CPU 温度之外还有更多检查
答案2
Linux 下有一个名为 lm-sensors 的工具可以读取温度/电压/风扇传感器。您可以简单地编写一个从传感器获取信息的 bash 脚本。此外,还有一个 perl 脚本可以为您完成这项工作,请查看此堵塞 但首先您必须安装 lm-sensors。
答案3
如果你有 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);
}
?>