A place where things actually work,
with a sense of humor.

Meuon
0 comments


keywords:
SVG
Smart
Grid
Data
Visualization
PHP

SVG Based Graphs
I've been playing around with SVG (Scalable Vector Graphics) for a few days as a tool to display data, as graphs/charts as well as ways to visual distribution grids, and more. Absolutely loverly technology, if you are NOT using a Microsoft web browser. Firefox and Opera and others support SVG, and it works very very well. I'm currently evaluating plugins for MSIE, but it's a fragmented world. There may be some SVG support coming in MS's Silverlight, but it is expected to be borken in Microsoft traditional: Embrace, Extend, Extinguish methodology. If you click on the image above to see the results, if you can display SVG in a browser.

If you are using MSIE, (Microsoft Internet Explorer) (32 bit) you can use: a Mozilla Firefox ActiveX plugin for MSIE available from:
a Mozilla Firefox ActiveX plugin for MSIE that seems to work very well.
 

admin
1 comment


keywords:

Python
Looks like I'll be learning yet another language. It seems to be good at parsing java created XML
I tried to make a mental list of how many languages (programming) I had worked with, but I don't have enough fingers and toes.
 

Meuon
0 comments


keywords:

APC 10KVA UPS monitoring via SNMP
First you have to find the right MIB for your ups. This one is a "Smart-UPS RT 10000 XL" from APC. The real trick is using the right mib file with the -m "./mibfile.mib" command line syntax. The quotes make a lot of difference. The same trick works for snmpwalk and other snmp utilities. I'm running a much fancier version of what I have below in a production setting, but this is a good starting place and has the essentials working.

Sure beats serial cables and Java runtimes for the "official APC method" and you can run this on multiple servers, each with their own decision tree and set of commands. ie: Keep the mission critical stuff up the longest, drop the junk you don't need quickly and make that UPS last longer.
#!/usr/bin/perl
#This is as simple of an APC power monitor as I could make.
#Should be run as a cron job every 5 minutes or less. replace 192.168.192.4 with the IP of your UPS.

$shutdownthreshhold = 20 ;
open(IN,"/usr/bin/snmpget -v1 -c public -m "/home/juice/apc/powernet395.mib" 192.168.192.4 PowerNet-MIB::upsAdvBatteryCapacity.0 |") ;
while(<IN>) {
@d = split(/ /) ;
$capacity = $d[3] * 1 ;
} ;
open(IN,"/usr/bin/snmpget -v1 -c public -m "/home/juice/apc/powernet395.mib" 192.168.192.4 PowerNet-MIB::upsBasicOutputStatus.0 |") ;
while(<IN>) {
@d = split(/ /) ;
$status = $d[3] ;
chop($status) ;
} ;
open(OUT,">/tmp/powercheck") ;
print OUT "Battery Capacity: $capacity percent Battery Status: $status Shutdown at $shutdownthreshhold" ;
close(OUT) ;


if($status eq 'onBattery(3)') {
if($capacity < $shutdownthreshhold) {
print "SHUTDOWN
" ;
system("/sbin/shutdown -P now") ; #standard Linux shutdown, -P is power off
} ;

} ;



 

admin
0 comments


keywords:

Back to Perl: simplecsv2xml
i used to use Perl a lot, but I got rusty. Today I needed to convert a bunch of typical CSV files into "XML" Quick and Dirty, simple flat files.
It's a sad world when a professional $150+/hr developer only knows how to read XML. My guess is they code in Java or Dot.Not. Heck, Maybe MS-Visual Basic.

Mine is not to wonder why... mine is just to do or die. I went looking for what I wanted.. most of the solutions were just too complex, so I started from scratch and ened up with a simple Perl script to convert CSV to XML.. Why perl? Fast and easy parser of STDIN/STDOUT. This is NOT what is used in the final project, but it is something that works and many people (and sometimes me) just need a quick CSV to XML conversion.

Usage:   simplecsv2xml.pl <infile >outfile
 


#!/usr/bin/perl
# Mikes Uber Simple CSV to XML Parser
use Text::CSV;
$csv = Text::CSV->new();
$i = 0 ;
print "<?xml version="1.0" encoding="UTF-8"?> " ;
print "<document> " ;
while(<STDIN>) {
$status = $csv->parse($_); # parse a CSV string into fields
if($i < 1) {
@key = $csv->fields() ; # get the parsed fields
# assumes the first line is the key/field names
} else {
@data = $csv->fields(); # get the parsed fields
} ;
#now make it XML-ish.
if($i > 0) {
$r = 0 ;
print '<row>' ;
foreach(@data) {
if($key[$r] ne '') {
print '<'. $key[$r] . '>' . $_ . '</' . $key[$r] . '>' ;
} ;
$r++ ;
} ;
print '</row>' ." " ;
} ;
$i++ ;
} ;
print "</document> " ;


 

Meuon
1 comment


keywords:
UtiliFlex
Juice
GPL
PrePaid
Electricity

Proud Papa Again

Every once in a while you get to build something you are really proud of.  The "UtiliFlex Juice PrePaid/Pay-As-You-Go  Electricity/Utility platform" has become such a beast.

I'm standing next to a complete working system, including an awesome firewall, 2 Asterisk based IVR servers, SMS/text Gateways, and an Intel Modular Server. It's about to be shipped to Guyana Power and Light in South America and will help run a significant percentage of the utility.  the screen shows only one of the compute modules, with 8 CPU's, 32gb of ram.. etc..

It will  allow people in that country to do something they haven't been doing much of: Buy electricity. In their context, prepaid is an enabler. It allows people to purchase electricity as they need it and as they can afford it, without a penalty for getting disconnected because they can't afford the bill that came too late for them to do anything about.

There are some people that deserve some serious credit for helping me get Juice to this level of system:

Joe Gordon. My cohort in UtiliFlex, owner of UtiliSol He's been a pleasure to work with and develop Juice with.  His vision, drive, insight, intelligence, tolerence and ethics are without peer.

Lucius Hilley, Programmer. The kind that does hex/ascii/cipher math in his head whle coding in 3 or 6 languages at once while putting up with a lot of schtuff from me.

Isaac Ingram, Programmer. While we aren't using much of his excellent mapserver/event-outage management code in this system, a little of his soul permeates. 

Dave Brockman, SysAdmin. Helped me configure and setup the Intel Modular Server in record time, without laughing too much.

Catherine Colby, Tim Galbreth  and Rob Shaw, UtiliFlex Sales and Project team. Lots of interface, code and functionality improvements and quality control, as well as a significant part of the documentation.

Oh, and Ben, Judy, Mark and the team at MicroTronics for being a great supplier of high end hardware.



Side note: Isaac did the original GeekLabs logo's back in 1998. I think I've grown to look more like my cartoon self over time..
 
535 Chestnut Street - Suite 241 - Chattanooga TN 37402
423-605-6943