#!/usr/bin/php
<?
// checks Alert Table from AppearTV Elements
// v1.0 09.11.2011 initial release
// by Righter

// config
$snmpbin="/usr/bin/snmpwalk";
$comu="public";

$alert=exec("$snmpbin -Oqv -c $comu  -v2c $argv[1] RFC1155-SMI::enterprises.23916.3.1.4.1.1");
if ($alert != "No Such Instance currently exists at this OID" || preg_match("/Timeout/",$alert))
{
	$crit=exec("$snmpbin -Oqv -c $comu -v2c $argv[1] RFC1155-SMI::enterprises.23916.3.1.4.1.4");
}
else
{
	$ok="All is fine";
}

if ($crit)
{
	echo $crit;
	exit(2);
}
if ($ok)
{
	echo "$ok";
	exit(0);
}
?>

