How To: Txt / Email alerts when Blue Iris Web Server is down

Mike

Staff member
Joined
Mar 9, 2014
Messages
2,982
Reaction score
2,725
Location
New York
Several months ago I was looking into simple (external) website monitoring solutions to monitor my Blue Iris web server and came across a method that uses Google Docs. I've been using it for 3 months now and it's been really reliable. Occasionally I will get a false alert, but once the alert is received, I open the BI app and see if it can connect. If it connects I know it's a false alarm, if not, then it's time to either remotely reboot the computer or figure something else out.

Here is how to do it:

Here’s how you quickly configure Google Docs to monitor the uptime /downtime of your website(s). This has to be done just once and Google Docs will continuously monitor all your sites in the background. Let’s get started:

  1. Sign-in to your Google account and then click here to copy this Google sheet into your Google Drive. You may use your Google Apps account as well.
  2. Put your website URLs in cell B2 (comma separated) and your email address in cell B3. If you wish to receive alerts by text messages, put Yes in cell B4 (unless you are using your cell providers e-mail address - ex: phonenumber@messaging.sprintpcs.com).
  3. You’ll find a new Website Monitor menu in your Google Sheets toolbar. Click Initialize and you’ll get a pop-up asking for authorization. Grant the necessary access.
  4. Go to the Website Monitor menu again and choose “Start Website Monitor” to begin the monitoring process. Close the Google Sheet.

website-monitor-sms.png
That's it! You will be notified when the script cannot access the web address.

You will notice that Google's bot will be on your login page throughout the day, but it is not attempting to login and I personally have not noticed any increase in CPU usage. You can also edit the script and tweak it to your liking. By default it's set to monitor your website every 5 minutes, but you can change that value within the script. The script uses URLFetchApp.fetch (a Google function similar to wget or curl) and if the HTTP response code is anything other than 200 then it will trigger the alert, indicating there is an issue accessing the site. The uptime and downtime are logged within the same spreadsheet which is convenient so you can see when the script couldn't access the site, then again when the script is able to re-access the site.

If you set up the script to send alerts to your phone # (rather than using your cell providers e-mail address to send the message, such as phonenumber@messaging.sprintpcs.com), then the script sends alerts by creating an event in your Google Calendar but with an SMS reminder. The event is set to expire in 30 seconds alerting your phone instantly. If you aren't getting text alerts on your phone, please ensure that your phone number is associated with Google Calendar as detailed in this tutorial. If you do not want to use the calendar method but still want to receive SMS alerts, you can simply use your cell providers e-mail address (mentioned above) and select "NO" for SMS notifications (this is how I am doing it).

Please note that I have a domain name set up for my Blue Iris web server so I have not tried this script using an IP address, but I don't see why it wouldn't work the same. You also must have "Secure Only' selected in 'Blue Iris Options -> Web Server -> Advanced'.

I am also still using Blue Iris Tools locally as a Watchdog that monitors Blue Iris and the Blue Iris web server.

I do not take credit for this script / solution, I am simply sharing it to the community. I found it here - http://www.labnol.org/internet/website-uptime-monitor/21060/
 

hmjgriffon

Known around here
Joined
Mar 30, 2014
Messages
3,401
Reaction score
980
Location
North Florida
Several months ago I was looking into simple (external) website monitoring solutions to monitor my Blue Iris web server and came across a method that uses Google Docs. I've been using it for 3 months now and it's been really reliable. Occasionally I will get a false alert, but once the alert is received, I open the BI app and see if it can connect. If it connects I know it's a false alarm, if not, then it's time to either remotely reboot the computer or figure something else out.

Here is how to do it:



That's it! You will be notified when the script cannot access the web address.

You will notice that Google's bot will be on your login page throughout the day, but it is not attempting to login and I personally have not noticed any increase in CPU usage. You can also edit the script and tweak it to your liking. By default it's set to monitor your website every 5 minutes, but you can change that value within the script. The script uses URLFetchApp.fetch (a Google function similar to wget or curl) and if the HTTP response code is anything other than 200 then it will trigger the alert, indicating there is an issue accessing the site. The uptime and downtime are logged within the same spreadsheet which is convenient so you can see when the script couldn't access the site, then again when the script is able to re-access the site.

If you set up the script to send alerts to your phone # (rather than using your cell providers e-mail address to send the message, such as phonenumber@messaging.sprintpcs.com), then the script sends alerts by creating an event in your Google Calendar but with an SMS reminder. The event is set to expire in 30 seconds alerting your phone instantly. If you aren't getting text alerts on your phone, please ensure that your phone number is associated with Google Calendar as detailed in this tutorial. If you do not want to use the calendar method but still want to receive SMS alerts, you can simply use your cell providers e-mail address (mentioned above) and select "NO" for SMS notifications (this is how I am doing it).

Please note that I have a domain name set up for my Blue Iris web server so I have not tried this script using an IP address, but I don't see why it wouldn't work the same. You also must have "Secure Only' selected in 'Blue Iris Options -> Web Server -> Advanced'.

I am also still using Blue Iris Tools locally as a Watchdog that monitors Blue Iris and the Blue Iris web server.

I do not take credit for this script / solution, I am simply sharing it to the community. I found it here - http://www.labnol.org/internet/website-uptime-monitor/21060/

Wow, I wonder how someone figured that out lol. I wonder if you could use something like IFTTT to do something similar? Hmmmm.
 

networkcameracritic

Getting the hang of it
Joined
Mar 10, 2014
Messages
719
Reaction score
203
I wrote a simple script that you can run in the background on a schedule to check each camera and/or BI is up and sends an email if there's a problem.
 
Joined
Mar 12, 2014
Messages
12
Reaction score
3
Most probably I am missing something....but BI has a watchdog for cameras itself (pretty powerful and flexible). The only thing that BI cannot monitor/watch is ... own process :)
Therefore there's the (also free) PCMonitor solution (having even free Android/Iphone/WinPhone clients) which monitors the BI process, the BI webserver and MUCH more...
I am not affiliated with PCMonitor but I am actively using it (monitoring up to 5 systems by using 1 user) since last year and it works pretty well.
 

Mike

Staff member
Joined
Mar 9, 2014
Messages
2,982
Reaction score
2,725
Location
New York
Most probably I am missing something....but BI has a watchdog for cameras itself (pretty powerful and flexible). The only thing that BI cannot monitor/watch is ... own process :)
Therefore there's the (also free) PCMonitor solution (having even free Android/Iphone/WinPhone clients) which monitors the BI process, the BI webserver and MUCH more...
I am not affiliated with PCMonitor but I am actively using it (monitoring up to 5 systems by using 1 user) since last year and it works pretty well.
The watchdog features in Blue Iris are for cameras, this is for monitoring the web server. I personally use all the Watchdog features in my program, Blue Iris Tools, to monitor locally and as a plus collect the weather. This external / third party solution monitors the web server in the event that the entire computer freezes, loses power, loses internet, etc.
 
Joined
Mar 12, 2014
Messages
12
Reaction score
3
This is exactly my point :) Why would somebody write a "script that you can run in the background on a schedule to check each camera" if this functionality works already pretty well inside BI itself :)
BI Tools makes sense as it works as a watchdog for the BI process/webserver.

Attached is a screenshot from the PCMonitor; it shows the notification activated for the blueiris process in case it does not respond or disappears...

pcmon.jpg
 

Mike

Staff member
Joined
Mar 9, 2014
Messages
2,982
Reaction score
2,725
Location
New York
This is exactly my point :) Why would somebody write a "script that you can run in the background on a schedule to check each camera" if this functionality works already pretty well inside BI itself :)
BI Tools makes sense as it works as a watchdog for the BI process/webserver.

Attached is a screenshot from the PCMonitor; it shows the notification activated for the blueiris process in case it does not respond or disappears...

View attachment 650
I never said anything about a script that checks each camera. This script isn't for that, this is for monitoring the uptime of your BI web server from outside your own network. Just another solution that I wanted to share with the community.
 
Joined
Mar 12, 2014
Messages
12
Reaction score
3
I was obviously commenting on the comment added by networkcameracritic. If I would knew it generates so many 'words' I would have refrained myself from commenting it :)
 

Mike

Staff member
Joined
Mar 9, 2014
Messages
2,982
Reaction score
2,725
Location
New York
I was obviously commenting on the comment added by networkcameracritic. If I would knew it generates so many 'words' I would have refrained myself from commenting it :)
Oops, didn't see his comment. My mistake.

Not sure what you're talking about regarding generating so many 'words', forums usually do that ;) Regardless, I think I've made myself clear on to what this script is designed to do and hopefully it will help a few people.
 

networkcameracritic

Getting the hang of it
Joined
Mar 10, 2014
Messages
719
Reaction score
203
My Windows script is generic, just makes an HTTP request, does not get an answer, it assumes the device or software is dead regardless of brand of camera or brand of software. Other tools I looked at either ping'ed a device but devices can be pingable but no responsive or they check for a specific program to be running, again, no check to see if you can actually connect to the software or camera.
 

hmjgriffon

Known around here
Joined
Mar 30, 2014
Messages
3,401
Reaction score
980
Location
North Florida
My Windows script is generic, just makes an HTTP request, does not get an answer, it assumes the device or software is dead regardless of brand of camera or brand of software. Other tools I looked at either ping'ed a device but devices can be pingable but no responsive or they check for a specific program to be running, again, no check to see if you can actually connect to the software or camera.

What HTTP request do you make to check if the camera is responsive?
 

networkcameracritic

Getting the hang of it
Joined
Mar 10, 2014
Messages
719
Reaction score
203
It's a pretty simple script (file type VBS). You can tweak it to suit you, like check BI web server is working.

Option Explicit

Dim strMsg, strCameras(5), strCamera, intGood
' This is a Windows script to check if cameras are up
' If it can't establish an HTTP connection to a
' camera, it sends an email to alert you.
'
' This script runs transparently in the background
' and does not display anything, just sends an email
' if it can't connect to camera
'
' You can schedule this to run with Windows Task Scheduler
' as often as you like.
'
' To configure the SMTP email settings, see the SendAlert
' function below to set the appropriate parameters
'
' For each camera, add a strCameras(x) variable below
' with the camera IP address or it's domain name.
' You can append port numbers with a colon,
' just like if you entered it into a browser
' At the very top, there's a variable called strCameras
' with a number, set that number to the number of cameras
' minus 1 (ie, 4 cameras, set it to strCameras(3) ).
strCameras(0) = "192.168.1.10" ' Driveway
strCameras(1) = "192.168.1.20" ' Back Yard
strCameras(2) = "192.168.1.30" ' Left Yard
strCameras(3) = "192.168.1.40:8001" ' Front Door
strCameras(4) = "192.168.1.50" ' Right Yard
strCameras(5) = "192.168.1.60:8002" ' Street Camera

' Let the checking begin
For each strCamera in strCameras
If PingSite( strCamera ) Then
intGood = intGood + 1
Else
SendAlert( strCamera )
End If
Next

Function PingSite( myWebsite )
Dim intStatus, objHTTP

Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )

objHTTP.Open "GET", "http://" & myWebsite & "/", False
objHTTP.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MyApp 1.0; Windows NT 5.1)"

On Error Resume Next

objHTTP.Send
intStatus = objHTTP.Status

On Error Goto 0

Set objHTTP = Nothing

If intStatus = 200 Then
PingSite = True
Else
PingSite = False
End If
End Function
Function SendAlert( myWebsite )
Dim strSMTPServerPort, strUserName, strPassword
Dim objMail, strEmailFrom, strEmailTo, strSMTPServer
Set objMail = CreateObject("CDO.Message")
' Setup your E-Mail Parameters Here
strEmailFrom = "Camera <carl@gmail.com>"
strEmailTo = "carl@mymail.com"
strSMTPServer = "smtp.gmail.com"
strSMTPServerPort = 587
strUserName = "carl@gmail.com"
strPassword = "password"
objMail.From = strEmailFrom
objMail.To = strEmailTo
objMail.Subject = "Camera Down - " & myWebsite
objMail.Textbody = "Lost communication to camera at " & myWebsite
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTPServer
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = strSMTPServerPort
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = strUserName
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = strPassword
objMail.Configuration.Fields.Update
objMail.Send
Set objMail=Nothing
End Function
 
Joined
Jun 5, 2014
Messages
5
Reaction score
0
I set this up and it was easy as pie! I've been receiving A LOT of messages. Up, down, up down, up. I'm not sure what is causing them, but my feeds don't get interupted. Any idea why the script thinks i'm up and down and up again?

I have my recordings set to be stored in an external HD that is connected to my router, but as far as the webserver itself (that the script is checking) it should be pinging my PC which is always on and hasn't had any downtime.
 

Mike

Staff member
Joined
Mar 9, 2014
Messages
2,982
Reaction score
2,725
Location
New York
I set this up and it was easy as pie! I've been receiving A LOT of messages. Up, down, up down, up. I'm not sure what is causing them, but my feeds don't get interupted. Any idea why the script thinks i'm up and down and up again?

I have my recordings set to be stored in an external HD that is connected to my router, but as far as the webserver itself (that the script is checking) it should be pinging my PC which is always on and hasn't had any downtime.
Have you adjusted anything in the script? It will notify you when Google cannot access the web server so perhaps something is stopping Google from connecting. Do you have a firewall running that might be preventing this?
 
Joined
Jun 5, 2014
Messages
5
Reaction score
0
No adjustments to the script. I didn't consider firewall, I will have to double check when I get in front of my PC. I assumed though that google shouldn't have a problem accessing the web server since I am able to get at it from my Blue Iris Android Ap. I have the port forwarded, but maybe I'm missing something.

Additionally, it happens intermittently. For instance I haven't had any notices for 5 or so hours. Then, @ 3:04 I get notice that the server is down. At 3:05 I get notice that the server is back up.
 

Mike

Staff member
Joined
Mar 9, 2014
Messages
2,982
Reaction score
2,725
Location
New York
No adjustments to the script. I didn't consider firewall, I will have to double check when I get in front of my PC. I assumed though that google shouldn't have a problem accessing the web server since I am able to get at it from my Blue Iris Android Ap. I have the port forwarded, but maybe I'm missing something.

Additionally, it happens intermittently. For instance I haven't had any notices for 5 or so hours. Then, @ 3:04 I get notice that the server is down. At 3:05 I get notice that the server is back up.
How has it been, any better?
 
Joined
Jun 5, 2014
Messages
5
Reaction score
0
No, it actually got worse. As a result, I deleted the script. I would rather blindly find out that my connection is down then get 200 emails a day. I love the concept, and i'm sure it works when set up properly, but I couldn't get it that way! I'll probably try again in the future, my current obsession will be getting my "ipcc 7210w" (wanscam I think) to broadcast more than 2 FPS.

Thanks for the follow up and the interest!
 

eyeball

Getting comfortable
Joined
Jun 30, 2014
Messages
210
Reaction score
502
Mike, thanks for posting this - it works like a champ using an ip address and port.

Everlasting Gaze - I did a few iterations of tests down/up, seemed to work fine - will update after it's in place for 24 hours.
 

eyeball

Getting comfortable
Joined
Jun 30, 2014
Messages
210
Reaction score
502
Well, unfortunately I'm seeing the same thing as Everlasting Gaze.
7/2/2014 19:33:15Down : http://174.98.232.107:81
7/2/2014 19:35:07Up : http://174.98.232.107:81
7/2/2014 19:48:46Down : http://174.98.232.107:81
7/2/2014 19:50:22Up : http://174.98.232.107:81
7/2/2014 19:58:27Down : http://174.98.232.107:81
7/2/2014 20:00:16Up : http://174.98.232.107:81
7/2/2014 20:08:09Down : http://174.98.232.107:81
7/2/2014 20:10:08Up : http://174.98.232.107:81

My site has been up continuously, but all of the above were generated since I started monitoring. I'll have a look at the script & see if I can tell what's going on with it.
 
Joined
Jun 5, 2014
Messages
5
Reaction score
0
Sorry to hear that eyeball. I was just starting to feel sorry for myself for being too dumb to figure out why it wasn't working for me. . . . .

I do have to say that I've had two or three different occasions where i WISHED that I had put some more effort into figuring this issue out, since I went to go and review some recordings only to find BI was no longer running. This even with BI tools on the lookout. I think I lost power at home and obviously needed to start up the PC again.

Best of luck. Hope you find a solution (and let me know!)
 
Top