]>
Commit | Line | Data |
---|---|---|
cd1a2927 MT |
1 | #!/usr/bin/perl |
2 | ||
3 | ############################################################################ | |
4 | # # | |
5 | # This file is part of the IPCop Firewall. # | |
6 | # # | |
7 | # IPCop is free software; you can redistribute it and/or modify # | |
8 | # it under the terms of the GNU General Public License as published by # | |
9 | # the Free Software Foundation; either version 2 of the License, or # | |
10 | # (at your option) any later version. # | |
11 | # # | |
12 | # IPCop is distributed in the hope that it will be useful, # | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | |
15 | # GNU General Public License for more details. # | |
16 | # # | |
17 | # You should have received a copy of the GNU General Public License # | |
18 | # along with IPCop; if not, write to the Free Software # | |
19 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # | |
20 | # # | |
21 | # Copyright (C) 2004-01-19 Mark Wormgoor <mark@wormgoor.com>. # | |
22 | # # | |
23 | ############################################################################ | |
24 | # | |
25 | # $Id: makegraphs,v 1.19.2.18 2006/01/08 13:41:04 eoberlander Exp $ | |
26 | # | |
27 | use strict; | |
28 | #use warnings; | |
29 | ||
30 | use RRDs; | |
986e08d9 | 31 | require "/var/ipfire/general-functions.pl"; |
cd1a2927 MT |
32 | require "${General::swroot}/lang.pl"; |
33 | ||
34 | my (%settings, @ipacsum, $iface, $ERROR); | |
35 | &General::readhash("${General::swroot}/ethernet/settings", \%settings); | |
36 | ||
37 | # Added for conversion of utf-8 characters | |
38 | use Encode 'from_to'; | |
39 | my %tr=(); | |
40 | ||
41 | # Force language back to English (ugly hack!) | |
42 | # Modified to only force if we are unable to convert charset | |
43 | # from utf-8 | |
44 | if ((${Lang::language} eq 'el') || | |
45 | (${Lang::language} eq 'fa') || | |
46 | (${Lang::language} eq 'ru') || | |
47 | (${Lang::language} eq 'th') || | |
48 | (${Lang::language} eq 'vi') || | |
49 | (${Lang::language} eq 'zh') || | |
50 | (${Lang::language} eq 'zt')) { | |
51 | eval `/bin/cat "${General::swroot}/langs/en.pl"`; | |
52 | } else { | |
53 | %tr=%Lang::tr; # use translated version for other languages | |
54 | } | |
55 | ||
56 | # Settings | |
57 | my $rrdlog = "/var/log/rrd"; | |
58 | my $graphs = "/home/httpd/html/graphs"; | |
59 | $ENV{PATH}="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"; | |
60 | ||
61 | sub gettraffic { | |
62 | my $interface = $_[0]; | |
63 | ||
64 | my $bytesin=0; | |
65 | my $bytesout=0; | |
66 | ||
67 | foreach (@ipacsum) | |
68 | { | |
69 | # Incoming... | |
70 | $bytesin += $1 if (/^[\* ]\s+incoming\s+${interface}.+\:\s+(\d+)/); | |
71 | ||
72 | # Forwarded Incoming... | |
73 | $bytesin += $1 if (/^[\* ]\s+forwarded\s+incoming\s+${interface}.+\:\s+(\d+)/); | |
74 | ||
75 | # Outgoing... | |
76 | $bytesout += $1 if (/^[* ]\s+outgoing\s+${interface}.+\:\s+(\d+)/); | |
77 | ||
78 | # Forwarded Outgoing... | |
79 | $bytesout += $1 if (/^[* ]\s+forwarded\s+outgoing\s+${interface}.+\:\s+(\d+)/); | |
80 | } | |
81 | return "$bytesin:$bytesout"; | |
82 | } | |
83 | ||
84 | sub updatecpugraph { | |
85 | my $period = $_[0]; | |
86 | ||
87 | RRDs::graph ("$graphs/cpu-$period.png", | |
88 | "--start", "-1$period", "-aPNG", "-i", "-z", | |
89 | "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-u 100", "-r", | |
90 | "--color", "SHADEA#EAE9EE", | |
91 | "--color", "SHADEB#EAE9EE", | |
39a7cc11 | 92 | "--color", "BACK#FFFFFF", |
cd1a2927 MT |
93 | "-t $tr{'cpu usage per'} $tr{$period}", |
94 | "DEF:user=$rrdlog/cpu.rrd:user:AVERAGE", | |
95 | "DEF:system=$rrdlog/cpu.rrd:system:AVERAGE", | |
96 | "DEF:idle=$rrdlog/cpu.rrd:idle:AVERAGE", | |
97 | "CDEF:total=user,system,idle,+,+", | |
98 | "CDEF:userpct=100,user,total,/,*", | |
99 | "CDEF:systempct=100,system,total,/,*", | |
100 | "CDEF:idlepct=100,idle,total,/,*", | |
101 | "AREA:userpct#0000FF:$tr{'user cpu usage'}\\j", | |
102 | "STACK:systempct#FF0000:$tr{'system cpu usage'}\\j", | |
103 | "STACK:idlepct#00FF00:$tr{'idle cpu usage'}\\j", | |
104 | "GPRINT:userpct:MAX:$tr{'maximal'} $tr{'user cpu'}\\:%3.2lf%%", | |
105 | "GPRINT:userpct:AVERAGE:$tr{'average'} $tr{'user cpu'}\\:%3.2lf%%", | |
106 | "GPRINT:userpct:LAST:$tr{'current'} $tr{'user cpu'}\\:%3.2lf%%\\j", | |
107 | "GPRINT:systempct:MAX:$tr{'maximal'} $tr{'system cpu'}\\:%3.2lf%%", | |
108 | "GPRINT:systempct:AVERAGE:$tr{'average'} $tr{'system cpu'}\\:%3.2lf%%", | |
109 | "GPRINT:systempct:LAST:$tr{'current'} $tr{'system cpu'}\\:%3.2lf%%\\j", | |
110 | "GPRINT:idlepct:MAX:$tr{'maximal'} $tr{'idle cpu'}\\:%3.2lf%%", | |
111 | "GPRINT:idlepct:AVERAGE:$tr{'average'} $tr{'idle cpu'}\\:%3.2lf%%", | |
112 | "GPRINT:idlepct:LAST:$tr{'current'} $tr{'idle cpu'}\\:%3.2lf%%\\j"); | |
113 | $ERROR = RRDs::error; | |
114 | print "Error in RRD::graph for cpu: $ERROR\n" if $ERROR; | |
115 | } | |
116 | ||
117 | sub updatecpudata { | |
118 | if ( ! -e "$rrdlog/cpu.rrd") { | |
119 | RRDs::create ("$rrdlog/cpu.rrd", "--step=300", | |
120 | "DS:user:COUNTER:600:0:500000000", | |
121 | "DS:system:COUNTER:600:0:500000000", | |
122 | "DS:idle:COUNTER:600:0:500000000", | |
123 | "RRA:AVERAGE:0.5:1:576", | |
124 | "RRA:AVERAGE:0.5:6:672", | |
125 | "RRA:AVERAGE:0.5:24:732", | |
126 | "RRA:AVERAGE:0.5:144:1460"); | |
127 | $ERROR = RRDs::error; | |
128 | print "Error in RRD::create for cpu: $ERROR\n" if $ERROR; | |
129 | } | |
130 | ||
131 | my ($cpu, $user, $nice, $system, $idle); | |
132 | ||
133 | open STAT, "/proc/stat"; | |
134 | while(<STAT>) { | |
135 | chomp; | |
136 | /^cpu\s/ or next; | |
137 | ($cpu, $user, $nice, $system, $idle) = split /\s+/; | |
138 | last; | |
139 | } | |
140 | close STAT; | |
141 | $user += $nice; | |
142 | ||
143 | RRDs::update ("$rrdlog/cpu.rrd", | |
144 | "-t", "user:system:idle", | |
145 | "N:$user:$system:$idle"); | |
146 | $ERROR = RRDs::error; | |
147 | print "Error in RRD::update for cpu: $ERROR\n" if $ERROR; | |
148 | ||
149 | } | |
150 | ||
151 | sub updatememgraph { | |
152 | my $period = $_[0]; | |
153 | ||
154 | RRDs::graph ("$graphs/memory-$period.png", | |
155 | "--start", "-1$period", "-aPNG", "-i", "-z", | |
156 | "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-u 100", "-r", | |
157 | "--color", "SHADEA#EAE9EE", | |
158 | "--color", "SHADEB#EAE9EE", | |
39a7cc11 | 159 | "--color", "BACK#FFFFFF", |
cd1a2927 MT |
160 | "-t $tr{'memory usage per'} $tr{$period}", |
161 | "DEF:used=$rrdlog/mem.rrd:memused:AVERAGE", | |
162 | "DEF:free=$rrdlog/mem.rrd:memfree:AVERAGE", | |
163 | "DEF:shared=$rrdlog/mem.rrd:memshared:AVERAGE", | |
164 | "DEF:buffer=$rrdlog/mem.rrd:membuffers:AVERAGE", | |
165 | "DEF:cache=$rrdlog/mem.rrd:memcache:AVERAGE", | |
166 | "CDEF:total=used,free,+", | |
167 | "CDEF:used2=used,buffer,cache,shared,+,+,-", | |
168 | "CDEF:usedpct=100,used2,total,/,*", | |
169 | "CDEF:sharedpct=100,shared,total,/,*", | |
170 | "CDEF:bufferpct=100,buffer,total,/,*", | |
171 | "CDEF:cachepct=100,cache,total,/,*", | |
172 | "CDEF:freepct=100,free,total,/,*", | |
173 | "AREA:usedpct#0000FF:$tr{'used memory'}\\j", | |
174 | "STACK:sharedpct#FF0000:$tr{'shared memory'}\\j", | |
175 | "STACK:bufferpct#FF00FF:$tr{'buffered memory'}\\j", | |
176 | "STACK:cachepct#FFFF00:$tr{'cached memory'}\\j", | |
177 | "STACK:freepct#00FF00:$tr{'free memory'}\\j", | |
178 | "GPRINT:usedpct:MAX:$tr{'maximal'} $tr{'used memory'}\\:%3.2lf%%", | |
179 | "GPRINT:usedpct:AVERAGE:$tr{'average'} $tr{'used memory'}\\:%3.2lf%%", | |
180 | "GPRINT:usedpct:LAST:$tr{'current'} $tr{'used memory'}\\:%3.2lf%%\\j", | |
181 | "GPRINT:sharedpct:MAX:$tr{'maximal'} $tr{'shared memory'}\\:%3.2lf%%", | |
182 | "GPRINT:sharedpct:AVERAGE:$tr{'average'} $tr{'shared memory'}\\:%3.2lf%%", | |
183 | "GPRINT:sharedpct:LAST:$tr{'current'} $tr{'shared memory'}\\:%3.2lf%%\\j", | |
184 | "GPRINT:bufferpct:MAX:$tr{'maximal'} $tr{'buffered memory'}\\:%3.2lf%%", | |
185 | "GPRINT:bufferpct:AVERAGE:$tr{'average'} $tr{'buffered memory'}\\:%3.2lf%%", | |
186 | "GPRINT:bufferpct:LAST:$tr{'current'} $tr{'buffered memory'}\\:%3.2lf%%\\j", | |
187 | "GPRINT:cachepct:MAX:$tr{'maximal'} $tr{'cached memory'}\\:%3.2lf%%", | |
188 | "GPRINT:cachepct:AVERAGE:$tr{'average'} $tr{'cached memory'}\\:%3.2lf%%", | |
189 | "GPRINT:cachepct:LAST:$tr{'current'} $tr{'cached memory'}\\:%3.2lf%%\\j", | |
190 | "GPRINT:freepct:MAX:$tr{'maximal'} $tr{'free memory'}\\:%3.2lf%%", | |
191 | "GPRINT:freepct:AVERAGE:$tr{'average'} $tr{'free memory'}\\:%3.2lf%%", | |
192 | "GPRINT:freepct:LAST:$tr{'current'} $tr{'free memory'}\\:%3.2lf%%\\j"); | |
193 | $ERROR = RRDs::error; | |
194 | print "Error in RRD::graph for mem: $ERROR\n" if $ERROR; | |
195 | ||
196 | RRDs::graph ("$graphs/swap-$period.png", | |
197 | "--start", "-1$period", "-aPNG", "-i", "-z", | |
198 | "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-u 100", "-r", | |
199 | "--color", "SHADEA#EAE9EE", | |
200 | "--color", "SHADEB#EAE9EE", | |
39a7cc11 | 201 | "--color", "BACK#FFFFFF", |
cd1a2927 MT |
202 | "-t $tr{'swap usage per'} $tr{$period}", |
203 | "DEF:used=$rrdlog/mem.rrd:swapused:AVERAGE", | |
204 | "DEF:free=$rrdlog/mem.rrd:swapfree:AVERAGE", | |
205 | "CDEF:total=used,free,+", | |
206 | "CDEF:usedpct=100,used,total,/,*", | |
207 | "CDEF:freepct=100,free,total,/,*", | |
208 | "AREA:usedpct#0000FF:$tr{'used swap'}\\j", | |
209 | "STACK:freepct#00FF00:$tr{'free swap'}\\j", | |
210 | "GPRINT:usedpct:MAX:$tr{'maximal'} $tr{'used swap'}\\:%3.2lf%%", | |
211 | "GPRINT:usedpct:AVERAGE:$tr{'average'} $tr{'used swap'}\\:%3.2lf%%", | |
212 | "GPRINT:usedpct:LAST:$tr{'current'} $tr{'used swap'}\\:%3.2lf%%\\j", | |
213 | "GPRINT:freepct:MAX:$tr{'maximal'} $tr{'free swap'}\\:%3.2lf%%", | |
214 | "GPRINT:freepct:AVERAGE:$tr{'average'} $tr{'free swap'}\\:%3.2lf%%", | |
215 | "GPRINT:freepct:LAST:$tr{'current'} $tr{'free swap'}\\:%3.2lf%%\\j"); | |
216 | $ERROR = RRDs::error; | |
217 | print "Error in RRD::graph for swap: $ERROR\n" if $ERROR; | |
218 | } | |
219 | ||
220 | sub updatememdata { | |
221 | my ($memused, $memfree, $memshared, $membuffers, $memcache, $swapused, $swapfree); | |
222 | if ( ! -e "$rrdlog/mem.rrd") { | |
223 | RRDs::create ("$rrdlog/mem.rrd", "--step=300", | |
224 | "DS:memused:ABSOLUTE:600:0:5000000000", | |
225 | "DS:memfree:ABSOLUTE:600:0:5000000000", | |
226 | "DS:memshared:ABSOLUTE:600:0:5000000000", | |
227 | "DS:membuffers:ABSOLUTE:600:0:5000000000", | |
228 | "DS:memcache:ABSOLUTE:600:0:5000000000", | |
229 | "DS:swapused:ABSOLUTE:600:0:5000000000", | |
230 | "DS:swapfree:ABSOLUTE:600:0:5000000000", | |
231 | "RRA:AVERAGE:0.5:1:576", | |
232 | "RRA:AVERAGE:0.5:6:672", | |
233 | "RRA:AVERAGE:0.5:24:732", | |
234 | "RRA:AVERAGE:0.5:144:1460"); | |
235 | $ERROR = RRDs::error; | |
236 | print "Error in RRD::create for mem: $ERROR\n" if $ERROR; | |
237 | } | |
238 | ||
239 | open MEM, "/proc/meminfo"; | |
240 | while(<MEM>) { | |
241 | chomp; | |
242 | if ($_ =~ /^Mem:/) { | |
243 | my @temp = split (/\s+/, $_); | |
244 | $memused = $temp[2]; | |
245 | $memfree = $temp[3]; | |
246 | $memshared = $temp[4]; | |
247 | $membuffers = $temp[5]; | |
248 | $memcache = $temp[6]; | |
249 | } elsif ($_ =~ /^Swap:/) { | |
250 | my @temp = split (/\s+/, $_); | |
251 | $swapused = $temp[2]; | |
252 | $swapfree = $temp[3]; | |
253 | } | |
254 | } | |
255 | close MEM; | |
256 | ||
257 | RRDs::update ("$rrdlog/mem.rrd", | |
258 | "-t", "memused:memfree:memshared:membuffers:memcache:swapused:swapfree", | |
259 | "N:$memused:$memfree:$memshared:$membuffers:$memcache:$swapused:$swapfree"); | |
260 | $ERROR = RRDs::error; | |
261 | print "Error in RRD::update for mem: $ERROR\n" if $ERROR; | |
262 | } | |
263 | ||
264 | sub updatediskgraph { | |
265 | my $period = $_[0]; | |
266 | ||
267 | RRDs::graph ("$graphs/disk-$period.png", | |
268 | "--start", "-1$period", "-aPNG", "-i", "-z", | |
269 | "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-r", | |
270 | "--color", "SHADEA#EAE9EE", | |
271 | "--color", "SHADEB#EAE9EE", | |
39a7cc11 | 272 | "--color", "BACK#FFFFFF", |
cd1a2927 MT |
273 | "-t $tr{'disk access per'} $tr{$period}", |
274 | "DEF:read=$rrdlog/disk.rrd:readsect:AVERAGE", | |
275 | "DEF:write=$rrdlog/disk.rrd:writesect:AVERAGE", | |
276 | "AREA:read#0000FF:$tr{'sectors read from disk per second'}\\j", | |
277 | "STACK:write#00FF00:$tr{'sectors written to disk per second'}\\j", | |
278 | "GPRINT:read:MAX:$tr{'maximal'} $tr{'read sectors'}\\:%8.0lf", | |
279 | "GPRINT:read:AVERAGE:$tr{'average'} $tr{'read sectors'}\\:%8.0lf", | |
280 | "GPRINT:read:LAST:$tr{'current'} $tr{'read sectors'}\\:%8.0lf\\j", | |
281 | "GPRINT:write:MAX:$tr{'maximal'} $tr{'written sectors'}\\:%8.0lf", | |
282 | "GPRINT:write:AVERAGE:$tr{'average'} $tr{'written sectors'}\\:%8.0lf", | |
283 | "GPRINT:write:LAST:$tr{'current'} $tr{'written sectors'}\\:%8.0lf\\j"); | |
284 | $ERROR = RRDs::error; | |
285 | print "Error in RRD::graph for disk: $ERROR\n" if $ERROR; | |
286 | } | |
287 | ||
288 | sub updatediskdata { | |
289 | my ($readwritereq, $readreq, $readsect, $writereq, $writesect); | |
290 | if ( ! -e "$rrdlog/disk.rrd") { | |
291 | RRDs::create ("$rrdlog/disk.rrd", "--step=300", | |
292 | "DS:readsect:COUNTER:600:0:5000000000", | |
293 | "DS:writesect:COUNTER:600:0:5000000000", | |
294 | "RRA:AVERAGE:0.5:1:576", | |
295 | "RRA:AVERAGE:0.5:6:672", | |
296 | "RRA:AVERAGE:0.5:24:732", | |
297 | "RRA:AVERAGE:0.5:144:1460"); | |
298 | $ERROR = RRDs::error; | |
299 | print "Error in RRD::create for disk: $ERROR\n" if $ERROR; | |
300 | } | |
301 | ||
302 | my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, | |
303 | $atime, $mtime, $ctime, $blksize, $blocks) = stat("/dev/harddisk"); | |
304 | ||
305 | my $major = $rdev >> 8; | |
306 | my $minor = $rdev & 0xFF; | |
307 | ||
308 | open STAT, "/proc/stat"; | |
309 | my @diskstat = <STAT>; | |
310 | close (STAT); | |
311 | foreach my $line (@diskstat) | |
312 | { | |
313 | chomp ($line); | |
314 | my @temp = split(/\:\ /,$line); | |
315 | if ($temp[1]) { | |
316 | my @devicestat = split(/\ /,$temp[1]); | |
317 | foreach my $stats (@devicestat) | |
318 | { | |
319 | chomp ($stats); | |
320 | my @fields = split(/\((\d+),(\d+)\):\((\d+),(\d+),(\d+),(\d+),(\d+)/,$stats); | |
321 | if ($major eq $fields[1] and $minor eq $fields[2]) | |
322 | { | |
323 | $readwritereq = $fields[3]; | |
324 | $readreq = $fields[4]; | |
325 | $readsect = $fields[5]; | |
326 | $writereq = $fields[6]; | |
327 | $writesect = $fields[7]; | |
328 | } | |
329 | } | |
330 | } | |
331 | } | |
332 | ||
333 | if ($readsect && $writesect) { | |
334 | RRDs::update ("$rrdlog/disk.rrd", | |
335 | "-t", "readsect:writesect", | |
336 | "N:$readsect:$writesect"); | |
337 | $ERROR = RRDs::error; | |
338 | print "Error in RRD::update for disk: $ERROR\n" if $ERROR; | |
339 | } else { | |
340 | print "Error in RRD::update for disk: no data available\n"; | |
341 | } | |
342 | } | |
343 | ||
6c666a3b MT |
344 | sub updatediskgraphnew { |
345 | my $disk = $_[0]; | |
346 | my $period = $_[1]; | |
347 | ||
348 | RRDs::graph ("$graphs/disk-$disk-$period.png", | |
349 | "--start", "-1$period", "-aPNG", "-i", "-z", | |
350 | "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-r", | |
351 | "--color", "SHADEA#EAE9EE", | |
352 | "--color", "SHADEB#EAE9EE", | |
353 | "--color", "BACK#FFFFFF", | |
354 | "-t $tr{'disk access per'} $tr{$period}", | |
355 | "DEF:read=$rrdlog/disk-$disk.rrd:readsect:AVERAGE", | |
356 | "DEF:write=$rrdlog/disk-$disk.rrd:writesect:AVERAGE", | |
357 | "DEF:sleep=$rrdlog/disk-$disk.rrd:sleeping:AVERAGE", | |
358 | "CDEF:sl_state=sleep,INF,*", | |
359 | ||
360 | "AREA:sl_state#a0a0a0:disk standby\\j", | |
361 | "AREA:read#0000FF:$tr{'sectors read from disk per second'}\\j", | |
362 | "STACK:write#00FF00:$tr{'sectors written to disk per second'}\\j", | |
363 | ||
364 | "GPRINT:read:MAX:$tr{'maximal'} $tr{'read sectors'}\\:%8.0lf", | |
365 | "GPRINT:read:AVERAGE:$tr{'average'} $tr{'read sectors'}\\:%8.0lf", | |
366 | "GPRINT:read:LAST:$tr{'current'} $tr{'read sectors'}\\:%8.0lf\\j", | |
367 | "GPRINT:write:MAX:$tr{'maximal'} $tr{'written sectors'}\\:%8.0lf", | |
368 | "GPRINT:write:AVERAGE:$tr{'average'} $tr{'written sectors'}\\:%8.0lf", | |
369 | "GPRINT:write:LAST:$tr{'current'} $tr{'written sectors'}\\:%8.0lf\\j"); | |
370 | $ERROR = RRDs::error; | |
371 | print "Error in RRD::graph for disk-$disk: $ERROR\n" if $ERROR; | |
372 | } | |
373 | ||
374 | sub updatediskdatanew { | |
375 | my $disk = $_[0]; | |
376 | ||
377 | my ($readwritereq, $readreq, $readsect, $writereq, $writesect); | |
378 | if ( ! -e "$rrdlog/disk-$disk.rrd") { | |
379 | RRDs::create ("$rrdlog/disk-$disk.rrd", "--step=300", | |
380 | "DS:readsect:COUNTER:600:0:5000000000", | |
381 | "DS:writesect:COUNTER:600:0:5000000000", | |
382 | "DS:sleeping:GAUGE:600:0:1", | |
383 | "RRA:AVERAGE:0.5:1:576", | |
384 | "RRA:AVERAGE:0.5:6:672", | |
385 | "RRA:AVERAGE:0.5:24:732", | |
386 | "RRA:AVERAGE:0.5:144:1460"); | |
387 | $ERROR = RRDs::error; | |
388 | print "Error in RRD::create for disk-$disk: $ERROR\n" if $ERROR; | |
389 | } | |
390 | ||
391 | my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, | |
392 | $atime, $mtime, $ctime, $blksize, $blocks) = stat("/dev/$disk"); | |
393 | ||
394 | my $major = $rdev >> 8; | |
395 | my $minor = ($rdev & 0xFF) >>6; | |
396 | ||
397 | open STAT, "/proc/stat"; | |
398 | my @diskstat = <STAT>; | |
399 | close (STAT); | |
400 | foreach my $line (@diskstat) | |
401 | { | |
402 | chomp ($line); | |
403 | my @temp = split(/\:\ /,$line); | |
404 | if ($temp[1]) { | |
405 | my @devicestat = split(/\ /,$temp[1]); | |
406 | foreach my $stats (@devicestat) | |
407 | { | |
408 | chomp ($stats); | |
409 | my @fields = split(/\((\d+),(\d+)\):\((\d+),(\d+),(\d+),(\d+),(\d+)/,$stats); | |
410 | if ($major eq $fields[1] and $minor eq $fields[2]) | |
411 | { | |
412 | $readwritereq = $fields[3]; | |
413 | $readreq = $fields[4]; | |
414 | $readsect = $fields[5]; | |
415 | $writereq = $fields[6]; | |
416 | $writesect = $fields[7]; | |
417 | } | |
418 | } | |
419 | } | |
420 | } | |
421 | ||
422 | my $sleeping=0; | |
423 | my $lastsleepstate=0; | |
424 | ||
425 | if ( -e "/tmp/hddshutdown-$disk" ) { | |
426 | open STAT,"/tmp/hddshutdown-$disk"; | |
427 | $lastsleepstate = <STAT>; | |
428 | close (STAT); | |
429 | if ($lastsleepstate==$readwritereq) { | |
430 | $sleeping=1; | |
431 | } | |
432 | } | |
433 | ||
434 | if ($readsect && $writesect) { | |
435 | RRDs::update ("$rrdlog/disk-$disk.rrd", | |
436 | "-t", "readsect:writesect:sleeping", | |
437 | "N:$readsect:$writesect:$sleeping"); | |
438 | $ERROR = RRDs::error; | |
439 | print "Error in RRD::update for disk-$disk: $ERROR\n" if $ERROR; | |
440 | } else { | |
441 | print "Error in RRD::update for disk-$disk: no data available\n"; | |
442 | } | |
443 | } | |
444 | ||
cd1a2927 MT |
445 | sub updateifgraph { |
446 | my $interface = $_[0]; | |
447 | my $period = $_[1]; | |
448 | ||
449 | RRDs::graph ("$graphs/$interface-$period.png", | |
450 | "--start", "-1$period", "-aPNG", "-i", "-z", | |
451 | "--alt-y-grid", "-w 600", "-h 100", | |
452 | "--color", "SHADEA#EAE9EE", | |
453 | "--color", "SHADEB#EAE9EE", | |
39a7cc11 | 454 | "--color", "BACK#FFFFFF", |
cd1a2927 MT |
455 | "-t $tr{'traffic on'} $interface ($tr{'graph per'} $tr{$period})", |
456 | "-v$tr{'bytes per second'}", | |
457 | "DEF:incoming=$rrdlog/$interface.rrd:incoming:AVERAGE", | |
458 | "DEF:outgoing=$rrdlog/$interface.rrd:outgoing:AVERAGE", | |
459 | "AREA:incoming#00FF00:$tr{'incoming traffic in bytes per second'}\\j", | |
460 | "LINE1:outgoing#0000FF:$tr{'outgoing traffic in bytes per second'}\\j", | |
461 | "GPRINT:incoming:MAX:$tr{'maximal'} $tr{'in'}\\:%8.3lf %sBps", | |
462 | "GPRINT:incoming:AVERAGE:$tr{'average'} $tr{'in'}\\:%8.3lf %sBps", | |
463 | "GPRINT:incoming:LAST:$tr{'current'} $tr{'in'}\\:%8.3lf %sBps\\j", | |
464 | "GPRINT:outgoing:MAX:$tr{'maximal'} $tr{'out'}\\:%8.3lf %sBps", | |
465 | "GPRINT:outgoing:AVERAGE:$tr{'average'} $tr{'out'}\\:%8.3lf %sBps", | |
466 | "GPRINT:outgoing:LAST:$tr{'current'} $tr{'out'}\\:%8.3lf %sBps\\j"); | |
467 | $ERROR = RRDs::error; | |
468 | print "Error in RRD::graph for $interface: $ERROR\n" if $ERROR; | |
469 | } | |
470 | ||
471 | sub updateifdata { | |
472 | my $interface = $_[0]; | |
473 | ||
474 | if ( ! -e "$rrdlog/$interface.rrd") { | |
475 | RRDs::create ("$rrdlog/$interface.rrd", "--step=300", | |
476 | "DS:incoming:ABSOLUTE:600:0:12500000", | |
477 | "DS:outgoing:ABSOLUTE:600:0:12500000", | |
478 | "RRA:AVERAGE:0.5:1:576", | |
479 | "RRA:AVERAGE:0.5:6:672", | |
480 | "RRA:AVERAGE:0.5:24:732", | |
481 | "RRA:AVERAGE:0.5:144:1460"); | |
482 | $ERROR = RRDs::error; | |
483 | print "Error in RRD::create for $interface: $ERROR\n" if $ERROR; | |
484 | } | |
485 | ||
486 | my $traffic = gettraffic ($interface); | |
487 | RRDs::update ("$rrdlog/$interface.rrd", | |
488 | "-t", "incoming:outgoing", | |
489 | "N:$traffic"); | |
490 | $ERROR = RRDs::error; | |
491 | print "Error in RRD::update for $interface: $ERROR\n" if $ERROR; | |
492 | } | |
493 | ||
df8c7810 MT |
494 | sub updatefwhitsgraph { |
495 | my $interval = $_[0]; | |
496 | ||
497 | RRDs::graph ("$graphs/firewallhits-$interval-area.png", | |
498 | "--start", "-1$interval", "-aPNG", "-i", "-z", | |
072cd997 | 499 | "--alt-y-grid", "-w 600", "-h 200", |
df8c7810 MT |
500 | "--color", "SHADEA#EAE9EE", |
501 | "--color", "SHADEB#EAE9EE", | |
39a7cc11 | 502 | "--color", "BACK#FFFFFF", |
df8c7810 MT |
503 | "-t firewall hits over the last $interval", |
504 | "DEF:amount=$rrdlog/firewallhits.rrd:amount:AVERAGE", | |
505 | "AREA:amount#6464FF:firewallhits", | |
506 | "GPRINT:amount:MAX: Max\\: %2.2lf %S", | |
507 | "GPRINT:amount:AVERAGE: Avg\\: %2.2lf %S", | |
508 | "GPRINT:amount:LAST: Current\\: %2.2lf %Shits/5 min\\n", | |
509 | "DEF:portamount=$rrdlog/firewallhits.rrd:portamount:AVERAGE", | |
510 | "AREA:portamount#FF6464:portscans", | |
511 | "GPRINT:portamount:MAX: Max\\: %2.2lf %S", | |
512 | "GPRINT:portamount:AVERAGE: Avg\\: %2.2lf %S", | |
513 | "GPRINT:portamount:LAST: Current\\: %2.2lf %Shits/5 min"); | |
514 | $ERROR = RRDs::error; | |
515 | print "Error in RRD::graph for Firewallhits: $ERROR\n" if $ERROR; | |
516 | ||
517 | RRDs::graph ("$graphs/firewallhits-$interval-line.png", | |
518 | "--start", "-1$interval", "-aPNG", "-i", "-z", | |
072cd997 | 519 | "--alt-y-grid", "-w 600", "-h 200", |
df8c7810 MT |
520 | "--color", "SHADEA#EAE9EE", |
521 | "--color", "SHADEB#EAE9EE", | |
39a7cc11 | 522 | "--color", "BACK#FFFFFF", |
df8c7810 MT |
523 | "-t firewall hits over the last $interval", |
524 | "DEF:amount=$rrdlog/firewallhits.rrd:amount:AVERAGE", | |
525 | "LINE2:amount#6464FF:firewallhits", | |
526 | "GPRINT:amount:MAX: Max\\: %2.2lf %S", | |
527 | "GPRINT:amount:AVERAGE: Avg\\: %2.2lf %S", | |
528 | "GPRINT:amount:LAST: Current\\: %2.2lf %Shits/5 min\\n", | |
529 | "DEF:portamount=$rrdlog/firewallhits.rrd:portamount:AVERAGE", | |
530 | "LINE2:portamount#FF6464:portscans", | |
531 | "GPRINT:portamount:MAX: Max\\: %2.2lf %S", | |
532 | "GPRINT:portamount:AVERAGE: Avg\\: %2.2lf %S", | |
533 | "GPRINT:portamount:LAST: Current\\: %2.2lf %Shits/5 min"); | |
534 | $ERROR = RRDs::error; | |
535 | print "Error in RRD::graph for Firewallhits: $ERROR\n" if $ERROR; | |
536 | } | |
537 | ||
538 | sub updatefwhitsdata { | |
539 | my $portamount=0; | |
540 | my $alertaktuell=0; | |
541 | my $aktuell=0; | |
542 | my $portaktuell=0; | |
543 | my $skip=0; | |
544 | ||
545 | if (! -e "$rrdlog/firewallhits.rrd") | |
546 | { | |
547 | RRDs::create ("$rrdlog/firewallhits.rrd", "--step=300", | |
548 | "DS:amount:GAUGE:600:0:U", | |
549 | "DS:portamount:GAUGE:600:0:U", | |
550 | "RRA:AVERAGE:0.5:1:576", | |
551 | "RRA:AVERAGE:0.5:6:672", | |
552 | "RRA:AVERAGE:0.5:24:732", | |
553 | "RRA:AVERAGE:0.5:144:1460"); | |
554 | $ERROR = RRDs::error; | |
555 | print "Error in RRD::create for cpu: $ERROR\n" if $ERROR; | |
556 | } | |
557 | ||
558 | system("logtailfwhits /var/log/messages /var/log/fwhits.messages.offset >/tmp/messages.fwhits"); | |
559 | if (!(open (FILE,'/tmp/messages.fwhits'))) { | |
560 | $skip=1; | |
561 | } | |
562 | $aktuell = 0; | |
563 | if (!$skip) { | |
564 | while (<FILE>) { | |
565 | if (/kernel:.*(IN=.*)$/) { | |
566 | $aktuell++; | |
567 | } | |
568 | } | |
569 | close (FILE); | |
570 | } | |
571 | ||
572 | system("logtailfwhits /var/log/snort/alert /var/log/snort/fwhits.alert.offset >/tmp/snort.fwhits"); | |
573 | if (!(open (FILE,'/tmp/snort.fwhits'))) { | |
574 | $skip=1; | |
575 | } | |
576 | $alertaktuell = 0; | |
577 | if (!$skip) { | |
578 | while (<FILE>) { | |
579 | if (/scan.*$/) { | |
580 | $alertaktuell++; | |
581 | } | |
582 | } | |
583 | close (FILE); | |
584 | } | |
585 | ||
586 | if (!(open (FILE,'/tmp/messages.fwhits'))) { | |
587 | $skip=1; | |
588 | } | |
589 | $portaktuell = 0; | |
590 | if (!$skip) { | |
591 | while (<FILE>) { | |
592 | if (/kernel:.*(Scan.*)$/) { | |
593 | $portaktuell++; | |
594 | } | |
595 | } | |
596 | close (FILE); | |
597 | } | |
598 | ||
599 | system("rm /tmp/messages.fwhits"); | |
600 | system("rm /tmp/snort.fwhits"); | |
601 | ||
602 | $portamount = $portaktuell + $alertaktuell; | |
603 | chomp($portamount); | |
604 | RRDs::update ("$rrdlog/firewallhits.rrd", | |
605 | "N:$aktuell:$portamount"); | |
606 | $ERROR = RRDs::error; | |
607 | print "Error in RRD::update for Firewallhits: $ERROR\n" if $ERROR; | |
608 | } | |
609 | ||
072cd997 MT |
610 | # Creates and updates a link quality database |
611 | # ------------------------------------------- | |
612 | sub updatelq { | |
613 | if ( ! -e "$rrdlog/lq.rrd") { | |
614 | RRDs::create ("$rrdlog/lq.rrd", "--step=300", | |
615 | "DS:loss:GAUGE:600:0:100", | |
616 | "DS:roundtrip:GAUGE:600:0:10000", | |
617 | "RRA:AVERAGE:0.5:1:576", | |
618 | "RRA:AVERAGE:0.5:6:672", | |
619 | "RRA:AVERAGE:0.5:24:732", | |
620 | "RRA:AVERAGE:0.5:144:1460"); | |
621 | $ERROR = RRDs::error; | |
622 | print "Error in RRD::create for link: $ERROR\n" if $ERROR; | |
623 | } | |
624 | my $packetloss=0; | |
625 | my $roundtrip=0; | |
626 | my $test=0; | |
627 | # LQ_GATEWAY is the ip of your isp's public ip facing you | |
986e08d9 | 628 | my $LQ_GATEWAY='www.heise.de'; |
072cd997 MT |
629 | my $NUMPINGS=10; |
630 | my $pingoutput = `ping -c $NUMPINGS -q $LQ_GATEWAY`; | |
631 | chomp; | |
632 | my @temp = split (/\/|\%|\s/, $pingoutput); | |
633 | $packetloss = $temp[17]; | |
634 | $roundtrip = $temp[28]; | |
635 | RRDs::update ("$rrdlog/lq.rrd", "N:$packetloss:$roundtrip"); | |
636 | $ERROR = RRDs::error; | |
637 | print "Error in RRD::update for line quality: $ERROR\n" if $ERROR; | |
638 | } | |
639 | ||
640 | sub updatelqgraph { | |
641 | my $period = $_[0]; | |
642 | RRDs::graph ("$graphs/lq-$period.png", | |
643 | "--start", "-1$period", "-aPNG", "-i", "-z", | |
644 | "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-r", | |
645 | "-t $tr{'linkq'} ($tr{'graph per'} $tr{$period})", | |
646 | "--lazy", | |
647 | "--color", "SHADEA#EAE9EE", | |
648 | "--color", "SHADEB#EAE9EE", | |
39a7cc11 | 649 | "--color", "BACK#FFFFFF", |
072cd997 MT |
650 | "-v ms / pkts (% x10)", |
651 | "DEF:roundtrip=$rrdlog/lq.rrd:roundtrip:AVERAGE", | |
652 | "DEF:loss=$rrdlog/lq.rrd:loss:AVERAGE", | |
653 | "CDEF:roundavg=roundtrip,PREV(roundtrip),+,2,/", | |
654 | "CDEF:loss10=loss,10,*", | |
655 | "CDEF:r0=roundtrip,30,MIN", | |
656 | "CDEF:r1=roundtrip,70,MIN", | |
657 | "CDEF:r2=roundtrip,150,MIN", | |
658 | "CDEF:r3=roundtrip,300,MIN", | |
659 | "AREA:roundtrip#EE7000:>300 ms", | |
660 | "AREA:r3#D88E1B:150-300 ms", | |
661 | "AREA:r2#B9B63F:70-150 ms", | |
662 | "AREA:r1#99E064:30-70 ms", | |
663 | "AREA:r0#80FF80:<30 ms", | |
664 | "AREA:loss10#800000:Packet loss (x10)", | |
665 | "LINE1:roundtrip#707070:", | |
666 | "GPRINT:roundtrip:MAX:$tr{'maximal'} $tr{'linkq'}\\:%3.2lf ms", | |
667 | "GPRINT:roundtrip:AVERAGE:$tr{'average'} $tr{'linkq'}\\:%3.2lf ms", | |
668 | "GPRINT:roundtrip:LAST:$tr{'current'} $tr{'linkq'}\\:%3.2lf ms\\j", | |
669 | "GPRINT:loss:MAX:$tr{'maximal'} Loss\\:%3.2lf%%", | |
670 | "GPRINT:loss:AVERAGE:$tr{'average'} Loss\\:%3.2lf%%", | |
671 | "GPRINT:loss:LAST:$tr{'current'} Loss\\:%3.2lf%%\\j" | |
672 | ); | |
673 | $ERROR = RRDs::error; | |
674 | print "Error in RRD::graph for Link Quality: $ERROR\n" if $ERROR; | |
675 | } | |
676 | ||
cd1a2927 MT |
677 | ## Update ipac logs |
678 | system ('/usr/sbin/fetchipac'); | |
679 | sleep 8; | |
680 | ||
681 | ### | |
682 | ### Squid Graphs | |
683 | ### | |
684 | if ( -e "/var/log/squid/access.log") { | |
685 | system ("/usr/bin/squid-graph -o=/home/httpd/html/sgraph --tcp-only < /var/log/squid/access.log >/dev/null 2>&1"); | |
686 | } | |
687 | ||
688 | ### | |
689 | ### utf8 conversion | |
690 | ### | |
691 | if ((${Lang::language} eq 'cs') || | |
692 | (${Lang::language} eq 'hu') || | |
693 | (${Lang::language} eq 'pl') || | |
694 | (${Lang::language} eq 'sk')) { | |
695 | # Czech, Hungarian, Polish and Slovak character set | |
696 | foreach my $key(keys %Lang::tr) { | |
697 | from_to($tr{$key}, "utf-8", "iso-8859-2"); | |
698 | } | |
699 | } elsif (${Lang::language} eq 'tr') { | |
700 | # Turkish | |
701 | foreach my $key(keys %Lang::tr) { | |
702 | from_to($tr{$key}, "utf-8", "iso-8859-9"); | |
703 | } | |
704 | } else { | |
705 | foreach my $key(keys %Lang::tr) { | |
706 | from_to($tr{$key}, "utf-8", "iso-8859-1"); | |
707 | } | |
708 | } | |
709 | ||
710 | ### | |
711 | ### System graphs | |
712 | ### | |
713 | updatecpudata(); | |
714 | updatecpugraph ("day"); | |
715 | updatecpugraph ("week"); | |
716 | updatecpugraph ("month"); | |
717 | updatecpugraph ("year"); | |
718 | ||
719 | updatememdata(); | |
720 | updatememgraph ("day"); | |
721 | updatememgraph ("week"); | |
722 | updatememgraph ("month"); | |
723 | updatememgraph ("year"); | |
724 | ||
725 | updatediskdata(); | |
726 | updatediskgraph ("day"); | |
727 | updatediskgraph ("week"); | |
728 | updatediskgraph ("month"); | |
729 | updatediskgraph ("year"); | |
730 | ||
6c666a3b MT |
731 | if (open STAT,"/dev/hda") { |
732 | close STAT; | |
733 | updatediskdatanew ("hda"); | |
734 | updatediskgraphnew ("hda","day"); | |
735 | updatediskgraphnew ("hda","week"); | |
736 | updatediskgraphnew ("hda","month"); | |
737 | updatediskgraphnew ("hda","year"); | |
738 | } else { | |
739 | if (-e "$graphs/disk-hda-day.png") { | |
740 | system("rm $graphs/disk-hda-day.png"); | |
741 | } | |
742 | } | |
743 | ||
744 | if (open STAT,"/dev/hdb") { | |
745 | close STAT; | |
746 | updatediskdatanew ("hdb"); | |
747 | updatediskgraphnew ("hdb","day"); | |
748 | updatediskgraphnew ("hdb","week"); | |
749 | updatediskgraphnew ("hdb","month"); | |
750 | updatediskgraphnew ("hdb","year"); | |
751 | } else { | |
752 | if (-e "$graphs/disk-hdb-day.png") { | |
753 | system("rm $graphs/disk-hdb-day.png"); | |
754 | } | |
755 | } | |
756 | ||
757 | if (open STAT,"/dev/hdc") { | |
758 | close STAT; | |
759 | updatediskdatanew ("hdc"); | |
760 | updatediskgraphnew ("hdc","day"); | |
761 | updatediskgraphnew ("hdc","week"); | |
762 | updatediskgraphnew ("hdc","month"); | |
763 | updatediskgraphnew ("hdc","year"); | |
764 | } else { | |
765 | if (-e "$graphs/disk-hdc-day.png") { | |
766 | system("rm $graphs/disk-hdc-day.png"); | |
767 | } | |
768 | } | |
769 | ||
770 | if (open STAT,"/dev/hdd") { | |
771 | close STAT; | |
772 | updatediskdatanew ("hdd"); | |
773 | updatediskgraphnew ("hdd","day"); | |
774 | updatediskgraphnew ("hdd","week"); | |
775 | updatediskgraphnew ("hdd","month"); | |
776 | updatediskgraphnew ("hdd","year"); | |
777 | } else { | |
778 | if (-e "$graphs/disk-hdd-day.png") { | |
779 | system("rm $graphs/disk-hdd-day.png"); | |
780 | } | |
781 | } | |
782 | ||
783 | if (open STAT,"/dev/hde") { | |
784 | close STAT; | |
785 | updatediskdatanew ("hde"); | |
786 | updatediskgraphnew ("hde","day"); | |
787 | updatediskgraphnew ("hde","week"); | |
788 | updatediskgraphnew ("hde","month"); | |
789 | updatediskgraphnew ("hde","year"); | |
790 | } else { | |
791 | if (-e "$graphs/disk-hde-day.png") { | |
792 | system("rm $graphs/disk-hde-day.png"); | |
793 | } | |
794 | } | |
795 | ||
796 | if (open STAT,"/dev/hdf") { | |
797 | close STAT; | |
798 | updatediskdatanew ("hdf"); | |
799 | updatediskgraphnew ("hdf","day"); | |
800 | updatediskgraphnew ("hdf","week"); | |
801 | updatediskgraphnew ("hdf","month"); | |
802 | updatediskgraphnew ("hdf","year"); | |
803 | } else { | |
804 | if (-e "$graphs/disk-hdf-day.png") { | |
805 | system("rm $graphs/disk-hdf-day.png"); | |
806 | } | |
807 | } | |
808 | ||
809 | if (open STAT,"/dev/hdg") { | |
810 | close STAT; | |
811 | updatediskdatanew ("hdg"); | |
812 | updatediskgraphnew ("hdg","day"); | |
813 | updatediskgraphnew ("hdg","week"); | |
814 | updatediskgraphnew ("hdg","month"); | |
815 | updatediskgraphnew ("hdg","year"); | |
816 | } else { | |
817 | if (-e "$graphs/disk-hdg-day.png") { | |
818 | system("rm $graphs/disk-hdg-day.png"); | |
819 | } | |
820 | } | |
821 | ||
822 | if (open STAT,"/dev/hdh") { | |
823 | close STAT; | |
824 | updatediskdatanew ("hdh"); | |
825 | updatediskgraphnew ("hdh","day"); | |
826 | updatediskgraphnew ("hdh","week"); | |
827 | updatediskgraphnew ("hdh","month"); | |
828 | updatediskgraphnew ("hdh","year"); | |
829 | } else { | |
830 | if (-e "$graphs/disk-hdh-day.png") { | |
831 | system("rm $graphs/disk-hdh-day.png"); | |
832 | } | |
833 | } | |
834 | ||
df8c7810 MT |
835 | ### |
836 | ### Firewallhits | |
837 | ### | |
838 | updatefwhitsdata(); | |
839 | updatefwhitsgraph ("day"); | |
840 | updatefwhitsgraph ("week"); | |
841 | updatefwhitsgraph ("month"); | |
842 | updatefwhitsgraph ("year"); | |
843 | ||
072cd997 MT |
844 | ### |
845 | ### Link Quality | |
846 | ### | |
847 | updatelq(); | |
848 | sleep 2; | |
849 | updatelqgraph("day"); | |
850 | updatelqgraph("week"); | |
851 | updatelqgraph("month"); | |
852 | updatelqgraph("year"); | |
853 | ||
cd1a2927 MT |
854 | ### |
855 | ### Network Graphs | |
856 | ### | |
857 | @ipacsum = `/usr/sbin/ipacsum --exact -s 5m 2>/dev/null`; | |
858 | if (@ipacsum) { | |
859 | updateifdata ("GREEN"); | |
860 | updateifdata ("RED"); | |
861 | if ($settings{'CONFIG_TYPE'} =~ /^(1|3|5|7)$/ ) { | |
862 | updateifdata ("ORANGE"); | |
863 | } | |
864 | if ($settings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/ ) { | |
865 | updateifdata ("BLUE"); | |
866 | } | |
867 | } | |
868 | if ( -e "$rrdlog/GREEN.rrd") { | |
869 | updateifgraph ("GREEN", "day"); | |
870 | updateifgraph ("GREEN", "week"); | |
871 | updateifgraph ("GREEN", "month"); | |
872 | updateifgraph ("GREEN", "year"); | |
873 | } | |
874 | ||
875 | if ( -e "$rrdlog/RED.rrd") { | |
876 | updateifgraph ("RED", "day"); | |
877 | updateifgraph ("RED", "week"); | |
878 | updateifgraph ("RED", "month"); | |
879 | updateifgraph ("RED", "year"); | |
880 | } | |
881 | ||
882 | if ($settings{'CONFIG_TYPE'} =~ /^(1|3|5|7)$/ && -e "$rrdlog/ORANGE.rrd") { | |
883 | updateifgraph ("ORANGE", "day"); | |
884 | updateifgraph ("ORANGE", "week"); | |
885 | updateifgraph ("ORANGE", "month"); | |
886 | updateifgraph ("ORANGE", "year"); | |
887 | } | |
888 | ||
889 | if ($settings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/ && -e "$rrdlog/BLUE.rrd") { | |
890 | updateifgraph ("BLUE", "day"); | |
891 | updateifgraph ("BLUE", "week"); | |
892 | updateifgraph ("BLUE", "month"); | |
893 | updateifgraph ("BLUE", "year"); | |
894 | } | |
3ea75603 | 895 | |
929a3bfc MT |
896 | #chmod 777 /home/httpd/html/{graphs,sgraph} -R |
897 | system("chmod -R 0777 /home/httpd/html/graphs"); | |
898 | system("chmod -R 0777 /home/httpd/html/sgraph"); | |
899 |