close
在 Enfuzion 和 Mysql 都設定好了之後,
接下來就是要編寫 opsview 的 plugin。
#!/usr/bin/perl
use DBI;
$dbh = DBI->connect('dbi:mysql:database=opsview;host=172.16.69.27','enfuzion','12345678');
$sql = "select status from `enfuzion_node_status` where host like '$ARGV[0]'";
$sth = $dbh->prepare($sql);
$sth->execute || die "Could not execute SQL statement ... maybe invalid? \n\n $sql \n";
@row=$sth->fetchrow_array;
if (defined (@row) != 1) ## 如果找不到資料,就顯示 unknown,並設定狀況為 Critical
{
@row = unknown;
print "CRITICAL: Node Status is @row\n";
exit 2;
}
else
{
print "OK: Node Status is @row\n";
}
全站熱搜
留言列表