sub alert_http_send_threshold { my ($arg_ref) = @_; my %args; # Get the IP address of the device which triggered the alert my $ipaddr = adb_result (sprintf ("get %s sys SNMP.ipaddr", $arg_ref->{device})); my $time_str = strftime ("%H:%M", localtime ($arg_ref->{tt})); my $child = ""; my $thr = $arg_ref->{thr}; my $val = $arg_ref->{val}; # Parse the MIB and object which triggered the alert my ($mib, $obj) = split (/\./m, $arg_ref->{attr}, 2); # Apply formatting to interface thresholds if ($mib eq "IF-MIB") { given ($obj) { when (/if.*BitRate/m) { $thr = int_ifspeed ($thr); $val = int_ifspeed ($val); } when (/if.*Util/m) { $thr = int_util ($thr); $val = int_util ($val); } default { $thr = int_metric ($thr); $val = int_metric ($val); } } trim $val; $child = $arg_ref->{child}; # interface name } # Call remote server $args{url} = sprintf ("http://www.example.com/alert?ipaddr=%s,ifname=%s,time_str=%s,thr=%s,val=%s", $ipaddr, $child, $time_str, $thr, $val); $args{method} = "get"; $args{content_type} = "text/html"; http_send (\%args); http_close (); # Call remote server to execute scripts http_send ({ url => "http://www.example.com:8080/script?name=my_script.txt", method => "GET", content_type => "text/html", }); }