I have an item setup to monitor fatal errors, and I want to add another item so that it calculates the count of the fatal errors and graphs them.
Using this key: log["/d2/httpd/logs/myDomain-error_log","PHP Fatal","UTF-8",100]
It properly gets the data that I'm wanting, however it will not graph this, I imagine I have to count the entries and get the format as an integer, but this does not work:
count(log["/d2/httpd/logs/myDomain-error_log","PHP Fatal","UTF-8",100], 60)
Any ideas of what my key should be, or how I would go about graphing this data to see over time how many errors there were?
Actions and triggers are working fine and doing what is supposed but unable to create graph out of it.
Zabbix does offer a way to parse timestamps out of the log entries. Let's use our very first log file monitoring item for this. Navigate to Configuration | Hosts, click on Items next to A test host, and click on First logfile in the NAME column.
Just like any other item, the log item has a full explanation with examples — explanation of the parameters, what does what in our documentation. To find this, go to Configuration > Items > Item types > Zabbix agent and here you will find the log item.
What worked for me:
Create item for parsing some string in log.
log["C:/Logs/log.log",ERROR]
. Zabbix agent (active)
Log
. This item should show all the lines from log with specified string "ERROR".
Second, create calculated item with escaped quotation marks:
my.special.app.error.count
Calculated
count("log[\"C:/Logs/log.log\",ERROR]", 60)
This would count how many times "ERROR" was repeated in log during 60 seconds.
Now this item can be graphed, triggered, etc.
I'm not really sure why parsing item is required, but without it this calculated item does not work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With