Simon icon Simon
Flexible server monitoring

Script Notifier not firing

Hello,

I got the latest Simon version and I have a problem with a Script Notifier, my settings are the following.

Notifier Options:

Change -> after 1 consecutive changes
Failure -> after 2 consecutive errors (only notify once)
Recovery -> after 1 recoveries (only if failure notified)

Notifier Kind -> Script
* No custom variables *

Script type -> PHP: /usr/bin/php

Script

<?php
...
?>

Summary of Script
The script basically checks the {TestStatusType} variable and send the appropriate message by email (to a gmail).

My Problem
If I go in the Notifier menu and I hit Notify Now on my Notifier, it works but in the event of a Change for example, the script is not triggered at all and an entry in the Notifications section is added with the correct informations.

I modified my script to be really simple, write a text file on my Desktop to see if it would work. It didn't.

Script was:

<?php
file_put_contents
('/Users/myuser/Desktop/simon.txt', "test", FILE_APPEND | LOCK_EX);
?>

I have no idea how to fix this. Does anyone has an idea?

I have the Enterprise license

David Sinclair's picture

Re: Script Notifier not firing

The first question I should ask is, do you have the notifier chosen in the relevant test(s)? Double-check that. If Notify Now works, it should work for a Change etc from a test.

wedix's picture

Yes, it is checked for all

Yes, it is checked for all tests (Change, Failure and Recover). Now, something weird just happened, I just received an alert from Simon because of a Change event. I checked the notifications section and it is there were a whole lot of other notifications I didn't get.

I attached a screenshot. All the events were Change. I only got the last one.

http://bit.ly/SJmq9

David Sinclair's picture

Re: Yes, it is checked for all

Okay, it sounds like things are set up properly... but just to double-check, since you said "checked for all tests" which implies the checkboxes in the Edit Notifier window, is it also chosen in the Edit Test > Notifiers section of the relevant test(s). (See that User Guide page for clarification of what I mean.)

If a notification is logged in the Notifications list, that means that the notifier was used, which is why I think it sounds okay. So perhaps the issue is with the script... perhaps it needs to escape some characters or something? Hard to say without seeing the script.

wedix's picture

Here are 2 screenshots of

Here are 2 screenshots of the Edit Notifier Window and the Test Window

http://bit.ly/2kKVcS
http://bit.ly/17ZIeM

I did a few test to try to figure out how it works. I noticed the following.

On modifications that are not visible () most time, I wont get notified
If I change something, run a check, than revert back, I won't get notified

I will send you the script by e-mail.

David Sinclair's picture

Everything seems configured

Everything seems configured okay, as far as I can tell.

I can't really figure out what the problem is, though. Another idea: try adding another Change notifier, perhaps a Sound one or similar, to check that it is used when expected. If that works but your script still doesn't, that would tend to confirm that the script has a problem (though it does seem okay).

wedix's picture

I don't have the time to try

I don't have the time to try on different setups although when I do I will post back the results. It seems odd because it always worked fine in the past.

Is there a way to turn on debug on Simon by any chance?

Thank you for the support you've given so far. It's awesome!

David Sinclair's picture

I try, though it can be

I try, though it can be frustrating when I can't figure out what the problem is. I want to help.

Some plugins have debug modes, set via Terminal commands (WebDebugMode, PortDebugMode, PingDebugMode, EmailDebugMode, and RemoteWebDebugMode). But not Script, unfortunately. When run as a Service, it outputs everything; you can see it via Preview. So you could try the script that way, perhaps, with simulated variables.

Error and debug logging is something I want to improve further in a future version.

About all else I can suggest is for you to email me your Simon data, and steps to recreate the problem, so I can try it myself, and perhaps come up with a fix, if it does turn out to be a bug.

wedix's picture

I switched to Email notifier

I switched to Email notifier instead of my script. I'm using Gmail filters to properly dispatch the alerts and it seems to be working perfectly. My only concern is I'm probably going to need to add a custom script in the future to send SMS via my own SMS gateway.

Hopefully 2.6 will be out be then, but for now Gmail does the job.