I was trying the following script but I get no variable when trying to parse this way:
sub Main{
$source = $Fields->{VarRawMessageText};
my ($IP) = $source =~ /^\S+/;
$Fields->{VarCustom01} = $IP;
return "OK";
}
The VarRawMessageText should be the following: 127.0.0.1 1.2.131.24.14.1 etc etc
If I remove tags the agent_ip= is not that and the above regex should be correct but the script is not parsing it. I am using 8.3 of Kiwi (I do intend to upgrade but it's a production box)
I created a rule to run this script in the action and then I am calling %VarCustom01 to forward as the originator IP. The reason is I am forwarding SNMP traps from Cisco Prime to Kiwi and then to NCM. (there's some crazy logic as to why)