Page 1 of 1

GEM with cacti on local webserver

Posted: Tue Apr 02, 2013 9:12 pm
by Rocquestar
I'm slowly getting the hang of my new GEM, after a few helpful posts.

I'm running a local (unix) webserver, and I've installed cacti. I also realize that some of these questions may be better posed to a cacti forum, but my puzzlement is also big picture, because something doesn't seem to be adding up (yet).

The GEM (Ethernet) is in Real-Time mode, and I can see the packets it's sending by either connecting to the port with a terminal, or running btmon.py --print. And those packets have the data from the initial setup of my CT's.

To capture the data for cacti, I set btmon.py to write to an rrd, which it's doing. For this to be a permanent solution, btmon.py needs to be running all the time, and auto-restart, as in daemon mode. Normally, that's a command-line switch, but there isn't one. Is there an accepted way to run it as a daemon, or do I need to write a startup script a-la /usr/local/etc/rc.d/btmond ?

That brings me to cacti - once the data is being captured into an rrd by btmon.py, how do I tell cacti that it doesn't need to re-poll the GEM to gather the data, but to just read the rrd instead? Conversely, instead of running a btmon daemon to write to an rrd that cacti (only) reads, cacti could poll the GEM itself, storing the data in an rrd, but that would require writing a polling script - probably much of what's already in btmon.py. I'm not a coder (though I might be able to struggle through adapting Matt's work)

I suspect that I'm misunderstanding something in the way everything fits together. I realize that I've laid down a whole lot of info here, but I fear that specific questions might be veiled by my misunderstanding of how the whole thing works (with a local service like cacti).

Can anyone help me understand how the components (are meant to) communicate in this kind of setup?

Thanks, very much!

Re: GEM with cacti on local webserver

Posted: Tue Apr 02, 2013 10:52 pm
by mwall
i'm no cacti expert, but i'm pretty sure it is possible to graph rrd data in cacti even if cacti does not do the data collection.

if you want cacti to control the data collection you could write a script to invoke btmon then convert the output to the format cacti needs. or you could have btmon save to a sqlite or mysql database, then have cacti collect data from the database.

there is no daemon mode for btmon - simply run it from an rc script as you noted. there is a sample script in the mtools package here:

http://lancet.mit.edu/mwall/projects/po ... c/btmon.rc

be sure to establish which parts of the system are pushing and which are pulling. for example, the gem can run in real-time mode, pushing data to a btmon instance. or the gem could be polled by a custom cacti script.

there are many options!

m

Re: GEM with cacti on local webserver

Posted: Wed Apr 03, 2013 10:56 am
by ben
Did a quick search on adding external rrds and found this:

http://docs.cacti.net/manual:087:8_rrdt ... ernal_rrds

Ben

Re: GEM with cacti on local webserver

Posted: Wed Apr 03, 2013 8:03 pm
by Rocquestar
Matt, Ben:

Thanks very much for not only your specific nudges, but for confirming that my understanding is not too far off.

Matt - there are truly a lot of ways to envision the configuration, I think that's what left me muddled. I didn't realize that the mtools had more than I'd already found, but I see the rc and the log roller also. Excellent.

Ben - thanks for not just saying "cacti? rtfm", or rather, for saying it the way you did :-) I hadn't done too much searching within cacti, mostly because I wanted to hear that it was possible. You did that, and you made the search much easier.

Hopefully, I won't have to update any more than this... we'll see.

;-David

Re: GEM with cacti on local webserver

Posted: Sun Jul 21, 2013 7:59 pm
by sjthespian
David,

Did you ever make any further progress with this? I have my GEM displaying in Cacti based on some of the posts above (and years of experience fighting with Cacti) and would love to see what others have done.

I'm still tuning my GEM setup and have to wait for a few more CTs to arrive before I can get everything up and running, but here is an aggregate graph I created this afternoon:
Image
and an example of a single circuit graph:
Image
The jump in the pool pump graph is due to my forgetting to combine the two CTs into a single channel when I first set it up. The gaps are my restarting btmon.py when I needed to configure the GEM.

For my purposes, btmon.py is creating the rrd files and I have cacti just displaying them. Depending on when I end up getting SEG working, I may decide to just build a custom page to display the RRD data rather the having Cacti due it. My only reasons for wanting to use Cacti is that I already have it runing, and I'm thinking I could do something cool with the PHP Weathermap app to display a visual display of where the load is either on a home floorplan or a visualization of the breaker box.

One thing I think I'm going to need to do is turn off auto-scaling on the graphs. It's great for network traffic but makes it hard to compare channels when everything has a different scale.

Re: GEM with cacti on local webserver

Posted: Tue Jul 23, 2013 1:35 pm
by garbled
You can see my data here:
http://www.garbled.net/cacti/gnhast_64.html

And, an example image:
Image

I'm still tweaking the code to calculate cost per day. It's rather a pain. I'm not sure if it's quite right yet, but I'll keep playing with it.

Re: GEM with cacti on local webserver

Posted: Sat Nov 18, 2017 10:50 am
by haveaday
Apologies for resurrecting a majorly aged thread but this contains nearly exactly what I'd like to do. I've got btmon dumping data into rrd and some basic graphs being drawn by rrd but I'm having trouble figuring out the calculations to turn the aws data into kwh of consumption.

Is it possible to share the setup you're using in Cacti? Alternatively, does anyone know the basic math that needs to be done in rrd to figure out wh based upon the point in time data collected in rrd?

Thanks
Ben

Re: GEM with cacti on local webserver

Posted: Mon Nov 20, 2017 2:50 pm
by ben
haveaday wrote:Apologies for resurrecting a majorly aged thread but this contains nearly exactly what I'd like to do. I've got btmon dumping data into rrd and some basic graphs being drawn by rrd but I'm having trouble figuring out the calculations to turn the aws data into kwh of consumption.

Is it possible to share the setup you're using in Cacti? Alternatively, does anyone know the basic math that needs to be done in rrd to figure out wh based upon the point in time data collected in rrd?

Thanks
Ben
kWh used between 2 periods is:

delta wattseconds / 3600000

Average Watts between 2 periods is:

delta wattseconds / delta seconds

(delta wattseconds is the end record - start record)

Re: GEM with cacti on local webserver

Posted: Sun Dec 24, 2017 11:24 pm
by Rocquestar
Hi Ben-

wait... Ben (haveaday) and Ben (brultech)... not the same people. Okay then: Hi Bens-

I'll happily share, Haveaday, if you haven't figured it out yet - it's been more than a month since your question, after all. I may not be able to recall, though. I set this up back then (golly, was it 2013?) and it's been running reasonably well without too much from me ever since.

Let me know what you're having difficulty with, and I'll see if I can remember, and advise.

-Rocquestar (OP)