$!XUPS.COM $! $! Has no inputs. Writes out lots of stuff. $! P1 = method $! P2 = path $! P3 = protocol $! $! Definitions $! $ nl = f$fao("!/") ! a newline $ say = "write net_link " ! write to the server $ wso = "write sys$output " ! write to the logfile $! $! Get the data $! $ set noverify $ @lib_source:[ups]getups/out=sys$scratch:rack1.out rack1.ups.opus1.com $ @lib_source:[ups]getups/out=sys$scratch:rack2.out rack2.ups.opus1.com $ @lib_source:[ups]getups/out=sys$scratch:rack4.out rack4.ups.opus1.com $ open/read/error=cantopen rack1 sys$scratch:rack1.out $ open/read/error=cantopen rack2 sys$scratch:rack2.out $ open/read/error=cantopen rack4 sys$scratch:rack4.out $! $! Write out the data information. $! $!+++ $! Start by writing out the HTTP header. $!--- $ say "" $ CGI_SYMBOLS "WWW_" "FORM_" $ say "Content-Type: text/html" $ say "Status: 200 Everything is going to be OK",nl $ if www_request_method .eqs. "HEAD" then exit $!+++ $! And now the actual HTML starts up. $! $! We begin with the title and other useless information $! and then slip in a little JavaScript function which $! lets us jump to page based on mouse-down functions $!--- $ say "" $ say "Opus One UPS Network Status", nl $ say "" $ say "" $ say "" $! $ say "" $!+++ $! OK, that's enough of the header. Now we begin the body of the $! page. $!--- $ say "" $ say "" $ say "" $ say "" $ say "" $ say "
" $ say "

" $ say "

" $ say "

" $ say "

" $ say "

" $ say "

" $ say "
" $ say "" $!+++ $! This is the main table which has all the values in it. $! It's not too smart---just a little padding, spacing, and border $!--- $ say "" $! $!+++ $! First row: the names of the columns $! First element - blank $! Second element - "Rack 1" $! Third element - "Rack 4" $!--- $ say "" $ say "" $ say "" $ say "" $ say "" $ say "" $! $!+++ $! Second row and following: the values $!--- $readloop: $ read/end=nomore/error=cantread rack1 title $ read/end=nomore/error=cantread rack2 title $ read/end=nomore/error=cantread rack4 title $ read/end=nomore/error=cantread rack1 line $ colon = f$locate(":",line) $ var1 = f$extract(colon+2,99,line) $ read/end=nomore/error=cantread rack2 line $ colon = f$locate(":",line) $ var2 = f$extract(colon+2,99,line) $ read/end=nomore/error=cantread rack4 line $ colon = f$locate(":",line) $ var4 = f$extract(colon+2,99,line) $! $ say "" $ say "" $! $ if ("''title'" .eqs. "Battery Charge") $ then $ call lookupBasicBatteryStatus 'var1' string1 $ call lookupBasicBatteryStatus 'var2' string2 $ call lookupBasicBatteryStatus 'var4' string4 $ say "" $ say "" $ say "" $ goto readloop $ endif $ if ("''title'" .eqs. "Battery Replacement") $ then $ call lookupBatteryReplaceIndicator 'var1' string1 $ call lookupBatteryReplaceIndicator 'var2' string2 $ call lookupBatteryReplaceIndicator 'var4' string4 $ say "" $ say "" $ say "" $ goto readloop $ endif $ if ("''title'" .eqs. "Reason for last UPS transfer") $ then $ call lookupLineFailCause 'var1' string1 $ call lookupLineFailCause 'var2' string2 $ call lookupLineFailCause 'var4' string4 $ say "" $ say "" $ say "" $ goto readloop $ endif $ if ("''title'" .eqs. "Current UPS Output Status") $ then $ call lookupOutputStatus 'var1' string1 $ call lookupOutputStatus 'var2' string2 $ call lookupOutputStatus 'var4' string4 $ say "" $ say "" $ say "" $ goto readloop $ endif $ say "" $ say "" $ say "" $ say "" $ goto readloop $! $nomore: $ say "
Rack 1Rack 2Rack 4
''title'''string1'''string2'''string4'''string1'''string2'''string4'''string1'''string2'''string4'''string1'''string2'''string4'''var1'''var2'''var4'
" $ say "




" $! $! $ say "

" $ say "Home . Consulting . " $ say "Library . " $ say "Internet Services . " $ say "About Us" $ say "

© 1999 Opus One

" $ say "
" $ say "
" $ say "
" $ say "" $! $ close rack1 $ close rack2 $ close rack4 $ delete/nolog sys$scratch:rack1.out;* $ delete/nolog sys$scratch:rack2.out;* $ delete/nolog sys$scratch:rack4.out;* $! $ exit $cantopen: $ say "Cannot open CGI temporary files. Try again, or call for help." $ exit $cantread: $ say "Cannot read CGI temporary files. Try again, or call for help." $ exit $ lookupBasicBatteryStatus: SUBROUTINE $! P1 = variable to lookup $! P2 = place to put answer $ &p2 == "Invalid" $ if ( p1 .eq. 1) then $ &p2 == "unknown" $ if ( p1 .eq. 2) then $ &p2 == "Normal" $ if ( p1 .eq. 3) then $ &p2 == "Low" $ EXIT $ ENDSUBROUTINE $ lookupBatteryReplaceIndicator: SUBROUTINE $! P1 = variable to lookup $! P2 = place to put answer $ &p2 == "Invalid" $ if ( p1 .eq. 1) then $ &p2 == "Battery OK" $ if ( p1 .eq. 2) then $ &p2 == "REPLACE" $ EXIT $ ENDSUBROUTINE $ lookupLineFailCause: SUBROUTINE $! P1 = variable to lookup $! P2 = place to put answer $ &p2 == "Invalid" $ if ( p1 .eq. 1) then $ &p2 == "No Transfer" $ if ( p1 .eq. 2) then $ &p2 == "High Line Voltage" $ if ( p1 .eq. 3) then $ &p2 == "Brownout" $ if ( p1 .eq. 4) then $ &p2 == "Blackout" $ if ( p1 .eq. 5) then $ &p2 == "Small momentary sag" $ if ( p1 .eq. 6) then $ &p2 == "Deep momentary sag" $ if ( p1 .eq. 7) then $ &p2 == "Small momentary spike" $ if ( p1 .eq. 8) then $ &p2 == "Large momentary spike" $ if ( p1 .eq. 9) then $ &p2 == "Self Test" $ if ( p1 .eq. 10) then $ &p2 == "Rate of Voltage Change" $ EXIT $ ENDSUBROUTINE $ lookupOutputStatus: SUBROUTINE $! P1 = variable to lookup $! P2 = place to put answer $ &p2 == "Invalid" $ if ( p1 .eq. 1) then $ &p2 == "unknown" $ if ( p1 .eq. 2) then $ &p2 == "On-Line" $ if ( p1 .eq. 3) then $ &p2 == "On Battery" $ if ( p1 .eq. 4) then $ &p2 == "on Smart Boost" $ if ( p1 .eq. 5) then $ &p2 == "Timed Sleeping" $ if ( p1 .eq. 6) then $ &p2 == "Software bypass" $ if ( p1 .eq. 7) then $ &p2 == "Off" $ if ( p1 .eq. 8) then $ &p2 == "Rebooting" $ if ( p1 .eq. 9) then $ &p2 == "Switched Bypass" $ if ( p1 .eq. 10) then $ &p2 == "Hardware Failure Bypass" $ if ( p1 .eq. 11) then $ &p2 == "Sleeping until power returns" $ if ( p1 .eq. 12) then $ &p2 == "on Smart Trim" $ EXIT $ ENDSUBROUTINE