Greetings,
The patch adds a item function:
txtcount(string search,int time_limit)
valcount(string search,int time_limit)
Functionality
Basically what it does is count the number of occurrences of 'string' in items of type: "str, log and text".
Supply a time_limit (of seconds) and it will not search the entire item history but only the 'time_limit' most recent values.
Purpose:
I am using this function to count the the number of occurrences of "Job Failed" in a backup log within the last 24 hours.
The search string uses: "LIKE '%search%'" meaning it will match:
"On machine xxx Job Failed, no media inserted."
These messages come from an email which is parsed and imported into zabbix via zabbix_sender.
The log is readable by human beings and with this function alertable with zabbix.
I'm sure one can find other uses for txtcount
EDIT:
Indeed other uses could be found for it, a more generalized version named 'valcount' which can also count occurrences of numeric values.
Which means if you search numeric items (float or int64) the match will be exact (value='search').
You could use this to count count the number of times something has changed state, eg. the number of times your ftp server has gone down within the last hour or whatever you feel like.
Patch is found below:
The patch adds a item function:
txtcount(string search,int time_limit)
valcount(string search,int time_limit)
Functionality
Basically what it does is count the number of occurrences of 'string' in items of type: "str, log and text".
Supply a time_limit (of seconds) and it will not search the entire item history but only the 'time_limit' most recent values.
Purpose:
I am using this function to count the the number of occurrences of "Job Failed" in a backup log within the last 24 hours.
The search string uses: "LIKE '%search%'" meaning it will match:
"On machine xxx Job Failed, no media inserted."
These messages come from an email which is parsed and imported into zabbix via zabbix_sender.
The log is readable by human beings and with this function alertable with zabbix.
I'm sure one can find other uses for txtcount

EDIT:
Indeed other uses could be found for it, a more generalized version named 'valcount' which can also count occurrences of numeric values.
Which means if you search numeric items (float or int64) the match will be exact (value='search').
You could use this to count count the number of times something has changed state, eg. the number of times your ftp server has gone down within the last hour or whatever you feel like.
Patch is found below:
Comment