Linking Icinga2 to Python service

I want to use my Icinga2 instance to monitor some Modbus RTU devices.

The setup I am currently working on uses the python service to poll the Modbus device many times a second and I would to interface this Icinga2. The reason I want to use a separate service instead of polling direct is due to the frequency I need to poll, and the fact I need to perform some maths on the polled data (e.g 3694 -> 36.94). I need to check many times a second to see if the value is out of tolerance, but if it is OK, I only want to log it every five minutes.

Currently I have experimented with submitting passive checks from the python script, this works well. However the way I would prefer to do it is to have Icinga2 run scheduled checks against the service every 5 minutes, but also use the service to reschedule all checks instantly if a value falls out of tolerance.

I have managed to get python to reschedule a check, not a problem, the problem I have is best practice to interface Icinga2 to the python service.

I think the best approach to this would be to call a custom python plugin from icinga2. The python script would then use rabbitMQ to communicate with the python modbus service, retrieve the value, perform the math function, and return it to icinga2.

Does this seem logical? Or is it possible to use Icinga2 & RabbitMQ to communicate directly with the modbus service, and perform the math function within the service script?

Thanks

We have a bunch of custom scripts for monitoring , including python, perl, ruby, even tcl :slight_smile:

So it is should be the best way to integrate it.
Just make sure your script returns exit codes, output and perfomrance data if needed.

Also, we have custom scripts for monitoring RMQ queue status.