Changeset 4097
- Timestamp:
- 01/14/11 15:43:18 (1 year ago)
- Files:
-
- trunk/plugins/node.d.linux/ipmi_.in (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plugins/node.d.linux/ipmi_.in
r2314 r4097 55 55 suggest) echo fans 56 56 echo temp 57 echo power 57 58 exit 0;; 58 59 config) CONFIG=config;; … … 62 63 *_temp) MEASURE=temp;; 63 64 *_fans) MEASURE=fans;; 65 *_power) MEASURE=power;; 64 66 *) echo Please invoke as ipmi_temp or ipmi_fans >&2 65 67 exit 1;; … … 74 76 FANS = ""; 75 77 TEMPS = ""; 78 POWER = ""; 76 79 CFANS = "graph_title Fan speeds based on IPMI\ngraph_vlabel RPM\ngraph_category Sensors\n"; 77 80 CTEMPS = "graph_title Machine temperature based on IPMI\ngraph_vlabel Degrees celcius\ngraph_category Sensors\n"; 81 CPOWER = "graph_title Power usage based on IPMI\ngraph_vlabel W\ngraph_category Sensors\n"; 78 82 } 79 83 … … 136 140 } 137 141 142 /Watts/ { 143 NAME=THING=$1; 144 gsub(/[^A-Za-z0-9]/,"",NAME); 145 WATTS=$2; 146 147 # Find unique name 148 while (NAMES[NAME] >= 1) { 149 NAME=sprintf("%si",NAME); 150 } 151 NAMES[NAME]=1; 152 153 POWER = sprintf("%s%s.value %s\n",POWER,NAME,WATTS); 154 CPOWER = sprintf("%s%s.label %s\n",CPOWER,NAME,THING); 155 } 156 138 157 END { 139 158 if (ENVIRON["MEASURE"] == "temp") { 140 VALUE=TEMPS; 141 CONFIG=CTEMPS; 159 VALUE=TEMPS; 160 CONFIG=CTEMPS; 161 } else if (ENVIRON["MEASURE"] == "power") { 162 VALUE=POWER; 163 CONFIG=CPOWER; 142 164 } else { 143 VALUE=FANS;144 CONFIG=CFANS;165 VALUE=FANS; 166 CONFIG=CFANS; 145 167 } 146 168 if (ENVIRON["CONFIG"] == "config") 147 printf "%s",CONFIG;169 printf "%s",CONFIG; 148 170 else 149 printf "%s",VALUE;171 printf "%s",VALUE; 150 172 } 151 173 ' 174 175 # vim: syntax=sh ts=4 et
