Zabbix watch a MySQL table -
I have an application that logs events in the table in MySQL, timestamps in each entry (row), position and Other arbitrary bits of some metadata
Very simple form can appear something like log_id in the logs table. Day-time Result code | Message:
I think it is probably a bit ambitious to go away zobbis and ask directly to the figures, but I am wondering how it can be made and architectural.
Write a separate process that queries the table and a log file, but it seems a bit clunky, I can have a script run from zabbix_agent.conf, but I'm not sure that the jebics will How to convert data into metrics.
The way I understand this question, in the same way, Have to be able to monitor.
If so, this question is in two parts: (1) How to choose the database for only new records and (2) how to send data to Zabbix in a way that it can understand I (1) will leave you, but instead will offer a way to deal with (2).
We can model the solutions for Zabbix agent deals with the Windows Event Log (2) solution. If we ask the Zbbix agent to monitor on Windows, then, "Eventown [Applications]", we will see that this jabix sends a JSON to the server as follows:
{"Data": ["clock": 1398753145, "ns": 928525552, "event": 9003, "host": "windows 2008", "key": "event [application]", "last logsize": 51 , "Severity": 1, "Source": "Desktop Window Manager", "Timestamp": 1375273705, "Value": "Desktop Window Manager ... was disabled in ..."}, "A Nupur ":" Agent Data "}
Now, we can send the data that we want to use the same protocol. For example, depending on your simplified form of the log table, we can put "log_id" into "last logs", "timestamp", "eventcode" in "event", and "value" in "message". After this, we can send this data to the Zabbix server using the feature / Misc / debug / sender.pl script available in the Zbbix source code:
$ cat mysql.json {"data" : "Event" [mysql.log], "Last logs": 1 ["" clock ": 1398753145," NS ": 928525552," EventList ": 12345," Host ":" MySQL Server "," Key " "My application", "Timestamp": 1375273705, "Value": "My application was unable to ..."}, "Request": "Agent Data"} $ ./sender.pl -h 127.0.0.1-P10051 -i mysql.json ZBXD ^ {"response": "Successful Class "," information ":" process: 1, failed: 0 Total: 1 seconds spent: 0.000130 "}
There are two caveats, though. One is that to enjoy the Windows Event Log features in the Zbbix frontend ("Monitoring" -> show the Windows Event Lodge column in "Latest Data") one key should start with "EventGroup". The second is that the "last logs" should be incremented with each record you send, but if you are using "log_id" for "lastlogsize" which will come naturally.
In addition to this, you should now enjoy the log event (), logarithy (), and logsource () and {ITEM.LOG.EVENTID}, {ITEM.LOG.SEVERITY}, and {ITEM.LOG Specific Windows event logs like SOURCE}.
The example configuration of an item can be as follows:
Comments
Post a Comment