YOULESS monitoring

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
menno
Posts: 158
Joined: Fri May 21, 2010 1:27 am

YOULESS monitoring

Post by menno »

HI all
We using Youless ethernet bridges to monitor energy consumption.
Is there a way to extract only the Watts from my youless webpage ? :-?
The youless is a energy kWh meter to ethernet bridge.
(http://www.youless.nl/)

With this example URL you get the output from your kWh meter.
http://<youlessip>/a

Code: Select all

88706,639 kWh
536 Watt
0%  
* 
how do we extract only the "Watt" line ???

What we want to monitor the second line.
In this example

Code: Select all

536 Watt
If my customer is using more the XXX Watt's Advanced Hostmonitor must be alerting or email the customer that he is using too much energy.

is this possible ?

many thanks in advance
Menno :D


offtopic : Maybe its a good idea to support those simple youless devices just as the temperature devices you support.
Lets be honest instead of 77 you will be supporting 78 test methods :-) ;-)
if you want i can help you with testing !!! no problem at all !!!
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

As I understand this device does not support any other protocol (SOAP, SNMP)?
Just text over HTTP?

I don't think we will add new test for this.
Probably we can add new option for URL and/or HTTP test...

Regards
Alex
menno
Posts: 158
Joined: Fri May 21, 2010 1:27 am

Post by menno »

no only http

we do not know how to extract that 2nd line

in this example we only want the value : 536

thnks M
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

Almost any custom test can be done by Shell Sctipt test method.
What is actual source code of http page at http://<youlessip>/a ?
Does it require any authentication?
Or may be you have online access/demo for the device?
menno
Posts: 158
Joined: Fri May 21, 2010 1:27 am

Post by menno »

thanks for your answers

NO we do not have any authentication.
the source code of the page is
(google chrome view-source:http://192.168.1.225/a )

Code: Select all

88708,649 kWh
630 Watt
0%  
* 
how to extract that 2nd line
in this example we only want the value : 630

menno
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

Your Shell Script JavaScript script may look like the following:

Code: Select all

statusUnknown     = "ScriptRes:Unknown:"
statusOk          = "ScriptRes:Ok:"
statusBad         = "ScriptRes:Bad:"

objArgs = WScript.Arguments;

if (objArgs.length != 2) {
  WScript.StdOut.Write(statusUnknown + "Required arguments: <URL> <Threshold in wats>");
  WScript.Quit;
}

var url = objArgs(0);
var threshold = parseInt(objArgs(1),10);

var objHttp = new ActiveXObject("MSXML2.ServerXMLHTTP");
objHttp.open("GET", url, false);
try { objHttp.send(); } catch(e) {
  WScript.StdOut.Write(statusUnknown + e.message);
  WScript.Quit;
}
var data = objHttp.responseText;
data = data.split("\n");
data = data[1].split(" ");
var res = parseInt(data[0]);
if (isNaN(res)) {
  WScript.StdOut.Write(statusUnknown+"value cannot be parsed");
  WScript.Quit;
}

if (res > threshold)
{
  WScript.StdOut.Write(statusBad+res);
} else {
  WScript.StdOut.Write(statusOk+res);
}
Start cmd: cmd /c cscript /B /E:JScript %Script% %Params%
Script requires 2 parameters: <URL> <Threshold value>
E.g.
http://192.168.1.225/a 900
menno
Posts: 158
Joined: Fri May 21, 2010 1:27 am

Post by menno »

YESS WORKS GREAT THANKS
menno
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

You are welcome!
Post Reply