best way of dumping real time data


 

Dave Casazza

TVWBB Fan
Is there an easy/better/best way of dumping the linkmeter data (or serial data sent/received) to stdout or file? I looked at rrddump, but rrddump didn't seem to be the right answer because we aren't running rrdcached.

I'm looking to write a program or script to dump the data as it is RX/TXed over the serial line, such as probe data, or setpoint change data, and call a webserfvice to move it to another historian.

Thanks,

Dave
 

Bryan Mayland

TVWBB Hall of Fame
You can attach to the JSON Server-Sent events service remotely, looking for 'hmstatus' type messages:
http://xxx/luci/lm/stream

Or if you want to do it from the device itself, you can use `lmclient @LMSS` to get the same data streamed. Or just `lmclient` will just do a one-shot get of just the JSON (no server-sent wrapper).
 

Bryan Mayland

TVWBB Hall of Fame
Setting a parameter requires that you have a logged in HTTP session so that is more complicated. You need a valid "stok" in the URL as well as a valid sysauth cookie passed for the request. From there you the "/set" URL like http://xxx/luci/;stok=yyy/admin/lm/set?

An easier way would be to use lmclient LMST,a,b via ssh or something where a is what you want to set and b is the value. e.g. `lmclient LMST,sp,225` to set the setpoint to 225.
 

Wojtek Gusio

New member
Are you referring to persistent connection? I basically need to have persistent connection between a heatmeter on a private network protected via firewall with my server located on open Internet. Ios devices will connect to that server which will then proxy stats/alarms back to devices if app is running or via push notification if app is not running. So that part is easy, but since I already have an app, why don't I also add ability to change modify the configs, for that I need persistent connection so my server can send changes to respective boxes, but I also need to be able to easily change configs based on received json token. Does it all make sense
 

Bryan Mayland

TVWBB Hall of Fame
I'm not quite sure why you'd need a persistent connection to change configuration, but there's no way to do that. You have to generate an HTTP request to make a configuration change. The default lucid installation doesn't lend itself very well to automation, because you need an active web session to be able to make changes to the configuration. You can get around this by turning on basic realm http authentication, but then that would also require it in the web browser. You can set up a second vhost that just does basic auth though I think.

If you need live data streaming, you can either stream it over HTTP (server-sent events) from the URL http://XXX/luci/lm/stream or you can open an ssh connection and lmclient @LMSS which will give you just the json data.
 

Wojtek Gusio

New member
I'm not quite sure why you'd need a persistent connection to change configuration, but there's no way to do that. You have to generate an HTTP request to make a configuration change. The default lucid installation doesn't lend itself very well to automation, because you need an active web session to be able to make changes to the configuration. You can get around this by turning on basic realm http authentication, but then that would also require it in the web browser. You can set up a second vhost that just does basic auth though I think.

If you need live data streaming, you can either stream it over HTTP (server-sent events) from the URL http://XXX/luci/lm/stream or you can open an ssh connection and lmclient @LMSS which will give you just the json data.
Thanks, I need a persistent connection, so user from the open internet can initialize session (go over persistent) if they choose to update something. All requests would go through a server acting as a proxy. Without it, users would need to modify their firewall to allow inbound connection from that server.
 

Bryan Mayland

TVWBB Hall of Fame
I think we have a different version of what persistent entails. You're saying you need LinkMeter to connect out to your service and be able to push configuration changes back? Sure a persistent connection to your server would be the easiest way to do it from the design perspective, but there's no infrastructure in LinkMeter for that. You could always use UPnP to auto-create a firewall rule, or use some sort of UDP tunnel.

The other alternative would be to write your own package that creates an outbound connection, subscribes to the @LMSS, and proxies data back and forth between lmclient and your server.
 

 

Top