Maintenance email alerts

We’d like to setup email alerts for when there are issues with our displays, which we sometime happen due to poor wifi connections. I’ve gone ahead and setup the maintenance page, created a scheduled task and it setup email on the server host. The problem is the system doesn’t email me where there is an issue, but does email me when the display has recovered… I tried to simulate the problem by disabling the nic on one of the displays. The max display time out is set to 5 minutes. After re-enabling the nic on the display, I get a Recovery for Display email from the system.

Anything else I need to check/change to get this working?

We had the same problem at first.I found the messages in the spam folder. Have you checked your spam filter/folder?

No, nothing in the spam folder. We’re running the server on WAMP, but i don’t see that as a problem.

Also, I’m getting hit with a double Recovery email for displays. Is that because I have email alerts setup globally as well as on individual displays?

Are there any other email alerts we can test the system with?

We are also running WAMP on our test server, so that I don’t think is a problem.

I would think that would explain two emails of the same notification.

What doesn’t make sense is that you get the recovery email and not the initial alert.

How did you set up the maintenance script? Is it running continuously?

Double recovery emails are normal. It’s because the recovery email is sent when the Player connects up to the CMS - and all the recent players fire up multiple simultaneous connections to the CMS. If they hit at exactly the same moment, you get a race condition and that can end in a couple of emails being sent.

If you’re not getting the down message, check you’re on 1.7.4. There were bugs in older versions regarding that.

We’re on 1.7.4. Task seems to be configured properly. Here are the screenshots.

I was going to check the logs, but they’re empty, which is weird. My log level is set for errors only and server mode is in production. Should I change that to be able to get some kind of debug info?

0xFF in the status field suggests it’s not being run successfully?

If you run that command line from the last screenshot manually does it work OK?

Alex

If i run that command manually in the command prompt, nothing really happens but i don’t get an error. What kind of output should I be getting?

What’s be the status code I should I be seeing? 0x0?

Plus if I look at the History tab of the scheduler (listed in the first screenshot), it reports successfully completing tasks. Also, if I get the recovery emails, wouldn’t that mean that maintenance is working ok?

I’d expect to see html output I think. If you call it from a browser you should?

i can’t really run maintenance.php manually in protected mode because the password is spaced after maintenance.php, if I switch the maintenance mode to On, I get the email alerts I was looking for.

The output is:

Email Alerts
AAA
Tidy Logs

So that looks like an issue with a task scheduler or maintenance being in protected mode.

You just call http://server/xibo/maintenance.php?key=keyhere

It may be something to do with it being called from the command line on Windows. You could use a Windows version of curl or wget to call the webserver URL instead of calling PHP directly.

1 Like

The problem is running it as a task, when I run it on demand via a url whether it’s its a curl script or just straight url - maintenance.php it works, but having it scheduled is where it breaks… Even tried it as a batch file, no go. Still trying to figure this out.

ozhovnir,

You may want to try this, as it works for us on Server 2012.

General Tab:
Run using the Administrator Account
Check “Run whether the user is logged in or not” and "Run with the highest privileges"
Configure for “Windows Vista, Windows Server 2008”

On the Trigger Tab:
Make a new trigger
Begin Task on a Schedule
Daily, pick a time, not really important when
Check to repeat, set it for every 5 mins for a duration of 1 day
Nothing else should be checked, except for “Enabled”

Action Tab:
Program/script

"C:\Program Files (x86)\PHP\php-win.exe" 

Or path to the php-win.exe file Do not put anything else in there. Make sure you have the double quotes at the beginning and end of the path.

Add Arguments (optional)

-f "C:\path\to\xibo\maintenance.php" passwordhere 

Make sure you have the double quotes at the beginning and end of the path.

Start in (optional)
Leave this blank

Conditions Tab:
Only Check “Start the task only if the computer is on AC power"
and
"Wake the computer to run this task” (Your server shouldn’t be sleeping anyway)

Settings Tab:
Check “Allow task to be run on demand”, “Run task as soon as possible after a scheduled start is missed”, “Stop the task if it runs longer than: 3 days”, “If the running task does not end when requested, force it to stop”

Make sure “Do not start a new instance” is selected

I think that will do it.

Oh last thing, Windows will always report the (0XFF) on completion, however the script does run, and the maintenance emails are generated.

The (0xFF) is logged because the file being ran cannot return the proper exit code to windows. I am not sure how you could make it do so. I think that the PHP script would need to somehow alert PHP and/or Apache, and then the success command would need to be sent back to Windows.

The only other option is to use a batch file with the last line being “exit”. But still this will not return the correct response as it is only saying that the batch file exited correctly. Although this might be helpful.

I would love to know if you come up with a working, correct solution for the result code.

I finally got this figured out. For some reason running php.exe or php-win.exe as a scheduled task was a problem. I had to create a batch file that had a wget command in there to fetch the url. In the schedule I had to fill in the Start In (optional) field even though the Program listed the full path to the .bat file.

The only little issue is the double email on recovery of a player due to a race condition, but hopefully it’ll be fixed in 1.8

Thanks for your help.

1 Like

It won’t be fixed. I’ve explained why it’s not possible before :smile:

I’m glad you have your alerts working though.