/[smecontribs]/rpms/smeserver-sysmon/contribs10/smeserver-sysmon-6.5-bz4449.patch
ViewVC logotype

Annotation of /rpms/smeserver-sysmon/contribs10/smeserver-sysmon-6.5-bz4449.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Thu Oct 29 17:41:55 2020 UTC (4 years ago) by brianr
Branch: MAIN
CVS Tags: smeserver-sysmon-6_5-4_el7_sme, smeserver-sysmon-6_5-2_el7_sme, smeserver-sysmon-6_5-5_el7_sme, smeserver-sysmon-6_5-3_el7_sme, HEAD
Initial import

1 brianr 1.1 diff -Nur smeserver-sysmon-6.5.old/root/etc/e-smith/web/functions/sysmon smeserver-sysmon-6.5/root/etc/e-smith/web/functions/sysmon
2     --- smeserver-sysmon-6.5.old/root/etc/e-smith/web/functions/sysmon 2019-12-26 22:48:57.000000000 -0500
3     +++ smeserver-sysmon-6.5/root/etc/e-smith/web/functions/sysmon 2019-12-26 22:52:50.287000000 -0500
4     @@ -336,133 +336,68 @@
5     $VOLTAGE_GRAPH = "-b '1000' ";
6     $VOLTAGE_GRAPH .= "-t 'System Sensors (Voltage)' ";
7     $VOLTAGE_GRAPH .= "-v 'Volts' ";
8     -$VOLTAGE_GRAPH .= "'DEF:minin0=$RRDDIR/$SENSORSFILE.rrd:in0:MIN' ";
9     -$VOLTAGE_GRAPH .= "'DEF:avgin0=$RRDDIR/$SENSORSFILE.rrd:in0:AVERAGE' ";
10     -$VOLTAGE_GRAPH .= "'DEF:maxin0=$RRDDIR/$SENSORSFILE.rrd:in0:MAX' ";
11     -$VOLTAGE_GRAPH .= "'DEF:minin1=$RRDDIR/$SENSORSFILE.rrd:in1:MIN' ";
12     -$VOLTAGE_GRAPH .= "'DEF:avgin1=$RRDDIR/$SENSORSFILE.rrd:in1:AVERAGE' ";
13     -$VOLTAGE_GRAPH .= "'DEF:maxin1=$RRDDIR/$SENSORSFILE.rrd:in1:MAX' ";
14     -$VOLTAGE_GRAPH .= "'DEF:minin2=$RRDDIR/$SENSORSFILE.rrd:in2:MIN' ";
15     -$VOLTAGE_GRAPH .= "'DEF:avgin2=$RRDDIR/$SENSORSFILE.rrd:in2:AVERAGE' ";
16     -$VOLTAGE_GRAPH .= "'DEF:maxin2=$RRDDIR/$SENSORSFILE.rrd:in2:MAX' ";
17     -$VOLTAGE_GRAPH .= "'DEF:minin3=$RRDDIR/$SENSORSFILE.rrd:in3:MIN' ";
18     -$VOLTAGE_GRAPH .= "'DEF:avgin3=$RRDDIR/$SENSORSFILE.rrd:in3:AVERAGE' ";
19     -$VOLTAGE_GRAPH .= "'DEF:maxin3=$RRDDIR/$SENSORSFILE.rrd:in3:MAX' ";
20     -$VOLTAGE_GRAPH .= "'DEF:minin4=$RRDDIR/$SENSORSFILE.rrd:in4:MIN' ";
21     -$VOLTAGE_GRAPH .= "'DEF:avgin4=$RRDDIR/$SENSORSFILE.rrd:in4:AVERAGE' ";
22     -$VOLTAGE_GRAPH .= "'DEF:maxin4=$RRDDIR/$SENSORSFILE.rrd:in4:MAX' ";
23     -$VOLTAGE_GRAPH .= "'DEF:minin5=$RRDDIR/$SENSORSFILE.rrd:in5:MIN' ";
24     -$VOLTAGE_GRAPH .= "'DEF:avgin5=$RRDDIR/$SENSORSFILE.rrd:in5:AVERAGE' ";
25     -$VOLTAGE_GRAPH .= "'DEF:maxin5=$RRDDIR/$SENSORSFILE.rrd:in5:MAX' ";
26     -$VOLTAGE_GRAPH .= "'DEF:minin6=$RRDDIR/$SENSORSFILE.rrd:in6:MIN' ";
27     -$VOLTAGE_GRAPH .= "'DEF:avgin6=$RRDDIR/$SENSORSFILE.rrd:in6:AVERAGE' ";
28     -$VOLTAGE_GRAPH .= "'DEF:maxin6=$RRDDIR/$SENSORSFILE.rrd:in6:MAX' ";
29     -$VOLTAGE_GRAPH .= "'DEF:minin7=$RRDDIR/$SENSORSFILE.rrd:in7:MIN' ";
30     -$VOLTAGE_GRAPH .= "'DEF:avgin7=$RRDDIR/$SENSORSFILE.rrd:in7:AVERAGE' ";
31     -$VOLTAGE_GRAPH .= "'DEF:maxin7=$RRDDIR/$SENSORSFILE.rrd:in7:MAX' ";
32     -$VOLTAGE_GRAPH .= "'DEF:minin8=$RRDDIR/$SENSORSFILE.rrd:in8:MIN' ";
33     -$VOLTAGE_GRAPH .= "'DEF:avgin8=$RRDDIR/$SENSORSFILE.rrd:in8:AVERAGE' ";
34     -$VOLTAGE_GRAPH .= "'DEF:maxin8=$RRDDIR/$SENSORSFILE.rrd:in8:MAX' ";
35     -$VOLTAGE_GRAPH .= "'COMMENT:Current\\tMinimum\\tAverage\\tMaximum\\tAvg\\n' ";
36     -$VOLTAGE_GRAPH .= "'GPRINT:avgin0:LAST:%6.2lf\\g' ";
37     -$VOLTAGE_GRAPH .= "'GPRINT:minin0:MIN:\\t%6.2lf\\g' ";
38     -$VOLTAGE_GRAPH .= "'GPRINT:avgin0:AVERAGE:\\t%6.2lf\\g' ";
39     -$VOLTAGE_GRAPH .= "'GPRINT:maxin0:MAX:\\t%6.2lf\\g' ";
40     -$VOLTAGE_GRAPH .= "'COMMENT:\\t\\g' ";
41     -$VOLTAGE_GRAPH .= "'LINE2:avgin0#CC0099:\\tVoltage 0 (V)\\n' ";
42     -$VOLTAGE_GRAPH .= "'GPRINT:avgin1:LAST:%6.2lf\\g' ";
43     -$VOLTAGE_GRAPH .= "'GPRINT:minin1:MIN:\\t%6.2lf\\g' ";
44     -$VOLTAGE_GRAPH .= "'GPRINT:avgin1:AVERAGE:\\t%6.2lf\\g' ";
45     -$VOLTAGE_GRAPH .= "'GPRINT:maxin1:MAX:\\t%6.2lf\\g' ";
46     -$VOLTAGE_GRAPH .= "'COMMENT:\\t\\g' ";
47     -$VOLTAGE_GRAPH .= "'LINE2:avgin1#FF99CC:\\tVoltage 1 (V)\\n' ";
48     -$VOLTAGE_GRAPH .= "'GPRINT:avgin2:LAST:%6.2lf\\g' ";
49     -$VOLTAGE_GRAPH .= "'GPRINT:minin2:MIN:\\t%6.2lf\\g' ";
50     -$VOLTAGE_GRAPH .= "'GPRINT:avgin2:AVERAGE:\\t%6.2lf\\g' ";
51     -$VOLTAGE_GRAPH .= "'GPRINT:maxin2:MAX:\\t%6.2lf\\g' ";
52     -$VOLTAGE_GRAPH .= "'COMMENT:\\t\\g' ";
53     -$VOLTAGE_GRAPH .= "'LINE2:avgin2#8B4513:\\tVoltage 2 (V)\\n' ";
54     -$VOLTAGE_GRAPH .= "'GPRINT:avgin3:LAST:%6.2lf\\g' ";
55     -$VOLTAGE_GRAPH .= "'GPRINT:minin3:MIN:\\t%6.2lf\\g' ";
56     -$VOLTAGE_GRAPH .= "'GPRINT:avgin3:AVERAGE:\\t%6.2lf\\g' ";
57     -$VOLTAGE_GRAPH .= "'GPRINT:maxin3:MAX:\\t%6.2lf\\g' ";
58     -$VOLTAGE_GRAPH .= "'COMMENT:\\t\\g' ";
59     -$VOLTAGE_GRAPH .= "'LINE2:avgin3#DAA520:\\tVoltage 3 (V)\\n' ";
60     -$VOLTAGE_GRAPH .= "'GPRINT:avgin4:LAST:%6.2lf\\g' ";
61     -$VOLTAGE_GRAPH .= "'GPRINT:minin4:MIN:\\t%6.2lf\\g' ";
62     -$VOLTAGE_GRAPH .= "'GPRINT:avgin4:AVERAGE:\\t%6.2lf\\g' ";
63     -$VOLTAGE_GRAPH .= "'GPRINT:maxin4:MAX:\\t%6.2lf\\g' ";
64     -$VOLTAGE_GRAPH .= "'COMMENT:\\t\\g' ";
65     -$VOLTAGE_GRAPH .= "'LINE2:avgin4#FF0000:\\tVoltage 4 (V)\\n' ";
66     -$VOLTAGE_GRAPH .= "'GPRINT:avgin5:LAST:%6.2lf\\g' ";
67     -$VOLTAGE_GRAPH .= "'GPRINT:minin5:MIN:\\t%6.2lf\\g' ";
68     -$VOLTAGE_GRAPH .= "'GPRINT:avgin5:AVERAGE:\\t%6.2lf\\g' ";
69     -$VOLTAGE_GRAPH .= "'GPRINT:maxin5:MAX:\\t%6.2lf\\g' ";
70     -$VOLTAGE_GRAPH .= "'COMMENT:\\t\\g' ";
71     -$VOLTAGE_GRAPH .= "'LINE2:avgin5#FFFF00:\\tVoltage 5 (V)\\n' ";
72     -$VOLTAGE_GRAPH .= "'GPRINT:avgin6:LAST:%6.2lf\\g' ";
73     -$VOLTAGE_GRAPH .= "'GPRINT:minin6:MIN:\\t%6.2lf\\g' ";
74     -$VOLTAGE_GRAPH .= "'GPRINT:avgin6:AVERAGE:\\t%6.2lf\\g' ";
75     -$VOLTAGE_GRAPH .= "'GPRINT:maxin6:MAX:\\t%6.2lf\\g' ";
76     -$VOLTAGE_GRAPH .= "'COMMENT:\\t\\g' ";
77     -$VOLTAGE_GRAPH .= "'LINE2:avgin6#0000FF:\\tVoltage 6 (V)\\n' ";
78     -$VOLTAGE_GRAPH .= "'GPRINT:avgin7:LAST:%6.2lf\\g' ";
79     -$VOLTAGE_GRAPH .= "'GPRINT:minin7:MIN:\\t%6.2lf\\g' ";
80     -$VOLTAGE_GRAPH .= "'GPRINT:avgin7:AVERAGE:\\t%6.2lf\\g' ";
81     -$VOLTAGE_GRAPH .= "'GPRINT:maxin7:MAX:\\t%6.2lf\\g' ";
82     -$VOLTAGE_GRAPH .= "'COMMENT:\\t\\g' ";
83     -$VOLTAGE_GRAPH .= "'LINE2:avgin7#999999:\\tVoltage 7 (V)\\n' ";
84     -$VOLTAGE_GRAPH .= "'GPRINT:avgin8:LAST:%6.2lf\\g' ";
85     -$VOLTAGE_GRAPH .= "'GPRINT:minin8:MIN:\\t%6.2lf\\g' ";
86     -$VOLTAGE_GRAPH .= "'GPRINT:avgin8:AVERAGE:\\t%6.2lf\\g' ";
87     -$VOLTAGE_GRAPH .= "'GPRINT:maxin8:MAX:\\t%6.2lf\\g' ";
88     -$VOLTAGE_GRAPH .= "'COMMENT:\\t\\g' ";
89     -$VOLTAGE_GRAPH .= "'LINE2:avgin8#000000:\\tVoltage 8 (V)\\n' ";
90     +my @color = ('CC0099', 'FF99CC', '0000FF', '8B4513', 'DAA520', 'FF0000', 'FFFF00','0000FF', '999999', '000000');
91     +my $sensortest = `/usr/bin/rrdtool fetch $RRDDIR/$SENSORSFILE.rrd AVERAGE -s -0 |/usr/bin/head -n1| /usr/bin/tr -s ' '| /usr/bin/tr -d '\n'`;
92     +my @sensorarr = split / /, $sensortest;
93     +my %params = map { $_ => 1 } @sensorarr;
94     +my $isvolt = "";
95     +for (my $i=0; $i <= 8; $i++) {
96     +if(exists($params{"in$i"})) {
97     + $VOLTAGE_GRAPH .= "'DEF:minin$i=$RRDDIR/$SENSORSFILE.rrd:in$i:MIN' ";
98     + $VOLTAGE_GRAPH .= "'DEF:avgin$i=$RRDDIR/$SENSORSFILE.rrd:in$i:AVERAGE' ";
99     + $VOLTAGE_GRAPH .= "'DEF:maxin$i=$RRDDIR/$SENSORSFILE.rrd:in$i:MAX' ";
100     + $VOLTAGE_GRAPH .= "'COMMENT:Current\\tMinimum\\tAverage\\tMaximum\\tAvg\\n' " if $i == 0;
101     + $VOLTAGE_GRAPH .= "'GPRINT:avgin$i:LAST:%6.2lf\\g' ";
102     + $VOLTAGE_GRAPH .= "'GPRINT:minin$i:MIN:\\t%6.2lf\\g' ";
103     + $VOLTAGE_GRAPH .= "'GPRINT:avgin$i:AVERAGE:\\t%6.2lf\\g' ";
104     + $VOLTAGE_GRAPH .= "'GPRINT:maxin$i:MAX:\\t%6.2lf\\g' ";
105     + $VOLTAGE_GRAPH .= "'COMMENT:\\t\\g' ";
106     + $VOLTAGE_GRAPH .= "'LINE2:avgin0#".$color[$i].":\\tVoltage $i (V)\\n' ";
107     + $isvolt=1;
108     + }
109     +}
110    
111     $FAN_GRAPH = "-b '1000' ";
112     $FAN_GRAPH .= "-t 'System Sensors (Fans)' ";
113     $FAN_GRAPH .= "-v 'RPM' ";
114     -$FAN_GRAPH .= "'DEF:minfan1=$RRDDIR/$SENSORSFILE.rrd:fan1:MIN' ";
115     -$FAN_GRAPH .= "'DEF:avgfan1=$RRDDIR/$SENSORSFILE.rrd:fan1:AVERAGE' ";
116     -$FAN_GRAPH .= "'DEF:maxfan1=$RRDDIR/$SENSORSFILE.rrd:fan1:MAX' ";
117     -$FAN_GRAPH .= "'DEF:minfan2=$RRDDIR/$SENSORSFILE.rrd:fan2:MIN' ";
118     -$FAN_GRAPH .= "'DEF:avgfan2=$RRDDIR/$SENSORSFILE.rrd:fan2:AVERAGE' ";
119     -$FAN_GRAPH .= "'DEF:maxfan2=$RRDDIR/$SENSORSFILE.rrd:fan2:MAX' ";
120     -$FAN_GRAPH .= "'DEF:minfan3=$RRDDIR/$SENSORSFILE.rrd:fan3:MIN' ";
121     -$FAN_GRAPH .= "'DEF:avgfan3=$RRDDIR/$SENSORSFILE.rrd:fan3:AVERAGE' ";
122     -$FAN_GRAPH .= "'DEF:maxfan3=$RRDDIR/$SENSORSFILE.rrd:fan3:MAX' ";
123     -$FAN_GRAPH .= "'COMMENT:Current\\tMinimum\\tAverage\\tMaximum\\tAvg\\n' ";
124     -$FAN_GRAPH .= "'GPRINT:avgfan1:LAST:%6.0lf\\g' ";
125     -$FAN_GRAPH .= "'GPRINT:minfan1:MIN:\\t%6.0lf\\g' ";
126     -$FAN_GRAPH .= "'GPRINT:avgfan1:AVERAGE:\\t%6.0lf\\g' ";
127     -$FAN_GRAPH .= "'GPRINT:maxfan1:MAX:\\t%6.0lf\\g' ";
128     -$FAN_GRAPH .= "'COMMENT:\\t\\g' ";
129     -$FAN_GRAPH .= "'LINE2:avgfan1#0000FF:\\tFan 1 (rpm)\\n' ";
130     -$FAN_GRAPH .= "'GPRINT:avgfan2:LAST:%6.0lf\\g' ";
131     -$FAN_GRAPH .= "'GPRINT:minfan2:MIN:\\t%6.0lf\\g' ";
132     -$FAN_GRAPH .= "'GPRINT:avgfan2:AVERAGE:\\t%6.0lf\\g' ";
133     -$FAN_GRAPH .= "'GPRINT:maxfan2:MAX:\\t%6.0lf\\g' ";
134     -$FAN_GRAPH .= "'COMMENT:\\t\\g' ";
135     -$FAN_GRAPH .= "'LINE2:avgfan2#8B4513:\\tFan 2 (rpm)\\n' ";
136     -$FAN_GRAPH .= "'GPRINT:avgfan3:LAST:%6.0lf\\g' ";
137     -$FAN_GRAPH .= "'GPRINT:minfan3:MIN:\\t%6.0lf\\g' ";
138     -$FAN_GRAPH .= "'GPRINT:avgfan3:AVERAGE:\\t%6.0lf\\g' ";
139     -$FAN_GRAPH .= "'GPRINT:maxfan3:MAX:\\t%6.0lf\\g' ";
140     -$FAN_GRAPH .= "'COMMENT:\\t\\g' ";
141     -$FAN_GRAPH .= "'LINE2:avgfan3#FF0000:\\tFan 3 (rpm)\\n' ";
142     +my $isfan = "";
143     +for (my $i=1; $i <= 3; $i++) {
144     +if(exists($params{"fan$i"})) {
145     + $FAN_GRAPH .= "'DEF:minfan$i=$RRDDIR/$SENSORSFILE.rrd:fan$i:MIN' ";
146     + $FAN_GRAPH .= "'DEF:avgfan$i=$RRDDIR/$SENSORSFILE.rrd:fan$i:AVERAGE' ";
147     + $FAN_GRAPH .= "'DEF:maxfan$i=$RRDDIR/$SENSORSFILE.rrd:fan$i:MAX' ";
148     + $FAN_GRAPH .= "'COMMENT:Current\\tMinimum\\tAverage\\tMaximum\\tAvg\\n' " if $i == 1;
149     + $FAN_GRAPH .= "'GPRINT:avgfan$i:LAST:%6.2lf\\g' ";
150     + $FAN_GRAPH .= "'GPRINT:minfan$i:MIN:\\t%6.2lf\\g' ";
151     + $FAN_GRAPH .= "'GPRINT:avgfan$i:AVERAGE:\\t%6.2lf\\g' ";
152     + $FAN_GRAPH .= "'GPRINT:maxfan$i:MAX:\\t%6.2lf\\g' ";
153     + $FAN_GRAPH .= "'COMMENT:\\t\\g' ";
154     + $FAN_GRAPH .= "'LINE2:avgfan$i#".$color[$i].":\\tFan $i (rpm)\\n' ";
155     + $isfan=1;
156     + }
157     +}
158     +
159    
160     $TEMP_GRAPH = "-b '1000' ";
161     $TEMP_GRAPH .= "-t 'System Sensors (Temperature)' ";
162     $TEMP_GRAPH .= "-v '°C' ";
163     -$TEMP_GRAPH .= "'DEF:mintemp1=$RRDDIR/$SENSORSFILE.rrd:temp1:MIN' ";
164     -$TEMP_GRAPH .= "'DEF:avgtemp1=$RRDDIR/$SENSORSFILE.rrd:temp1:AVERAGE' ";
165     -$TEMP_GRAPH .= "'DEF:maxtemp1=$RRDDIR/$SENSORSFILE.rrd:temp1:MAX' ";
166     -$TEMP_GRAPH .= "'DEF:mintemp2=$RRDDIR/$SENSORSFILE.rrd:temp2:MIN' ";
167     -$TEMP_GRAPH .= "'DEF:avgtemp2=$RRDDIR/$SENSORSFILE.rrd:temp2:AVERAGE' ";
168     -$TEMP_GRAPH .= "'DEF:maxtemp2=$RRDDIR/$SENSORSFILE.rrd:temp2:MAX' ";
169     -$TEMP_GRAPH .= "'DEF:mintemp3=$RRDDIR/$SENSORSFILE.rrd:temp3:MIN' ";
170     -$TEMP_GRAPH .= "'DEF:avgtemp3=$RRDDIR/$SENSORSFILE.rrd:temp3:AVERAGE' ";
171     -$TEMP_GRAPH .= "'DEF:maxtemp3=$RRDDIR/$SENSORSFILE.rrd:temp3:MAX' ";
172     +my $istemp = "";
173     +for (my $i=0; $i <= 8; $i++) {
174     +if(exists($params{"temp$i"})) {
175     + $TEMP_GRAPH .= "'DEF:mintemp$i=$RRDDIR/$SENSORSFILE.rrd:temp$i:MIN' ";
176     + $TEMP_GRAPH .= "'DEF:avgtemp$i=$RRDDIR/$SENSORSFILE.rrd:temp$i:AVERAGE' ";
177     + $TEMP_GRAPH .= "'DEF:maxtemp$i=$RRDDIR/$SENSORSFILE.rrd:temp$i:MAX' ";
178     + $TEMP_GRAPH .= "'COMMENT:Current\\tMinimum\\tAverage\\tMaximum\\tAvg\\n' " if $i == 0;
179     + $TEMP_GRAPH .= "'GPRINT:avgtemp$i:LAST:%6.2lf\\g' ";
180     + $TEMP_GRAPH .= "'GPRINT:mintemp$i:MIN:\\t%6.2lf\\g' ";
181     + $TEMP_GRAPH .= "'GPRINT:avgtemp$i:AVERAGE:\\t%6.2lf\\g' ";
182     + $TEMP_GRAPH .= "'GPRINT:maxtemp$i:MAX:\\t%6.2lf\\g' ";
183     + $TEMP_GRAPH .= "'COMMENT:\\t\\g' ";
184     + $TEMP_GRAPH .= "'LINE2:avgtemp$i#".$color[$i].":\\tTemp $i (°C)\\n' ";
185     + $istemp=1;
186     + }
187     +}
188     +
189     if ( -e "$RRDDIR/${UPSFILE}1.rrd" )
190     {
191     $TEMP_GRAPH .= "'DEF:minups1temp=$RRDDIR/${UPSFILE}1.rrd:u_temperature:MIN' ";
192     @@ -475,25 +410,7 @@
193     $TEMP_GRAPH .= "'DEF:avgups2temp=$RRDDIR/${UPSFILE}2.rrd:u_temperature:AVERAGE' ";
194     $TEMP_GRAPH .= "'DEF:maxups2temp=$RRDDIR/${UPSFILE}2.rrd:u_temperature:MAX' ";
195     }
196     -$TEMP_GRAPH .= "'COMMENT:Current\\tMinimum\\tAverage\\tMaximum\\tAvg\\n' ";
197     -$TEMP_GRAPH .= "'GPRINT:avgtemp1:LAST:%6.2lf\\g' ";
198     -$TEMP_GRAPH .= "'GPRINT:mintemp1:MIN:\\t%6.2lf\\g' ";
199     -$TEMP_GRAPH .= "'GPRINT:avgtemp1:AVERAGE:\\t%6.2lf\\g' ";
200     -$TEMP_GRAPH .= "'GPRINT:maxtemp1:MAX:\\t%6.2lf\\g' ";
201     -$TEMP_GRAPH .= "'COMMENT:\\t\\g' ";
202     -$TEMP_GRAPH .= "'LINE2:avgtemp1#0000FF:\\tTemp 1 (°C)\\n' ";
203     -$TEMP_GRAPH .= "'GPRINT:avgtemp2:LAST:%6.2lf\\g' ";
204     -$TEMP_GRAPH .= "'GPRINT:mintemp2:MIN:\\t%6.2lf\\g' ";
205     -$TEMP_GRAPH .= "'GPRINT:avgtemp2:AVERAGE:\\t%6.2lf\\g' ";
206     -$TEMP_GRAPH .= "'GPRINT:maxtemp2:MAX:\\t%6.2lf\\g' ";
207     -$TEMP_GRAPH .= "'COMMENT:\\t\\g' ";
208     -$TEMP_GRAPH .= "'LINE2:avgtemp2#8B4513:\\tTemp 2 (°C)\\n' ";
209     -$TEMP_GRAPH .= "'GPRINT:avgtemp3:LAST:%6.2lf\\g' ";
210     -$TEMP_GRAPH .= "'GPRINT:mintemp3:MIN:\\t%6.2lf\\g' ";
211     -$TEMP_GRAPH .= "'GPRINT:avgtemp3:AVERAGE:\\t%6.2lf\\g' ";
212     -$TEMP_GRAPH .= "'GPRINT:maxtemp3:MAX:\\t%6.2lf\\g' ";
213     -$TEMP_GRAPH .= "'COMMENT:\\t\\g' ";
214     -$TEMP_GRAPH .= "'LINE2:avgtemp3#FFFF00:\\tTemp 3 (°C)\\n' ";
215     +
216     if ( -e "$RRDDIR/${UPSFILE}1.rrd" ) {
217     $TEMP_GRAPH .= "'GPRINT:avgups1temp:LAST:%6.2lf\\g' ";
218     $TEMP_GRAPH .= "'GPRINT:minups1temp:MIN:\\t%6.2lf\\g' ";
219     @@ -652,7 +569,7 @@
220     print $q->p($q->a ({href => "${scriptname}?state=detailed&typegraph=MEM"},"$header<IMG BORDER=0 SRC=\"${scriptname}?state=gif&typegraph=MEM&time=$time\">"));
221     if ( -e "$RRDDIR/$SENSORSFILE.rrd")
222     {
223     - print $q->p($q->a ({href => "${scriptname}?state=detailed&typegraph=TEMP"},"$header<IMG BORDER=0 SRC=\"${scriptname}?state=gif&typegraph=TEMP&time=$time\">"));
224     + print $q->p($q->a ({href => "${scriptname}?state=detailed&typegraph=TEMP"},"$header<IMG BORDER=0 SRC=\"${scriptname}?state=gif&typegraph=TEMP&time=$time\">")) if $istemp;
225     }
226     if ( -e "$RRDDIR/${UPSFILE}1.rrd")
227     {
228     @@ -666,8 +583,8 @@
229     print $q->p($q->a ({href => "${scriptname}?state=detailed&typegraph=HD"},"$header<IMG BORDER=0 SRC=\"${scriptname}?state=gif&typegraph=HD&time=$time\">"));
230     if ( -e "$RRDDIR/$SENSORSFILE.rrd")
231     {
232     - print $q->p($q->a ({href => "${scriptname}?state=detailed&typegraph=VOLTAGE"},"$header<IMG BORDER=0 SRC=\"${scriptname}?state=gif&typegraph=VOLTAGE&time=$time\">"));
233     - print $q->p($q->a ({href => "${scriptname}?state=detailed&typegraph=FAN"},"$header<IMG BORDER=0 SRC=\"${scriptname}?state=gif&typegraph=FAN&time=$time\">"));
234     + print $q->p($q->a ({href => "${scriptname}?state=detailed&typegraph=VOLTAGE"},"$header<IMG BORDER=0 SRC=\"${scriptname}?state=gif&typegraph=VOLTAGE&time=$time\">")) if $isvolt;
235     + print $q->p($q->a ({href => "${scriptname}?state=detailed&typegraph=FAN"},"$header<IMG BORDER=0 SRC=\"${scriptname}?state=gif&typegraph=FAN&time=$time\">")) if $isfan;
236     }
237     print $q->p($q->a ({href => "${scriptname}?state=detailed&typegraph=UPTIME"},"$header<IMG BORDER=0 SRC=\"${scriptname}?state=gif&typegraph=UPTIME&time=$time\">"));
238     if ($hosts ne "none")
239     diff -Nur smeserver-sysmon-6.5.old/root/usr/sbin/sysmon smeserver-sysmon-6.5/root/usr/sbin/sysmon
240     --- smeserver-sysmon-6.5.old/root/usr/sbin/sysmon 2019-12-26 22:47:05.000000000 -0500
241     +++ smeserver-sysmon-6.5/root/usr/sbin/sysmon 2019-12-26 22:53:22.233000000 -0500
242     @@ -10,6 +10,8 @@
243     use esmith::config;
244     use esmith::db;
245     use sigtrap;
246     +use File::Slurp qw/ read_file /;
247     +use File::Find::Rule;
248    
249     $ENV {'PATH'} = '/bin:/sbin:/usr/bin:/usr/sbin:/usr/lib/sa';
250     $ENV {'LANG'} = 'C';
251     @@ -31,6 +33,7 @@
252     croak "ERROR: sysmon is not enabled" if $status ne 'enabled';
253    
254     my $upsstatus = db_get_prop(\%conf, 'nut', 'status') || "disabled";
255     +my $rrddir = '/var/lib/rrd';
256    
257     unless (fork) {
258     open (FILELOCK,">/var/lock/sysmon");
259     @@ -48,8 +51,17 @@
260     $SIG{TERM} = sub { unlink("/var/lock/sysmon"); exit 0; };
261    
262     while(1) {
263     - mkdir('/var/lib/rrd') unless (-e '/var/lib/rrd');
264     -
265     + mkdir($rrddir) unless (-e $rrddir);
266     + my $days = 365;
267     + my @files = File::Find::Rule->file("*.rrd")
268     + ->maxdepth(1)
269     + ->in($rrddir);
270     + for my $file (@files){
271     + if (-M $file > $days){
272     + print "deleting $file\n";
273     + unlink $file or warn $!;
274     + }
275     + }
276     my $lastupdate = RRDs::last("/var/lib/rrd/sysmon.rrd") || 0;
277     my $datahash = ();
278     my $badifaces = `/sbin/ifconfig -a | /bin/sed -ne '/^\\w\\+[0-9]/{;x;n;/inet addr/bd;x;s/^\\(\\w\\+[0-9]\\+\\).*/\\1/p;:d;}'` || 'none';
279     @@ -62,8 +74,8 @@
280     {
281     `/usr/lib64/sa/sadc 1 1 /var/lib/rrd/sysmon.process > /dev/null 2>&1; /usr/lib64/sa/sadc 1 1 /var/lib/rrd/sysmon.stats > /dev/null 2>&1`;}
282     my @sardata;
283     - if ( -x '/usr/bin/sadf' ) { @sardata=`/usr/bin/sadf -- -qrbuS -n DEV /var/lib/rrd/sysmon.process 2> /dev/null`;print "sadf used : \n";}
284     - else { @sardata = `/usr/bin/sar -hqruS -P ALL -n DEV -f /var/lib/rrd/sysmon.process 2> /dev/null`; print "old systat : \n";}
285     + if ( -x '/usr/bin/sadf' ) { @sardata=`/usr/bin/sadf -- -qrbuS -n DEV /var/lib/rrd/sysmon.process 2> /dev/null`; }# sadf
286     + else { @sardata = `/usr/bin/sar -hqruS -P ALL -n DEV -f /var/lib/rrd/sysmon.process 2> /dev/null`; }# old systat
287     unlink("/var/lib/rrd/sysmon.process");
288    
289     if($#sardata > 0 && $sardata[0] =~ /\s+(\d+)\s+(\d{10})/ && $1 >= 45 && $1 <= 135 && $2 > $lastupdate) {
290     @@ -237,19 +249,29 @@
291    
292     my $cnt=0;
293     if ( $upsstatus eq 'enabled') {
294     - my @upses = `cat /etc/ups/ups.conf | sed -ne 's/\\[\\(.*\\)\\]/\\1/p'`;
295     + my @upsentries = ('i_voltage', 'u_load', 'b_charge', 'b_runtime', 'b_voltage', 'u_temperature') ;
296     + #use File::Slurp qw/ read_file /;
297     + my $upslines = read_file('/etc/ups/ups.conf');
298     + my @upses = $upslines =~ m/\[(.*)\]\n/;
299     foreach(@upses) {
300     chomp;
301     my $upsname="$_\@localhost";
302     $cnt++;
303     my @upsdata = `/usr/bin/upsc $upsname 2> /dev/null`;
304     + $upslines="ups $upsname: ";
305     foreach(@upsdata) {
306     if(/^([a-z])[^.]+\.(voltage|load|charge|runtime|temperature|humidity)\s*:\s*([0-9,.]+)/) {
307     my $element = "$1_$2";
308     + $upslines .= "$element=$3, ";
309     $datahash->{ups}->{$cnt}->{$element}=$3;
310     if($element=~/time/i) { $datahash->{ups}->{$cnt}->{$element} /= 60; }
311     }
312     }
313     + foreach my $element (@upsentries){
314     + next if exists($datahash->{ups}->{$cnt}->{$element});
315     + $datahash->{ups}->{$cnt}->{$element}='';
316     + $upslines .= "$element=, ";
317     + }
318     }
319     }
320    
321     @@ -281,8 +303,9 @@
322     my $check = `/sbin/lsmod 2> /dev/null`;
323     if( $check =~ /i2c_/ ) {
324     my @sensordata = `/usr/bin/sensors -u 2> /dev/null`;
325     - foreach(@sensordata) {
326     - if(/(-?[0-9,.]+) \(((?:in|fan|temp|vid|vrm)[0-9]*)\)/) { $datahash->{sensors}->{$2} = $1; }
327     + foreach(@sensordata) {
328     +#pre SME9 if(/(-?[0-9,.]+) \(((?:in|fan|temp|vid|vrm)[0-9]*)\)/) { $datahash->{sensors}->{$2} = $1; print "$2=$1, "}
329     + if(/(in|fan|temp|vid|vrm)([0-9])_input: ?(-?[0-9,.]+)/) { $datahash->{sensors}->{"$1$2"} = $3;} #print "sensors:$1$2=$3\n"}
330     }
331     if(defined($datahash->{sensors})) {
332     RRDs::create("/var/lib/rrd/sensors.rrd","-s","60",

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed