Hi,
I’m using this code into a rule to find some match into a string for each items into a group:
grpZabbixPing_Souliss.members.forEach[node |
//Recupero il valore del Ping
var Pattern mypattern
var String ptn = ".*"+node.name+" check ICMP ping \\d\\d\\d\\d-\\d\\d-\\d\\d \\d\\d:\\d\\d:\\d\\d (\\d)"
logInfo("Monitor-SoulissPing","Pattern: "+ptn)
mypattern = Pattern::compile(ptn)
var Matcher mymatcher
mymatcher = mypattern.matcher(results)
mymatcher.find()
var String my_result
my_result = mymatcher.group(1)
logInfo("Monitor-SoulissPing","Nodo: "+node.name+ " Ping Status: "+my_result)
]
It happen that on first check the RegEx code do not found any results then rule end, but I need code will be executed for each item in my group.
I find this in log:
[ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Zabbix Souliss Ping Status': No match found
Any suggestion?
Thanks