Book Image

Learning Nagios 3.0

Book Image

Learning Nagios 3.0

Overview of this book

Table of Contents (16 chapters)
Learning Nagios 3.0
Credits
About the Author
About the Reviewer
Preface

Event Handlers


Event handlers are commands that are triggered whenever the state of a host or service changes. They offer functionality similar to notifications. The main difference is that the event handlers are called for each type of change and even for each soft state change. This provides the ability to react to a problem before Nagios notifies it as a hard state and sends out notifications about it. Another difference is what the event handlers should do. Instead of notifying users that there is a problem, event handlers are meant to carry out actions automatically.

For example, if a service defined with max_check_attempts set to 4, the retry_interval set to 1, and the check_interval is set to 5, then the following example illustrates when event handlers would be triggered, and with what values, for $SERVICESTATE$, $SERVICESTATETYPE$, and $SERVICEATTEMP$ macro definitions:

Event handlers are triggered for each state change — for example, in minutes, 10, 23, 28, and 29. When writing...