Kitz ADSL Broadband Information
adsl spacer  
Support this site
Home Broadband ISPs Tech Routers Wiki Forum
 
     
   Compare ISP   Rate your ISP
   Glossary   Glossary
 
Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: 1 ... 6 7 [8]

Author Topic: HG612 modem stats - multiple instances.  (Read 35530 times)

ColinS

  • Reg Member
  • ***
  • Posts: 529
Re: HG612 modem stats - multiple instances.
« Reply #105 on: September 02, 2013, 07:27:58 PM »

PS Paul... Ive just had a thought.
  • HG612_current_stats checks for other instances and if false.. pauses 10 seconds and then collects stats.
    During this 10 seconds DSLstats could have started, causing HG612_current_stats to fail.
Yes, you did question that, and you were spot on about the potential consequences. Sorry no one picked up on it at the time, as then I think the focus was on the timer, which Eric has now improved.  However, the delay (default 10s) is configurable via the settings editor - additional settings tab/Delay for snapshot data logging box... [Edit] for manual runs as Paul has clarified below.

I think in my case, use of the new 'synchronise with modem_stats' option within DSLstats (and a small typo) brought the two back into synchronism again in an unintended way.  So, for example, without that new sync option, there was less chance (after the timer was fixed) of the two starting at ~10s past. 

Some rationalisation of the delays between the two is probably necessary with the changes Eric has now made (and his 35-40s past suggestion).
« Last Edit: September 02, 2013, 07:41:19 PM by ColinS »
Logged

Bald_Eagle1

  • Helpful
  • Kitizen
  • *
  • Posts: 2721
Re: HG612 modem stats - multiple instances.
« Reply #106 on: September 02, 2013, 07:34:50 PM »

Colin, I also queried the 10 second delay for current stats a few pages back, but I think Paul covered that in one of his replies.   
Im now not certain... but the way I understood the explanation, was the 10 second delay only occurred during a manual run?


Yes, that's correct for manual runs.

The delay can be configured via Settings Editor, but it is completely ignored when scheduling current stats via Settings Editor as it runs immediately following any ongoing stats harvesting
Logged

Ronski

  • Moderator
  • Kitizen
  • *
  • Posts: 4211
Re: HG612 modem stats - multiple instances.
« Reply #107 on: September 02, 2013, 08:30:04 PM »

If I knew how to check whether any of Paul's programs are running at the time when a sample is due I could possibly take other actions, but it should normally only be the case under error conditions or if a user has started a one-off unscheduled run.

RONSKI also put a small program together for determining if specific processes are running (as used in my programs):-

HG612_stats_running = IsRunningVB.exe "HG612_stats.exe"
HG612_current_stats_running = IsRunningVB.exe "HG612_current_stats.exe"

That stores the number of running processes in the HG612_stats_running or HG612_current_stats_running variables that match the specified program names.
He may be willing to share the code that you could incorporate into DSLStats?


e.g. pseudo code:-

if HG612_stats_running > 0, hang on for a few seconds & keep checking until it equals zero.

Roseway, feel free to use the programs if you wish, I most likely got it off the net somewhere and just modified it to suite.

Here's the VBS code, the exe version is just the code compiled.

Code: [Select]
Option Explicit
Dim strComputer, objWMIService, colProcess, objProcess, qty, Arg
Set Arg = WScript.Arguments
strComputer = "."

if WScript.Arguments.Count = 0 Or WScript.Arguments.Count > 1 then
    'WScript.Echo "Missing parameters"
wscript.quit -1
end if

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer  & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = '" & arg(0) & "'")
For Each objProcess in colProcess
   qty = qty + 1
Next
wscript.quit qty

And here's an example batch file, the script just returns an error number, corresponding to how many instances of the specified program are running.

Code: [Select]
@ECHO OFF
cls

echo This one returns the amount of processes running, -1 for error.
echo .
echo It is not case sensitive.
echo .

set Var=NOTEPAD.exe

isrunningvb.bat %Var%

echo .
echo There are %ERRORLEVEL% instances of %Var% running
echo .

pause
Logged
Formerly restrained by ECI and ali,  now surfing along at 390/36  ;D

roseway

  • Administrator
  • Senior Kitizen
  • *
  • Posts: 41644
  • Penguins CAN fly
    • DSLstats
Re: HG612 modem stats - multiple instances.
« Reply #108 on: September 02, 2013, 10:53:10 PM »

Thanks for the suggestions and help for detecting processes running. At the moment, the VBS code looks like Chinese to me, and may not be easily portable to Lazarus/Freepascal, so some digestion will be needed.
Logged
  Eric

Ronski

  • Moderator
  • Kitizen
  • *
  • Posts: 4211
Re: HG612 modem stats - multiple instances.
« Reply #109 on: September 03, 2013, 07:39:29 AM »

Can you not just call the exe program and capture the error number like BE does?

Although it would be better all self contained in your own program.
Logged
Formerly restrained by ECI and ali,  now surfing along at 390/36  ;D

roseway

  • Administrator
  • Senior Kitizen
  • *
  • Posts: 41644
  • Penguins CAN fly
    • DSLstats
Re: HG612 modem stats - multiple instances.
« Reply #110 on: September 03, 2013, 08:42:35 AM »

Can you not just call the exe program and capture the error number like BE does?

Probably I can. This is new territory for me, as I don't actually use Windows, but I can certainly launch an external executable and check what data it returns. That will be a lot easier than porting the VBS code.
Logged
  Eric

Chrysalis

  • Content Team
  • Addicted Kitizen
  • *
  • Posts: 6909
Re: HG612 modem stats - multiple instances.
« Reply #111 on: September 05, 2013, 12:36:38 PM »

its a shame the hg has no snmpd server, as thats the proper way to do this sort of thing.  Sadly modern devices tend to lack snmpd support now unless aimed at geeks like myself.

The old variant of the script (which I still use) doesnt have this issue but the cpu spike every minute when fetching the data is signficant.
Logged
AAISP - Billion 8800NL bridge & PFSense BOX running PFSense 2.4 - ECI Cab - LINE STATISTICS CLICK HERE
Pages: 1 ... 6 7 [8]
 

anything