Author |
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: May 24 2005 at 21:01 | IP Logged
|
|
|
Changing the "Wait 1" to a "Delay 500" seems to work. I'll be adding a few virtual x-10 devices to represent the various machines here to show their status.
Update:
I needed to go to a "Delay 1500" to catch machines online that are checked after those that are not.
Edited by TonyNo
|
Back to Top |
|
|
krommetje Super User
Joined: December 29 2004 Location: Netherlands
Online Status: Offline Posts: 695
|
Posted: October 24 2005 at 20:41 | IP Logged
|
|
|
Hi TonyNo,
tell me how you work on the file ping.txt since the only thing I get is an off-line status, the file ping.txt is created and PH reads the file and puts it in the temp-var but any further I can't get....
Peter
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: October 24 2005 at 22:47 | IP Logged
|
|
|
Peter,
I've abandoned this due to taking too much time to poll each machine. Here is what I was doing...
This formula checked a machine (mname) and set a virtual device to follow its state:
Code:
if ( ph_macroparmret( "PING", "mname", "", "", "", "" )="Online", ph_x10btn( "Q", 6, 2, 0 ), ph_x10btn( "Q", 6, 3, 0 )) |
|
|
Here is ping:
Code:
insert into macroheader values ('PING','PING MACHINES',0,0,1);
insert into macrodetail values ('PING',1,15,'[LOCAL2]',NULL,'"cmd.exe /c ping.exe -n 1 "+ "[LOCAL1]" + " > c:\ping.txt"',0);
insert into macrodetail values ('PING',2,38,'',0,'ph_run( "[LOCAL2]" )',0);
insert into macrodetail values ('PING',3,7,'',NULL,'1500',0);
insert into macrodetail values ('PING',4,15,'[LOCAL3]',NULL,'ph_readfile( "c:\ping.txt")',0);
insert into macrodetail values ('PING',5,15,'[LOCAL1]',NULL,'if( pos( "[LOCAL3]", "Reply") <> 0, "Online", "Offline" )',0);
insert into macrodetail values ('PING',6,24,'No TTS',1,'"[LOCAL1]" + " = " + "[LOCAL4]"',1);
insert into macrodetail values ('PING',7,38,'',0,'ph_deletefile ( "c:\ping.txt" )',0);
|
|
|
|
Back to Top |
|
|
krommetje Super User
Joined: December 29 2004 Location: Netherlands
Online Status: Offline Posts: 695
|
Posted: October 25 2005 at 07:23 | IP Logged
|
|
|
Quote:
Code:
insert into macrodetail values ('PING',5,15,'[LOCAL1]',NULL,'if( pos( "[LOCAL3]", "Reply") <> 0, "Online", "Offline" )',0); |
|
|
|
|
|
and this is where it goes bazurk... Yesterday PH crashed when executing this... I however do not run PH under XP but under 98 so that would make a difference I think.
I presume I'd have to translate the to my own language....
Update:
aparantly I was not so clever and forgot that Reply in my own langauge starts with a capital and that is why it crashed.
I first created a virtual status module which is Status Only and assigned your HC/UC Q6 to it....
second what I did is create 2 timed events...
the first executes the Macro Ping and the second executes your code if macroparam..... a few seconds later. It takes about 10 seconds to execute both T.E. and is executed every 15 minutes...
I am going to let it run for a few days to see what happens and afterwards IF everything goes acording to plan, I am going to have PH send me an e-mail through my ISP as soon as the server isn't repsonding to these pings anymore so that I know that my mailserver is off-line...
The next thing to do is attach it to a universal switch so the resetbutton is "pushed" when the server actually goes off-line.... That is another thing because my mailserver runs on an old PIII laptop....
Sometimes the server still is in PH off-line when it is actually running... how I can imporove this I'd have to brainstorm about that...
Small Update (29-10):
I had to extend the time with 30 seconds between the 2 T.E. for obvious reasons (speed) and now the status of Mailserver is correctly shown in PH.... First the ping is made and the file ping.txt is created... then after 30sec. the file ping.txt is read and its status is updated .... this waiting-period had to be extended because the filesystem could not keep up with PH's speed...
Update 10th november:
Changed 2 TE to 1 and added a 250ms wait between 2 commands and this seems to work... Now I am getting an acurate state.... However this only tells us if a machine is running, and not if a BSOD e.g. has taken place... I am planning on programming my mailserver to run a programm every hour with a timed event which contacts PH which in turn updates the state of a second Virtual X10 module If I could do this then I would actually KNOW if my mailserver is UP....
for that I would have to brainstorm....
Peter
Edited by krommetje
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: November 12 2005 at 09:37 | IP Logged
|
|
|
Peter,
How about just setting your mail server to send a control email to your PH machine occasionally?
Tony
|
Back to Top |
|
|
krommetje Super User
Joined: December 29 2004 Location: Netherlands
Online Status: Offline Posts: 695
|
Posted: November 12 2005 at 12:44 | IP Logged
|
|
|
TonyNo wrote:
How about just setting your mail server to send a control email to your PH machine occasionally?
|
|
|
I have been thinking about that... I could make a mail-scipt which in turn creates a Mail which in turn updates a virtual X10 module when received by PH...
problem is that when my mailserver is not responding, PH might hang ....
Peter
Edited by krommetje
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: April 01 2006 at 12:36 | IP Logged
|
|
|
I have updated this macro to use the new ph_ping command...
http://tonyno.ods.org/ph/checkpcs.sql
Be sure to change the computer name (pcname) to something that matches your network. Also, this updates the virtual device Q1 as On or Off.
|
Back to Top |
|
|
mustangcoupe Super User
Joined: August 08 2003 Location: United States
Online Status: Offline Posts: 308
|
Posted: April 01 2006 at 12:47 | IP Logged
|
|
|
Thanks Tony... I think sence you upgraded Dave from DTG to "da Man" then you deserve also to be upgraded to TTG
__________________ Todd Hannemann
HA newbie
PowerHome - UPB - ELK
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: April 01 2006 at 15:50 | IP Logged
|
|
|
Hehe! Thanks!
One thing I don't know if I mentioned... I created a new X-10 Type called Computer and made the On and Off messages "Online" and "Offline". Then, in X-10 Units (Devices), set the Module Type to Computer.
|
Back to Top |
|
|
krommetje Super User
Joined: December 29 2004 Location: Netherlands
Online Status: Offline Posts: 695
|
Posted: April 11 2006 at 07:27 | IP Logged
|
|
|
So I presume this new PH_PING command works swell?
Peter
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: April 11 2006 at 07:52 | IP Logged
|
|
|
Much better than my version!
|
Back to Top |
|
|
krommetje Super User
Joined: December 29 2004 Location: Netherlands
Online Status: Offline Posts: 695
|
Posted: May 09 2006 at 01:17 | IP Logged
|
|
|
I've direct-sql-ed the new version and this one works very good... Much Much faster...
update:
been using your new code in the new version for about 4 days now and checks every 30 minutes if my mailserver is on-line.... up until now without any errors...
Thanx TonyNo
Edited by krommetje - May 13 2006 at 01:17
|
Back to Top |
|
|
|
|