sub alert_status_send_syslog { my ($arg_ref) = @_; my $msg; # Modify the following parameters. You must set $dest_ip to enable this script. # Refer to the Site Script documentation at www.akips.com for details my $dest_ip = ""; # IP address of remote syslog collector my $priority = "error"; my $facility = "local3"; # Get the IP address of the device which triggered the alert my $dev_ip = adb_result (sprintf ("get %s sys SNMP.ipaddr", $arg_ref->{device})); my $time_str = strftime ("%Y-%m-%d %H:%M:%S%z", localtime ($arg_ref->{tt})); #my $time_utc = strftime ("%Y-%m-%d %H:%M:%SZ", gmtime ($arg_ref->{tt})); # Parse the MIB and object which triggered the alert my ($mib, $obj) = split (/\./m, $arg_ref->{attr}, 2); # The following formats the message similar to Status Alerting email messages. if ($mib eq "IF-MIB") { $msg = sprintf ("%s %s %s %s %s %s %s", $time_str, $arg_ref->{alias} || "", $arg_ref->{device}, $dev_ip, $arg_ref->{child}, # interface name $arg_ref->{descr}, $arg_ref->{state}); } else { $msg = sprintf ("%s %s %s %s %s %s", $time_str, $arg_ref->{alias} || "", $arg_ref->{device}, $dev_ip, $arg_ref->{descr}, $arg_ref->{state}); } # Send the syslog message if ($dest_ip ne "") { syslog ({ ipaddr => $dest_ip, priority => $priority, facility => $facility, message => $msg, }); # Send message to 'alert' log for debugging purposes errlog ($ERR_ALERT, "syslog $dest_ip $priority $facility $msg"); } }