Using MRTG's threshold feature to execute a php script

Posted by Dan Fried on Server Fault See other posts from Server Fault or by Dan Fried
Published on 2011-01-17T19:17:52Z Indexed on 2011/01/17 19:55 UTC
Read the original article Hit count: 281

Filed under:
|

I've set up mrtg using the online manual and the only online tutorial I found on the subject of thresholds, and the threshold just isn't firing.

In my mrtg.cfg file, the relevant lines are

ThreshDir: /path/to/mrtg/thresh
ThreshMaxI[performance]: 1
ThreshMaxO[performance]: 1
ThreshProgI[performance]: /path/to/mrtg/scripts/alert.php
ThreshProgO[performance]: /path/to/mrtg/scripts/alert.php

The paths are right, because if I enter the paths wrong I get an error on executing mrtg. websitePerformance checks how long it takes to download the homepage, in milliseconds, so it should be exceeding the max every time.

Alert.php is working fine when invoked directly from the shell, and when I point to a nonexistent script it tells me the script is not executable.

No error messages are being generated, that I can find.

The thresh directory is always empty.

Why isn't the threshold being triggered by results that are greater than 1? Anyone have any suggestions?

© Server Fault or respective owner

Related posts about monitoring

Related posts about mrtg