Listing 1

<html>
	<head>
		<title>Power Details</title>

		<!---
		UPS Monitoring Sample Script
Ryan D Emerle (rde@emerle.net) and Matthew I Fusfield (matt@fus.net) --->

		<style>
			td { border: solid 1px black; }
			table {
				  border-collapse:collapse;
				   border: solid 1px black;
				}

		</style>

		<!--- refresh the screen every 10 seconds --->
		<cfoutput>
		<META HTTP-EQUIV="Refresh" CONTENT="10;URL=#cgi.script_name#">
		</cfoutput>
	<head>
<body>


<!--- set your SNMP community name here --->
<cfset community="public">

<!--- these are the OIDs we will reference later --->
<cfset ups=structNew()>
<cfset ups["status"]="1.3.6.1.4.1.318.1.1.1.4.1.1.0">
<cfset ups["capacity"]="1.3.6.1.4.1.318.1.1.1.2.2.1.0">
<cfset ups["temp"]="1.3.6.1.4.1.318.1.1.1.2.2.2.0"> <!--- Deg celsius --->
<cfset ups["runtime"]="1.3.6.1.4.1.318.1.1.1.2.2.3.0"> <!--- Timeticks are
 100ths of a second --->
<cfset ups["replace"]="1.3.6.1.4.1.318.1.1.1.2.2.4.0"> <!---  1=OK, 2=Replace
 --->
<cfset ups["load"]="1.3.6.1.4.1.318.1.1.1.4.2.3">
<cfset ups["model"]="1.3.6.1.4.1.318.1.1.1.1.1.1">
<cfset ups["involts"]="1.3.6.1.4.1.318.1.1.1.3.2.1">


	<!--- this script assumes your UPS's are named ups1.company.net,
	 ups2.company.net, and ups3.company.net
	 loop through this list of UPS's to monitor --->
	<cfloop list="1,2,3" index="i">

		<!---
		This produces a 7 row query (one for each OID)
		Columns: Hex, OID, Type, Value
		---->
		<cfx_snmp
			timeout=1
			community="#community#"
			host="ups#i#.company.net"

	oid="#ups['runtime']#,#ups['status']#,#ups['temp']#,#ups['replace']#,
	#ups['load']#,#ups['model']#,#ups['involts']#"
			r_qResults="stats">

		<cfoutput>
		<br>

		<big><b>UPS#i#</b></big> (#stats.value[6]#) <!--- this will
		 display the model number (row and OID 6) --->
		<table width="500" cellspacing=0 bordercolor="black">
			<tr bgcolor="555555">
		<td><b style="color: white">Runtime Remaining</b></td>
		<td><b style="color: white">Status</b></td>
		<td><b style="color: white">Temperature</b></td>
		<td><b style="color: white">Battery OK?</b></td>
		<td><b style="color: white">Load</b></td>
		<td><b style="color: white">Input Voltage</b></td>
			</tr>
			<tr>

	<!--- the first OID and row is runtime remaining expressed
	 in "timeticks" Convert into minutes and output --->

		<td>#evaluate(stats.value[1]/100/60)# minutes</td>


	<!--- the second row is the status as reported by the UPS
	 --->
		<!--- output a text description of the UPS status --->
		<cfswitch expression="#stats.value[2]#">
			<cfcase value="1">
				<td bgcolor="red"><b>unknown</b></td>
			</cfcase>
			<cfcase value="2">
				<td bgcolor="lime">on AC power</td>
		</cfcase>
			<cfcase value="3">
				<td bgcolor="red"><b>on
				 battery</b></td>
			</cfcase>
			<cfcase value="4">
				<td bgcolor="yellow"><b>on smart
				 boost</b></td>
			</cfcase>
			<cfcase value="5">
				<td bgcolor="yellow"><b>timed
				 sleeping</b></td>
			</cfcase>
			<cfcase value="6">
				<td bgcolor="yellow"><b>software
				 bypass</b></td>
			</cfcase>
			<cfcase value="7">
				<td bgcolor="yellow"><b>off</b></td>
			</cfcase>
			<cfcase value="8">
				<td
				 bgcolor="yellow"><b>rebooting</b></td>
			</cfcase>
			<cfcase value="9">
				<td bgcolor="yellow"><b>switchedBypass
				 </b></td>
			</cfcase>
			<cfcase value="10">
				<td bgcolor="yellow"><b>hardwareFailureBypass
				 </b></td>
			</cfcase>
			<cfcase value="11">
				<td
				 bgcolor="yellow"><b>sleepingUntilPowerReturn
				  </b></td>
			</cfcase>
			<cfcase value="12">
				<td bgcolor="yellow"><b>onSmartTrim
				 </b></td></td>
			</cfcase>
		</cfswitch>

	<!--- the third row is the UPS temperature. Convert into
	 degrees F and change the color if we
	      are getting close or exceed the recommended operating
		   temperatures --->

		<cfset temp=evaluate((stats.value[3] * 1.8) + 32)>
		<cfif temp gte 145>
			<td bgcolor="red"><b>#temp#°F</b></td>
		<cfelseif temp gte 120>
			<td
			 bgcolor="yellow"><b>#temp#°F</b></td>
		<cfelse>
			<td bgcolor="lime">#temp#°F</td>
		</cfif>

	<!---- the forth OID specifies if the UPS thinks the battery
	 needs to be replaced --->
	<cfif stats.value[4] eq 1>
			<td bgcolor="lime">Yes</td>
		<cfelse>
			<td bgcolor="red"><b>No</b></td>
		</cfif>

					
	<!--- the fifth OID is the percentage load on the UPS.
	 Again, change color depending on how
		 close to 100% we get --->

		<cfif stats.value[5] gte 90>
			<td
			 bgcolor="red"><b>#stats.value[5]#%</b></td>
		<cfelseif stats.value[5] gte 80>
			<td
			bgcolor="yellow"><b>#stats.value[5]#%</b></td>
		<cfelse>
			<td bgcolor="lime">#stats.value[5]#%</td>
		</cfif>


	<!--- the sixth row is used above to specify the model
	 number

	The seventh row is the line-in voltage --->

		<td>#stats.value[7]#</td>		

			</tr>
		</table>
		</cfoutput>
	</cfloop>


</body>
</html>