About to create a Perfdata Parser in Python. Any suggestions?

Hello Together,

I have already created a Python-Script to parse the Icinga2-Perfdata files, post-process the data and write it to a Postgresql-DB for my company.

I mainly created it in the first place, because we were not allowed to use InfluxDB for some reasons and I could not find a good solution available for this topic.
It turned out it also had some advantages if your need to post-process the perfdata, before visualising it in Grafana or something else.

For example your can add the acknowledgement-status from Icinga to the Perfdata-Output and according to that, adapt your status-code before importing it to database. In Grafana you can then not only show the dull old Ok-, Warning-, Critical-, Unknown-Status. But also for example Critical (Acknowledged). That way people know that somebody is on it, when they look at the dashboard.

Since the version I wrote for my company is very tailored, I am planning to write an improved open source version. If you have any suggestions, I am open to it.

I would create the functionality the following way.

  • One service (python-script) which monitors the Icinga-Perfdata directory, parses the file and splits it by service name into own files under a different directory.
  • One service (python-script) which parses the split files, gives the opportunity to do some post-processing and import it to a database of your choice.
  • There would be a default post-processor and the possibility to add a python-file with the service-name to a directory with a function or class, that does the job and returns the INSERT-Queries for the DB.

My original version handled exceptions very poorly, so very much looking forward to improve that in this version.