mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-01 00:24:21 +02:00
allow disabling of alerting per device, allow override of syscontact, minor cleanups
git-svn-id: http://www.observium.org/svn/observer/trunk@1995 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -33,11 +33,11 @@ foreach (explode("\n", $ports) as $entry)
|
||||
{
|
||||
foreach ($config['bad_if_regexp'] as $bi)
|
||||
{
|
||||
if (preg_match($bi ."i", $if))
|
||||
{
|
||||
$nullintf = 1;
|
||||
if (preg_match($bi ."i", $if))
|
||||
{
|
||||
$nullintf = 1;
|
||||
if($debug) { echo("ignored : $bi : $if"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,23 +48,25 @@ foreach (explode("\n", $ports) as $entry)
|
||||
if ($debug) echo("\n $if ");
|
||||
if ($nullintf == 0)
|
||||
{
|
||||
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) == '0') {
|
||||
mysql_query("INSERT INTO `ports` (`device_id`,`ifIndex`,`ifDescr`) VALUES ('".$device['device_id']."','$ifIndex','".mres($ifDescr)."')");
|
||||
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) == '0')
|
||||
{
|
||||
mysql_query("INSERT INTO `ports` (`device_id`,`ifIndex`,`ifDescr`) VALUES ('".$device['device_id']."','$ifIndex','".mres($ifDescr)."')");
|
||||
# Add Interface
|
||||
echo("+");
|
||||
echo("+");
|
||||
} else {
|
||||
mysql_query("UPDATE `ports` SET `deleted` = '0' WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'");
|
||||
echo(".");
|
||||
mysql_query("UPDATE `ports` SET `deleted` = '0' WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'");
|
||||
echo(".");
|
||||
}
|
||||
$int_exists[] = "$ifIndex";
|
||||
} else {
|
||||
# Ignored Interface
|
||||
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) != '0') {
|
||||
mysql_query("UPDATE `ports` SET `deleted` = '1' WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'");
|
||||
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) != '0')
|
||||
{
|
||||
mysql_query("UPDATE `ports` SET `deleted` = '1' WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'");
|
||||
# Delete Interface
|
||||
echo("-"); ## Deleted Interface
|
||||
echo("-"); ## Deleted Interface
|
||||
} else {
|
||||
echo("X"); ## Ignored Interface
|
||||
echo("X"); ## Ignored Interface
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,4 +95,4 @@ while ($test_if = mysql_fetch_array($query))
|
||||
unset($temp_exists);
|
||||
echo("\n");
|
||||
|
||||
?>
|
||||
?>
|
||||
Reference in New Issue
Block a user