Accessing plugin output from Event command


I’m trying to write a simple event command to automatically respond to an alert in a specific service.

My plan was to pass the plugin output to the event command, in order to execute the proper action.

But I have not found a way to do that.

Any idea on how can I have it passed to the event command?

For a more clear understanding of the need here you have a specific description of my use case.

We have a PostgreSQL server containing around 40 different DB’s.

We are using check_pgactivity to monitor some parameters in the database. One of the checks we do is to identify btree bloated indexes.

The idea is that the event command will reindex any index reported by check_pgactivity as bloated.

For that I need a way to inform the event command which indexes are to be reindexed. For that, the plugin output is perfect, it contains a list of bloated index with index and database names.

Thanks in advance
Javier Vilarroig

Have a look at Object Types - Icinga 2 especialy $service.output$. Use arguments or env to pass it to your script - Object Types - Icinga 2.

Thanks I will do!

I will share here the outcome for further reference.

Hi @rivad

With your hit I manage to do what I wanted :slight_smile:

Thanks a lot.

Just to mention that this page Monitoring Basics - Icinga 2 is a good reference to find available macros available.


1 Like