NxJ Revenue Indicator

September 30th, 2013 in Electronics by 0 Comments

Visual Monitoring (Part II)

On Friday the 13th (9/13/13) J.O. and I participated in the company-wide Next Jump Hackathon 2013. We decided that instead of focusing on a software-based project, we should do a hardware-based project. This is a technical follow-up on our original project post, which can be found here

How It Works:
A cron job runs two Shell scripts (revenue and site status) every 20 minutes and minute, respectively.

The site status Shell script first cURLs an internal dashboard that contains the status of the Next Jump sites. The site is then piped into a stream editor (sed) to pick out the graphic name used for site status. This value is grep’ed to check it it contains a certain graphic. We finally run an snmpset call passing either an on/off integer value, depending on the boolean result of the grep call.

GET_CURL=$(curl -ks | sed -n '/nettable/,/Production/p')
echo $GET_CURL | grep -q 'light_green'
if [[ $? == 0 ]] ;then

As for the revenue status Shell script, the script cURLs another internal dashboard that contains both goal and current revenue. The result is then run through a series of stream editor (sed) and pattern-directed scanning and processing language (awk) calls in order to pull both the goal and current values.

GET_GOAL=$(curl -ks | sed -n '/totalRow/,/avgRevenue/p' | sed -n '/goalRevenue/,/avgRevenue/p' | awk 'BEGIN{ RS="K<\/td>"}{gsub(/.*>$ /,"")}1{print $RS;exit}' | sed -e 's/^.*">$ \( \)*//')

In order to visually tell when the revenue status script ran, and to give the project flair, we added a small Shell script inside the revenue status Shell script to blink the revenue lights (red, yellow, green) in a continuous daisy-chain pattern for two cycles.

until [ $COUNTER -lt 0 ]; do
let COUNTER-=1

Once we return back to the revenue status script, an snmpset calls are made to turn off the revenue lights, followed by another snmpset call to turn on the socket that corresponds to the revenue standings.

The visual monitoring body is composed of 3/4″ x 10″ solid oak board and is fastened with 1.5″ corrosion proof deck fasteners. It houses a smart PVD devise and is wired to the lighting system via 110 volt grounded pig tails. Leviton Ceramic lighting fixtures with NxJ beer pint glasses contain the heat created by the CFL lights and add to the decor. V2 will consist of color, labeling, and branding the devise, as well as installing an audible alert for coronitas.

Bill of Materials:
(1) APC Switched Rack PVD
(1) 110v Red light siren
(3) Beer Pint Glasses
(3) Feit Electric 13-Watt (60W) Twist CFL LightBulb (Red, Green, Yellow Bug)
(1) Lava Lamp
(3) Leviton Ceramic Keyless Lamp Holder
(36) Drill Screws
(1) Ethernet Cable
(3) Lamp Cord Set

MAN Pages
Steve B. (Fellow NxJ enlightened in the art of Shell scripting)


Author: ezraezra

I see you looking...

Leave a Reply