Jump to content

Heartbeat program for Windows computer


PhanTomiZ

Recommended Posts

Hello,

 

I have camera recording software running on my Windows 10 based computer.  It needs to be on 24 hours.  A problem I've been having lately is my computer locks up (every 2 weeks or so) and my camera software stops recording.

 

What I'd like to accomplish when my computer is locked up is to have my computer automatically reset using my ISY and notify me of this.  

 

I currently have my remote computer restart working with an I/O linc that I had as a spare.  The wires from the I/O linc feed into my computer's power switch.  When the I/O linc is activated it turns off my computer, waits a predetermined time and then starts it again all using this program:

 

 1 Computer Has Been Reset Now Live - [iD 002E][Parent 0001]

 
If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
        Set 'Computer RM / Devices / Computer (Sense) RESET / Computer (Relay) RESET' On
        Wait  7 seconds
        Set 'Computer RM / Devices / Computer (Sense) RESET / Computer (Relay) RESET' Fast Off
        Wait  15 seconds
        Set 'Computer RM / Devices / Computer (Sense) RESET / Computer (Relay) RESET' On
        Wait  1 second
        Set 'Computer RM / Devices / Computer (Sense) RESET / Computer (Relay) RESET' Fast Off
        Send Notification to 'Default' content 'Default Subject'
        Send Notification to 'Text Message' content 'Default Text Message'
 
Else
   - No Actions - (To add one, press 'Action')
 
My challenge is, how do I create a Heartbeat program for my Windows computer and monitor it using my ISY?  Is this possible?  Any ideas would be appreciated...
 
PhanTomiZ
Link to comment

Hello,

 

I have camera recording software running on my Windows 10 based computer. It needs to be on 24 hours. A problem I've been having lately is my computer locks up (every 2 weeks or so) and my camera software stops recording.

 

What I'd like to accomplish when my computer is locked up is to have my computer automatically reset using my ISY and notify me of this.

 

I currently have my remote computer restart working with an I/O linc that I had as a spare. The wires from the I/O linc feed into my computer's power switch. When the I/O linc is activated it turns off my computer, waits a predetermined time and then starts it again all using this program:

 

1 Computer Has Been Reset Now Live - [iD 002E][Parent 0001]

 

If

- No Conditions - (To add one, press 'Schedule' or 'Condition')

 

Then

Set 'Computer RM / Devices / Computer (Sense) RESET / Computer (Relay) RESET' On

Wait 7 seconds

Set 'Computer RM / Devices / Computer (Sense) RESET / Computer (Relay) RESET' Fast Off

Wait 15 seconds

Set 'Computer RM / Devices / Computer (Sense) RESET / Computer (Relay) RESET' On

Wait 1 second

Set 'Computer RM / Devices / Computer (Sense) RESET / Computer (Relay) RESET' Fast Off

Send Notification to 'Default' content 'Default Subject'

Send Notification to 'Text Message' content 'Default Text Message'

 

Else

- No Actions - (To add one, press 'Action')

 

My challenge is, how do I create a Heartbeat program for my Windows computer and monitor it using my ISY? Is this possible? Any ideas would be appreciated...

 

PhanTomiZ

Might be easier to use a Digital Loggers Web Switch and setup a reboot on the loss of PING to that PC

 

http://www.digital-loggers.com/lpc.html

 

Make sure the PC is set in the BIOS to power back on after a restore of power. Then have an email sent from it when it sends a power cycle knowing it rebooted. There is also a way to do simple scripts in the Web switch that might be helpful too.

 

It also might help to setup a program on your PC to power cycle itself at a time of your choice (or randomly) to possibly stop the freezing up all together.

Link to comment

I believe given the critical nature and role of this computer system this is just a band aid to a larger issue not being addressed. From a IT perspective you're only buying time and the final outcome will be a failure. From a security perspective you leave yourself open to a window of time where you believe the system is recording and it won't be.

 

My advice is determine what's the root cause of the issue and resolve it.

 

It doesn't matter if its the OS needs to be re-imaged, to bad memory, HD, PSU, to even one of several application conflicts. To simply running out of resources due to resource hogging applications running in the back ground. Keep in mind *Ping Alive* is not a solve all because it relies heavily on one aspect of the OSI layer.

 

A system can in fact ping back and the system will still be frozen . . .

 

As Scott indicated you can certainly just gamble and take a random reboot sequence.

 

Ultimately you are going to pay now or later . . .

Link to comment

I believe given the critical nature and role of this computer system this is just a band aid to a larger issue not being addressed. From a IT perspective you're only buying time and the final outcome will be a failure. From a security perspective you leave yourself open to a window of time where you believe the system is recording and it won't be.

 

My advice is determine what's the root cause of the issue and resolve it.

 

It doesn't matter if its the OS needs to be re-imaged, to bad memory, HD, PSU, to even one of several application conflicts. To simply running out of resources due to resource hogging applications running in the back ground. Keep in mind *Ping Alive* is not a solve all because it relies heavily on one aspect of the OSI layer.

 

A system can in fact ping back and the system will still be frozen . . .

 

As Scott indicated you can certainly just gamble and take a random reboot sequence.

 

Ultimately you are going to pay now or later . . .

I completely agree, but trying to not preach my opinions and just help.

 

If it was me and IF this PC is not 100% dedicated to security cameras then I would add another PC so it was.

 

As a side note, I have found PING to be a pretty reliable way to know if a PC has frozen up but agree it's not 100%

Link to comment

Pinging a network device in general terms is OK but should not be relied upon to determine a systems operational health. One only needs to Google to see one of many scenario's where a computer system will indeed reply back. But in every case the system was in a unknown state.

 

This is why *Human* will always be around until SkyNet.

Link to comment

Pinging a network device in general terms is OK but should not be relied upon to determine a systems operational health. One only needs to Google to see one of many scenario's where a computer system will indeed reply back. But in every case the system was in a unknown state.

 

This is why *Human* will always be around until SkyNet.

What about if you ping a service and not the IP?

 

Edit: By service I mean port

Edited by Scottmichaelj
Link to comment

Thanks for the info.

 

I wasn't planning on making any more purchases, but rather use the hardware I currently own being the ISY, I/O Linc and my computer.

 

Teken, I believe you are correct in that I need to correct the problem with my computer locking up.  My cameras are not mission critical and are not used for security purposes.(mostly it's to catch my neighbors who don't pick up after their pets!!!!!).  This would be a "band aid" in the mean time.

 

So far, this is what I have come up with:

 

Create a Windows Task Scheduler.

Run a batch file every 5 minutes (Probably set this to 30 minutes) that sets a Computer HB Variable in my ISY to 1

In this batch file I run a program called "http-ping.exe" using Rest command which sets the Computer HB state variable to 1

Create a program in ISY that will monitor this variable and change it to 0 if it is 1

If this program doesn't see a change from 0 to 1 then restart my computer and send me a text.

 

What I'm foggy on is whether the "http-ping.exe" program will continue to send the rest command if my computer is locked up.

 

PhanTomiZ

Link to comment

What about if you ping a service and not the IP?

 

Edit: By service I mean port

 

How would that help the OP determine (IF) the PC was in a *Unknown State*? Meaning all of us have seen and experienced where a computer refused to launch a application, shut down, to uninstall. What you propose makes sense in general terms of offering a possible method of detection but heavily relies upon multiple things working as expected.

 

My question to you is this say the OP purchased the DLI remote switch and pinged some random *known* service like say Google.

 

What does pinging Google from that appliance have to do with the PC that is hung or none responsive? Or how about the other way around so what ever application you just installed to ping some random site does reply back to the ping. How will that application running in the foreground / back ground address the fact the computer is frozen?

 

Keeping in mind there are many levels of *Frozen* in the context of computer systems. All of us have seen the ISY lose connection in the Admin Console yet we all know in the back ground its still operating but the UI isn't displaying anything meaningful to the end user.

 

I hope everyone reading this reply fully understands my only intent is to ensure they go into any software solution with both eyes open.

Link to comment

How would that help the OP determine (IF) the PC was in a *Unknown State*? Meaning all of us have seen and experienced where a computer refused to launch a application, shut down, to uninstall. What you propose makes sense in general terms of offering a possible method of detection but heavily relies upon multiple things working as expected.

 

My question to you is this say the OP purchased the DLI remote switch and pinged some random *known* service like say Google.

 

What does pinging Google from that appliance have to do with the PC that is hung or none responsive? Or how about the other way around so what ever application you just installed to ping some random site does reply back to the ping. How will that application running in the foreground / back ground address the fact the computer is frozen?

 

Keeping in mind there are many levels of *Frozen* in the context of computer systems. All of us have seen the ISY lose connection in the Admin Console yet we all know in the back ground its still operating but the UI isn't displaying anything meaningful to the end user.

 

I hope everyone reading this reply fully understands my only intent is to ensure they go into any software solution with both eyes open.

You actually ping the PC. Some let you ping a specific port for the service too.

Link to comment

Thanks for the info.

 

I wasn't planning on making any more purchases, but rather use the hardware I currently own being the ISY, I/O Linc and my computer.

 

Teken, I believe you are correct in that I need to correct the problem with my computer locking up.  My cameras are not mission critical and are not used for security purposes.(mostly it's to catch my neighbors who don't pick up after their pets!!!!!).  This would be a "band aid" in the mean time.

 

So far, this is what I have come up with:

 

Create a Windows Task Scheduler.

Run a batch file every 5 minutes (Probably set this to 30 minutes) that sets a Computer HB Variable in my ISY to 1

In this batch file I run a program called "http-ping.exe" using Rest command which sets the Computer HB state variable to 1

Create a program in ISY that will monitor this variable and change it to 0 if it is 1

If this program doesn't see a change from 0 to 1 then restart my computer and send me a text.

 

What I'm foggy on is whether the "http-ping.exe" program will continue to send the rest command if my computer is locked up.

 

PhanTomiZ

 

PhanTimiZ,

 

Only trial and error will flesh out if this works as expected in your personal environment. Since its obvious you know the pros / cons the decision is yours. When you have time I am sure you will get that box squared away to a fully operational state. In the meantime I do hope you follow up and let the forum members know how you progress and what the final outcome is.

 

All of this is great information for those needing a similar solution . . .

Link to comment

You actually ping the PC. Some let you ping a specific port for the service too.

 

As I stated pinging a PC regardless of the method does not address if a computer system is in a unknown state. This is why its not used in Enterprise / Government as the final indicator.

 

Human - is and always will be the final indicator to the operational status of a system.

 

Until SkyNet  . . .

Link to comment

As I stated pinging a PC regardless of the method does not address if a computer system is in a unknown state. This is why its not used in Enterprise / Government as the final indicator.

 

Human - is and always will be the final indicator to the operational status of a system.

 

Until SkyNet . . .

You stated a lot of things including pinging Google.

Link to comment

So far so good with my $0 approach.  

 

I had an I/O linc from a garage kit I wasn't using and ran two wires from it to the computer power switch.

 

I have had 1 computer lockup, which emailed me correctly.  I then ran my ISY program and it reset the computer.   Here it is:

 

1 Computer Has Been Reset Now Live - [iD 002E][Parent 0001]
 
If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
        Set 'Computer RM / Devices / Computer (Sense) RESET / Computer (Relay) RESET' On
        Wait  7 seconds
        Set 'Computer RM / Devices / Computer (Sense) RESET / Computer (Relay) RESET' Fast Off
        Wait  15 seconds
        Set 'Computer RM / Devices / Computer (Sense) RESET / Computer (Relay) RESET' On
        Wait  1 second
        Set 'Computer RM / Devices / Computer (Sense) RESET / Computer (Relay) RESET' Fast Off
        Send Notification to 'Default' content 'Default Subject'
        Send Notification to 'Text Message' content 'Default Text Message'
 
Else
   - No Actions - (To add one, press 'Action')
 
This program my be crude, but it restarts my computer:
 
In order to reset my machine, I need to push the power button for 7 seconds. 
Then I wait 15 seconds to let the hard drive come to a stop
Then I hit the button to start the computer.
 

 

 

I have also had 1 false computer lockup alarm.  I have since adjusted my ISY "computer heartbeat" program to give it a little more time to acknowledge the fault.(changed the else statement from 25 seconds to 40 seconds).

 

Please keep in mind that this is a work in progress

 

Computer HB 
 
If
        $Computer_Heartbeat is 1
 
Then
        Wait  1 second
        $Computer_Heartbeat  = 0
 
Else
        Wait  40 seconds
        Send Notification to 'Default' content 'Default Subject'
        Send Notification to 'Text Message' content 'Default Text Message'
 
This ISY program above will be true if the Computer is alive and able to set the HB Variable
Wait 1 seconds so I can see it working or see the variable change states
Set Computer Heartbeat variable to 0
Else statement becomes true and we wait 40 seconds for the computer to set the HB Variable back to 1
(The computer has 10 seconds to accomplish this or else Notification is sent after 40 seconds proving
the computer has locked up and is non responsive...
        
Windows Computer Heartbeat Program:
Windows Task Scheduler is "Triggered" "Running at Startup" and repeats every 5 minutes, the Batch File C:\Users\Paul\ComputerHB.bat;
it is comprised of the following 2 lines 
choice /T 10 /D y (This line creates a 10 Second Delay)
c:\users\paul\http-ping.exe -n 1 http://User:password@IPAddress/rest/vars/set/2/20/1 (Sets State Computer Heartbeat Variable to 1)
 
Choice command (Batch file query that acknowledges itself after 10 seconds thus creating a 10 second delay) and a Rest command including http-ping.exe which sends the rest command from a Windows batch file or from the dos command line prompt.
 
Hope you can follow this.  I don't always get things in the right order, but they seem to be in the right order in my head.....
 
PhanTomiZ
 
P.S.  Credit to ih574 for getting my idea started.  Here is the old post:
 
Next big headache it to find out why my machine is locking up in the process.  This just buys me a little time to research things.......
Link to comment

 

So far so good with my $0 approach.  

 

I had an I/O linc from a garage kit I wasn't using and ran two wires from it to the computer power switch.

 

I have had 1 computer lockup, which emailed me correctly.  I then ran my ISY program and it reset the computer.   Here it is:

 

1 Computer Has Been Reset Now Live - [iD 002E][Parent 0001]
 
If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
        Set 'Computer RM / Devices / Computer (Sense) RESET / Computer (Relay) RESET' On
        Wait  7 seconds
        Set 'Computer RM / Devices / Computer (Sense) RESET / Computer (Relay) RESET' Fast Off
        Wait  15 seconds
        Set 'Computer RM / Devices / Computer (Sense) RESET / Computer (Relay) RESET' On
        Wait  1 second
        Set 'Computer RM / Devices / Computer (Sense) RESET / Computer (Relay) RESET' Fast Off
        Send Notification to 'Default' content 'Default Subject'
        Send Notification to 'Text Message' content 'Default Text Message'
 
Else
   - No Actions - (To add one, press 'Action')
 
This program my be crude, but it restarts my computer:
 
In order to reset my machine, I need to push the power button for 7 seconds. 
Then I wait 15 seconds to let the hard drive come to a stop
Then I hit the button to start the computer.
 

 

 

I have also had 1 false computer lockup alarm.  I have since adjusted my ISY "computer heartbeat" program to give it a little more time to acknowledge the fault.(changed the else statement from 25 seconds to 40 seconds).

 

Please keep in mind that this is a work in progress

 

Computer HB 
 
If
        $Computer_Heartbeat is 1
 
Then
        Wait  1 second
        $Computer_Heartbeat  = 0
 
Else
        Wait  40 seconds
        Send Notification to 'Default' content 'Default Subject'
        Send Notification to 'Text Message' content 'Default Text Message'
 
This ISY program above will be true if the Computer is alive and able to set the HB Variable
Wait 1 seconds so I can see it working or see the variable change states
Set Computer Heartbeat variable to 0
Else statement becomes true and we wait 40 seconds for the computer to set the HB Variable back to 1
(The computer has 10 seconds to accomplish this or else Notification is sent after 40 seconds proving
the computer has locked up and is non responsive...
        
Windows Computer Heartbeat Program:
Windows Task Scheduler is "Triggered" "Running at Startup" and repeats every 5 minutes, the Batch File C:\Users\Paul\ComputerHB.bat;
it is comprised of the following 2 lines 
choice /T 10 /D y (This line creates a 10 Second Delay)
c:\users\paul\http-ping.exe -n 1 http://User:password@IPAddress/rest/vars/set/2/20/1 (Sets State Computer Heartbeat Variable to 1)
 
Choice command (Batch file query that acknowledges itself after 10 seconds thus creating a 10 second delay) and a Rest command including http-ping.exe which sends the rest command from a Windows batch file or from the dos command line prompt.
 
Hope you can follow this.  I don't always get things in the right order, but they seem to be in the right order in my head.....
 
PhanTomiZ
 
P.S.  Credit to ih574 for getting my idea started.  Here is the old post:
 
Next big headache it to find out why my machine is locking up in the process.  This just buys me a little time to research things.......

 

Update....

 

No computer lockups since last post.  

 

I've had false notifications.  I clued into this only after the 3rd time it happened.  Time was 4:00 am.  The same time as my Query all.  Seems it takes approximately 4 minutes for the Query all command to finish.  My "Wait 40 seconds" statement wasn't long enough.  I have since changed this to 5 minutes to give me a little wiggle room for the Query all statement...

 

PhanTomiZ 

Link to comment

I have Windows set a variable on the ISY every five minutes using a vbs script and using Task Scheduler.  Then I check that variable on the ISY and if it does not change every ten minutes I send out an email and text from the ISY. If it misses 3 heartbeats the program on the ISY tells Eventghost to try and reboot it.  I use Blue Iris for the cameras on the Windows 10 PC and I also have the PC reboot itself everyday at 4 am.

 

After the latest Windows 10 updates the tasks in Task Scheduler would randomly stop working so I moved the vbs script to Eventghost.

Link to comment

Sounds somewhat like my setup.  

 

Let's see what you have.  VBS script, Task Scheduler and ISY program.

 

Thanks

PhanTomiZ

 

 

Here are the ISY programs:

 

Heartbeat Check Var Control Server - [iD 028D][Parent 028C]
 
If
        $HEARTBEAT_SERVER is 9
 
Then
        $HEARTBEAT_SERVER  = 0
 
Else
   - No Actions - (To add one, press 'Action')
 
 
Heartbeat Var Control Server Not Running - [iD 028E][Parent 028C]
 
If
        Time is Last Run Time for 'Heartbeat Check Var Control Server' +  6 minutes
    And From     4:15:00AM
        To       3:55:00AM (next day)
 
Then
        $HEARTBEAT_SERVER += 1
 
Else
   - No Actions - (To add one, press 'Action')
 
 
Server Missed Two Heartbeats - [iD 028F][Parent 028C]
 
If
        $HEARTBEAT_SERVER is 2
 
Then
        Send Notification to 'Brent' content 'Heartbeat Missed Server'
 
Else
   - No Actions - (To add one, press 'Action')
 
 
 
VBS Script:
 
Set WshShell = WScript.CreateObject("WScript.Shell")
'Set http = CreateObject("MSXML2.serverXMLHTTP")
'Set http = CreateObject("MSXML2.XMLHTTP")
Set http = CreateObject("Microsoft.XmlHttp")
 
 
' If auth is required, replace the userName and password values
' with the ones you use on your ISY
userName = "ISY Username"
password = "ISY Password"
 
http.open "GET", url, false, userName, password
http.send 
 
Set userName = Nothing
Set password = Nothing
Set myFSO = Nothing 
set WshShell = nothing
set http = nothing
set objXmlDoc = Nothing 
 
Eventghost just runs that script every 5 mins.
Link to comment
Guest
This topic is now closed to further replies.

×
×
  • Create New...