@cryptotaxi247 / netdata-1 / commits / cad699611

Add runtime for UPS

Shini31 committed May 22, 2018 at 13:18 UTC cad6996111b137e99336d4182c032e7d62d9d8ae
1 file changed +16 -7
charts.d/nut.chart.sh
+16 -7
@@ -81,38 +81,41 @@ nut_create() {
81 CHART nut_$x.charge '' "UPS Charge" "percentage" ups nut.charge area $((nut_priority + 1)) $nut_update_every
82 DIMENSION battery_charge charge absolute 1 100
83
84 -CHART nut_$x.battery_voltage '' "UPS Battery Voltage" "Volts" ups nut.battery.voltage line $((nut_priority + 2)) $nut_update_every
84 +CHART nut_$x.runtime '' "UPS Runtime" "seconds" ups nut.runtime area $((nut_priority + 2)) $nut_update_every
85 +DIMENSION battery_runtime runtime absolute 1 100
86 +
87 +CHART nut_$x.battery_voltage '' "UPS Battery Voltage" "Volts" ups nut.battery.voltage line $((nut_priority + 3)) $nut_update_every
88 DIMENSION battery_voltage voltage absolute 1 100
89 DIMENSION battery_voltage_high high absolute 1 100
90 DIMENSION battery_voltage_low low absolute 1 100
91 DIMENSION battery_voltage_nominal nominal absolute 1 100
92
90 -CHART nut_$x.input_voltage '' "UPS Input Voltage" "Volts" input nut.input.voltage line $((nut_priority + 3)) $nut_update_every
93 +CHART nut_$x.input_voltage '' "UPS Input Voltage" "Volts" input nut.input.voltage line $((nut_priority + 4)) $nut_update_every
94 DIMENSION input_voltage voltage absolute 1 100
95 DIMENSION input_voltage_fault fault absolute 1 100
96 DIMENSION input_voltage_nominal nominal absolute 1 100
97
95 -CHART nut_$x.input_current '' "UPS Input Current" "Ampere" input nut.input.current line $((nut_priority + 4)) $nut_update_every
98 +CHART nut_$x.input_current '' "UPS Input Current" "Ampere" input nut.input.current line $((nut_priority + 5)) $nut_update_every
99 DIMENSION input_current_nominal nominal absolute 1 100
100
98 -CHART nut_$x.input_frequency '' "UPS Input Frequency" "Hz" input nut.input.frequency line $((nut_priority + 5)) $nut_update_every
101 +CHART nut_$x.input_frequency '' "UPS Input Frequency" "Hz" input nut.input.frequency line $((nut_priority + 6)) $nut_update_every
102 DIMENSION input_frequency frequency absolute 1 100
103 DIMENSION input_frequency_nominal nominal absolute 1 100
104
102 -CHART nut_$x.output_voltage '' "UPS Output Voltage" "Volts" output nut.output.voltage line $((nut_priority + 6)) $nut_update_every
105 +CHART nut_$x.output_voltage '' "UPS Output Voltage" "Volts" output nut.output.voltage line $((nut_priority + 7)) $nut_update_every
106 DIMENSION output_voltage voltage absolute 1 100
107
108 CHART nut_$x.load '' "UPS Load" "percentage" ups nut.load area $((nut_priority)) $nut_update_every
109 DIMENSION load load absolute 1 100
110
108 -CHART nut_$x.temp '' "UPS Temperature" "temperature" ups nut.temperature line $((nut_priority + 7)) $nut_update_every
111 +CHART nut_$x.temp '' "UPS Temperature" "temperature" ups nut.temperature line $((nut_priority + 8)) $nut_update_every
112 DIMENSION temp temp absolute 1 100
113 EOF
114
115 if [ "${nut_clients_chart}" = "1" ]
116 then
117 cat <<EOF2
115 -CHART nut_$x.clients '' "UPS Connected Clients" "clients" ups nut.clients area $((nut_priority + 8)) $nut_update_every
118 +CHART nut_$x.clients '' "UPS Connected Clients" "clients" ups nut.clients area $((nut_priority + 9)) $nut_update_every
119 DIMENSION clients '' absolute 1 1
120 EOF2
121 fi
@@ -138,6 +141,7 @@ nut_update() {
141 nut_get "$i" | awk "
142 BEGIN {
143 battery_charge = 0;
144 + battery_runtime = 0;
145 battery_voltage = 0;
146 battery_voltage_high = 0;
147 battery_voltage_low = 0;
@@ -155,6 +159,7 @@ BEGIN {
159 do_clients = ${nut_clients_chart};
160 }
161 /^battery.charge: .*/ { battery_charge = \$2 * 100 };
162 +/^battery.runtime: .*/ { battery_runtime = \$2 * 100 };
163 /^battery.voltage: .*/ { battery_voltage = \$2 * 100 };
164 /^battery.voltage.high: .*/ { battery_voltage_high = \$2 * 100 };
165 /^battery.voltage.low: .*/ { battery_voltage_low = \$2 * 100 };
@@ -174,6 +179,10 @@ END {
179 print \"SET battery_charge = \" battery_charge;
180 print \"END\"
181
182 + print \"BEGIN nut_$x.runtime $1\";
183 + print \"SET battery_runtime = \" battery_runtime;
184 + print \"END\"
185 +
186 print \"BEGIN nut_$x.battery_voltage $1\";
187 print \"SET battery_voltage = \" battery_voltage;
188 print \"SET battery_voltage_high = \" battery_voltage_high;