Changeset 4097

Show
Ignore:
Timestamp:
01/14/11 15:43:18 (1 year ago)
Author:
jo
Message:

- IPMI plugin now graphs power usage as well (#954)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plugins/node.d.linux/ipmi_.in

    r2314 r4097  
    5555    suggest) echo fans 
    5656             echo temp 
     57             echo power 
    5758             exit 0;; 
    5859    config)  CONFIG=config;; 
     
    6263    *_temp) MEASURE=temp;; 
    6364    *_fans) MEASURE=fans;; 
     65    *_power) MEASURE=power;; 
    6466    *) echo Please invoke as ipmi_temp or ipmi_fans >&2 
    6567       exit 1;; 
     
    7476    FANS = ""; 
    7577    TEMPS = ""; 
     78    POWER = ""; 
    7679    CFANS = "graph_title Fan speeds based on IPMI\ngraph_vlabel RPM\ngraph_category Sensors\n"; 
    7780    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"; 
    7882} 
    7983 
     
    136140} 
    137141 
     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 
    138157END { 
    139158    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; 
    142164    } else { 
    143        VALUE=FANS; 
    144        CONFIG=CFANS; 
     165        VALUE=FANS; 
     166        CONFIG=CFANS; 
    145167    } 
    146168    if (ENVIRON["CONFIG"] == "config") 
    147        printf "%s",CONFIG; 
     169        printf "%s",CONFIG; 
    148170    else 
    149        printf "%s",VALUE; 
     171        printf "%s",VALUE; 
    150172} 
    151173' 
     174 
     175# vim: syntax=sh ts=4 et