Conditional Monitoring

Pandora FMS Software Agent supports the execution of scripts depending on the value returned by a module. There are two possibilities of action: using post-conditions and using preconditions; both of them consist of parameters that should be added in the definition of a module.

Postconditions

The module_condition parameter allows to define post-conditions to the execution of a module, commands that will be executed (or not) depending on the value returned by the execution of a certain module. Several conditions can be added to the same module.

module_begin
module_name CPU_Usage_Condition
module_type generic_data
module_exec get_cpu_usage.pl
module_condition < 10 start_new_server.sh
module_condition < 20 add_processes.sh
module_end

In this example, the CPU Usage module has two post-conditions added, involving the execution of the start_new_server.sh and add_processes.sh scripts when the module value falls below 10 and 20, respectively. With a value of 15, for example, only add_processes.sh would be executed.

Preconditions

The preconditions are set with the module_precondition parameter, and allow to evaluate a condition before the execution of the module. Depending on the result, the module will be executed or not. As in the post-conditions, several can be set for the same module.

module_begin
module_name CPU_Usage
module_type generic_data
module_exec get_cpu_usage.pl
module_precondition > 10 number_active_processes.sh
module_precondition = 1 important_service_enabled.sh
module_end

In the example, the module will only be executed if the script number_active_processes.sh returns a value greater than 10, while important_service_enabled.sh returns a value of 1. At the time that one of the two conditions is not met (e.g. if important_service_enabled.sh returns a 0), the module will not be executed.

Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support

Recent Discussions