@ -1867,6 +1867,7 @@ sub check_interfaces
my $clear = 0;
my $key = "scan_network_alert_0036";
my $alert_level = "notice";
if ($new_duplex eq "full")
{
# Duplex is back to being OK
@ -1874,6 +1875,13 @@ sub check_interfaces
$key = "scan_network_alert_0037";
}
# Is this one of our interface?
if (not $anvil->Network->is_our_interface({interface => $network_interface_name}))
{
# Not an interface we care about.
$alert_level = "notice";
}
my $variables = {
name => $network_interface_name,
old => $old_duplex,
@ -1882,7 +1890,7 @@ sub check_interfaces
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => $key, variables => $variables});
$anvil->Alert->register({
alert_level => "warning" ,
alert_level => $alert_level ,
clear_alert => $clear,
message => $key,
variables => $variables,
@ -1891,12 +1899,13 @@ sub check_interfaces
}
if ($new_link_state ne $old_link_state)
{
# This is always a warning
# This is always a warning, if it's a NIC we care about.
$changes = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { changes => $changes }});
my $clear = 0;
my $key = "scan_network_alert_0038";
my $alert_level = "warning";
if ($new_link_state)
{
# Link is up
@ -1904,6 +1913,13 @@ sub check_interfaces
$key = "scan_network_alert_0039";
}
# Is this one of our interface?
if (not $anvil->Network->is_our_interface({interface => $network_interface_name}))
{
# Not an interface we care about.
$alert_level = "notice";
}
my $variables = {
name => $network_interface_name,
old => $old_link_state,
@ -1912,7 +1928,7 @@ sub check_interfaces
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => $key, variables => $variables});
$anvil->Alert->register({
alert_level => "warning" ,
alert_level => $alert_level ,
clear_alert => $clear,
message => $key,
variables => $variables,
@ -1929,6 +1945,7 @@ sub check_interfaces
# Is it up or down?
my $clear = 0;
my $key = "scan_network_alert_0040";
my $alert_level = "notice";
if ($old_operational eq "DELETED")
{
# Link is back. Is it up?
@ -1951,6 +1968,13 @@ sub check_interfaces
$key = "scan_network_alert_0041";
}
# Is this one of our interface?
if (not $anvil->Network->is_our_interface({interface => $network_interface_name}))
{
# Not an interface we care about.
$alert_level = "notice";
}
my $variables = {
name => $network_interface_name,
old => $old_operational,
@ -1959,7 +1983,7 @@ sub check_interfaces
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => $key, variables => $variables});
$anvil->Alert->register({
alert_level => "warning" ,
alert_level => $alert_level ,
clear_alert => $clear,
message => $key,
variables => $variables,
@ -2038,6 +2062,13 @@ sub check_interfaces
$key = "scan_network_alert_0047";
}
# Is this one of our interface?
if (not $anvil->Network->is_our_interface({interface => $network_interface_name}))
{
# Not an interface we care about.
$alert_level = "notice";
}
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $log_level, key => $key, variables => $variables});
$anvil->Alert->register({
alert_level => $alert_level,
@ -2065,9 +2096,17 @@ sub check_interfaces
$key = "scan_network_alert_0049";
}
# Is this one of our interface?
my $alert_level = "notice";
if (not $anvil->Network->is_our_interface({interface => $network_interface_name}))
{
# Not an interface we care about.
$alert_level = "notice";
}
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => $key, variables => $variables});
$anvil->Alert->register({
alert_level => "warning",
alert_level => $alert_level ,
message => $key,
variables => $variables,
set_by => $THIS_FILE,
@ -2092,8 +2131,9 @@ sub check_interfaces
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { network_interface_uuid => $network_interface_uuid }});
}
# Speed changes? Likely.
# Track usage of interfaces we care about
if ($anvil->Network->is_our_interface({interface => $network_interface_name}))
{
# Rx and Tx almost always change, so they're only info-level alerts.
if ($new_tx_bytes ne $old_tx_bytes)
{
@ -2204,6 +2244,7 @@ sub check_interfaces
});
}
}
}
else
{
# Record the interface
@ -3407,13 +3448,11 @@ AND
source_name => $source_name,
}});
### TODO: Don't set / clear interfaces that appear down but aren't named ifn/bcn/sn as they're probably unconfigured/unusued interfaces.
# Don't set / clear interfaces that appear down but aren't named ifn/bcn/sn as they're probably
# unconfigured/unusued interfaces.
my $problem = 0;
my $check = 0;
if (($network_interface_name =~ /ifn/i) or
($network_interface_name =~ /sn/i) or
($network_interface_name =~ /bcn/i) or
($network_interface_name =~ /mn/i))
if ($anvil->Network->is_our_interface({interface => $network_interface_name}))
{
# One we monitor
$check = 1;