1 | 1 | simandl | #!/usr/bin/env sh |
2 | | | |
3 | | | . ../../settings |
4 | | | MAXUSERS=500 |
5 | | | MAXCPU=5 |
6 | | | MAXPROC=U |
7 | | | MAXMEM=U |
8 | | | MAXSWAP=U |
9 | | | MAXLOAD=500 |
10 | | | |
11 | | | OS_TYPE=`uname` |
12 | | | |
13 | | | SECS=`date +%s` |
14 | | | |
15 | | | MODNAME=`pwd|sed -e "s/.*\///g" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` |
16 | | | |
17 | | | if ! [ "$(echo $1|grep users)" = "" ]; then |
18 | | | DEV=$1 |
19 | | | echo $SECS $MODNAME: setting up database $DEV.rrd for values [0..$MAXUSERS] |
20 | | | $BINPATH/rrdtool create rrd/$DEV.rrd --step 10 \ |
21 | | | DS:tty:GAUGE:300:0:$MAXUSERS \ |
22 | | | DS:pty:GAUGE:300:0:$MAXUSERS \ |
23 | | | DS:pts:GAUGE:300:0:$MAXUSERS \ |
24 | | | RRA:AVERAGE:0:1:720 \ |
25 | | | RRA:AVERAGE:0.3:6:2880 \ |
26 | | | RRA:AVERAGE:0.3:60:2016 \ |
27 | | | RRA:AVERAGE:0.3:360:1488 \ |
28 | | | RRA:AVERAGE:0.3:4320:1460 \ |
29 | | | RRA:MIN:0.3:6:2880 \ |
30 | | | RRA:MIN:0.3:60:2016 \ |
31 | | | RRA:MIN:0.3:360:1488 \ |
32 | | | RRA:MIN:0.3:4320:1460 \ |
33 | | | RRA:MAX:0.3:6:2880 \ |
34 | | | RRA:MAX:0.3:60:2016 \ |
35 | | | RRA:MAX:0.3:360:1488 \ |
36 | | | RRA:MAX:0.3:4320:1460 |
37 | | | fi |
38 | | | |
39 | | | if ! [ "$(echo $1|grep load)" = "" ]; then |
40 | | | DEV=$1 |
41 | | | echo $SECS $MODNAME: setting up database $DEV.rrd for values [0..$MAXLOAD] |
42 | | | $BINPATH/rrdtool create rrd/$DEV.rrd --step 10 \ |
43 | | | DS:load15:GAUGE:300:0:$MAXLOAD \ |
44 | | | DS:load5:GAUGE:300:0:$MAXLOAD \ |
45 | | | DS:load1:GAUGE:300:0:$MAXLOAD \ |
46 | | | RRA:AVERAGE:0:1:720 \ |
47 | | | RRA:AVERAGE:0.3:6:2880 \ |
48 | | | RRA:AVERAGE:0.3:60:2016 \ |
49 | | | RRA:AVERAGE:0.3:360:1488 \ |
50 | | | RRA:AVERAGE:0.3:4320:1460 \ |
51 | | | RRA:MIN:0.3:6:2880 \ |
52 | | | RRA:MIN:0.3:60:2016 \ |
53 | | | RRA:MIN:0.3:360:1488 \ |
54 | | | RRA:MIN:0.3:4320:1460 \ |
55 | | | RRA:MAX:0.3:6:2880 \ |
56 | | | RRA:MAX:0.3:60:2016 \ |
57 | | | RRA:MAX:0.3:360:1488 \ |
58 | | | RRA:MAX:0.3:4320:1460 |
59 | | | fi |
60 | | | |
61 | | | if ! [ "$(echo $1|grep cpu)" = "" ]; then |
62 | | | DEV=$1 |
63 | | | echo $SECS $MODNAME: setting up database $DEV.rrd for values [0..$MAXCPU] |
64 | | | if [ $OS_TYPE = "Linux" ] || [ $OS_TYPE = "SunOS" ]; then |
65 | | | $BINPATH/rrdtool create rrd/$DEV.rrd --step 10 \ |
66 | | | DS:cpuusr:GAUGE:300:0:$MAXCPU \ |
67 | | | DS:cpunic:GAUGE:300:0:$MAXCPU \ |
68 | | | DS:cpusys:GAUGE:300:0:$MAXCPU \ |
69 | | | DS:cpuidl:GAUGE:300:0:$MAXCPU \ |
70 | | | RRA:AVERAGE:0:1:720 \ |
71 | | | RRA:AVERAGE:0.3:6:2880 \ |
72 | | | RRA:AVERAGE:0.3:60:2016 \ |
73 | | | RRA:AVERAGE:0.3:360:1488 \ |
74 | | | RRA:AVERAGE:0.3:4320:1460 \ |
75 | | | RRA:MIN:0.3:6:2880 \ |
76 | | | RRA:MIN:0.3:60:2016 \ |
77 | | | RRA:MIN:0.3:360:1488 \ |
78 | | | RRA:MIN:0.3:4320:1460 \ |
79 | | | RRA:MAX:0.3:6:2880 \ |
80 | | | RRA:MAX:0.3:60:2016 \ |
81 | | | RRA:MAX:0.3:360:1488 \ |
82 | | | RRA:MAX:0.3:4320:1460 |
83 | | | fi |
84 | | | if [ $OS_TYPE = "FreeBSD" ]; then |
85 | | | $BINPATH/rrdtool create rrd/$DEV.rrd --step 10 \ |
86 | | | DS:cpuusr:GAUGE:300:0:$MAXCPU \ |
87 | | | DS:cpunic:GAUGE:300:0:$MAXCPU \ |
88 | | | DS:cpusys:GAUGE:300:0:$MAXCPU \ |
89 | | | DS:cpuidl:GAUGE:300:0:$MAXCPU \ |
90 | | | DS:cpuint:GAUGE:300:0:$MAXCPU \ |
91 | | | RRA:AVERAGE:0:1:720 \ |
92 | | | RRA:AVERAGE:0.3:6:2880 \ |
93 | | | RRA:AVERAGE:0.3:60:2016 \ |
94 | | | RRA:AVERAGE:0.3:360:1488 \ |
95 | | | RRA:AVERAGE:0.3:4320:1460 \ |
96 | | | RRA:MIN:0.3:6:2880 \ |
97 | | | RRA:MIN:0.3:60:2016 \ |
98 | | | RRA:MIN:0.3:360:1488 \ |
99 | | | RRA:MIN:0.3:4320:1460 \ |
100 | | | RRA:MAX:0.3:6:2880 \ |
101 | | | RRA:MAX:0.3:60:2016 \ |
102 | | | RRA:MAX:0.3:360:1488 \ |
103 | | | RRA:MAX:0.3:4320:1460 |
104 | | | fi |
105 | | | if [ $OS_TYPE = "NetBSD" ]; then |
106 | | | $BINPATH/rrdtool create rrd/$DEV.rrd --step 10 \ |
107 | | | DS:cpuusr:GAUGE:300:0:$MAXCPU \ |
108 | | | DS:cpunic:GAUGE:300:0:$MAXCPU \ |
109 | | | DS:cpusys:GAUGE:300:0:$MAXCPU \ |
110 | | | DS:cpuidl:GAUGE:300:0:$MAXCPU \ |
111 | | | DS:cpuint:GAUGE:300:0:$MAXCPU \ |
112 | | | RRA:AVERAGE:0:1:720 \ |
113 | | | RRA:AVERAGE:0.3:6:2880 \ |
114 | | | RRA:AVERAGE:0.3:60:2016 \ |
115 | | | RRA:AVERAGE:0.3:360:1488 \ |
116 | | | RRA:AVERAGE:0.3:4320:1460 \ |
117 | | | RRA:MIN:0.3:6:2880 \ |
118 | | | RRA:MIN:0.3:60:2016 \ |
119 | | | RRA:MIN:0.3:360:1488 \ |
120 | | | RRA:MIN:0.3:4320:1460 \ |
121 | | | RRA:MAX:0.3:6:2880 \ |
122 | | | RRA:MAX:0.3:60:2016 \ |
123 | | | RRA:MAX:0.3:360:1488 \ |
124 | | | RRA:MAX:0.3:4320:1460 |
125 | | | fi |
126 | | | fi |
127 | | | |
128 | | | if ! [ "$(echo $1|grep proc)" = "" ]; then |
129 | | | DEV=$1 |
130 | | | echo $SECS $MODNAME: setting up database $DEV.rrd for values [0..$MAXPROC] |
131 | | | $BINPATH/rrdtool create rrd/$DEV.rrd --step 10 \ |
132 | | | DS:procslp:GAUGE:300:0:$MAXPROC \ |
133 | | | DS:procrun:GAUGE:300:0:$MAXPROC \ |
134 | | | DS:proczmb:GAUGE:300:0:$MAXPROC \ |
135 | | | DS:procstp:GAUGE:300:0:$MAXPROC \ |
136 | | | DS:procdsc:GAUGE:300:0:$MAXPROC \ |
137 | | | RRA:AVERAGE:0:1:720 \ |
138 | | | RRA:AVERAGE:0.3:6:2880 \ |
139 | | | RRA:AVERAGE:0.3:60:2016 \ |
140 | | | RRA:AVERAGE:0.3:360:1488 \ |
141 | | | RRA:AVERAGE:0.3:4320:1460 \ |
142 | | | RRA:MIN:0.3:6:2880 \ |
143 | | | RRA:MIN:0.3:60:2016 \ |
144 | | | RRA:MIN:0.3:360:1488 \ |
145 | | | RRA:MIN:0.3:4320:1460 \ |
146 | | | RRA:MAX:0.3:6:2880 \ |
147 | | | RRA:MAX:0.3:60:2016 \ |
148 | | | RRA:MAX:0.3:360:1488 \ |
149 | | | RRA:MAX:0.3:4320:1460 |
150 | | | fi |
151 | | | |
152 | | | if ! [ "$(echo $1|grep mem)" = "" ]; then |
153 | | | DEV=$1 |
154 | | | echo $SECS $MODNAME: setting up database $DEV.rrd for values [0..$MAX] |
155 | | | if [ $OS_TYPE = "Linux" ]; then |
156 | | | $BINPATH/rrdtool create rrd/$DEV.rrd --step 10 \ |
157 | | | DS:memfre:GAUGE:300:0:$MAXMEM \ |
158 | | | DS:memshr:GAUGE:300:0:$MAXMEM \ |
159 | | | DS:membuf:GAUGE:300:0:$MAXMEM \ |
160 | | | DS:memcac:GAUGE:300:0:$MAXMEM \ |
161 | | | DS:swpfre:GAUGE:300:0:$MAXSWAP \ |
162 | | | DS:swpuse:GAUGE:300:0:$MAXSWAP \ |
163 | | | RRA:AVERAGE:0:1:720 \ |
164 | | | RRA:AVERAGE:0.3:6:2880 \ |
165 | | | RRA:AVERAGE:0.3:60:2016 \ |
166 | | | RRA:AVERAGE:0.3:360:1488 \ |
167 | | | RRA:AVERAGE:0.3:4320:1460 \ |
168 | | | RRA:MIN:0.3:6:2880 \ |
169 | | | RRA:MIN:0.3:60:2016 \ |
170 | | | RRA:MIN:0.3:360:1488 \ |
171 | | | RRA:MIN:0.3:4320:1460 \ |
172 | | | RRA:MAX:0.3:6:2880 \ |
173 | | | RRA:MAX:0.3:60:2016 \ |
174 | | | RRA:MAX:0.3:360:1488 \ |
175 | | | RRA:MAX:0.3:4320:1460 |
176 | | | fi |
177 | | | if [ $OS_TYPE = "FreeBSD" ]; then |
178 | | | $BINPATH/rrdtool create rrd/$DEV.rrd --step 10 \ |
179 | | | DS:memfree:GAUGE:300:0:$MAXMEM \ |
180 | | | DS:memwire:GAUGE:300:0:$MAXMEM \ |
181 | | | DS:memactv:GAUGE:300:0:$MAXMEM \ |
182 | | | DS:meminac:GAUGE:300:0:$MAXMEM \ |
183 | | | DS:memcach:GAUGE:300:0:$MAXMEM \ |
184 | | | DS:swpfre:GAUGE:300:0:$MAXSWAP \ |
185 | | | DS:swpuse:GAUGE:300:0:$MAXSWAP \ |
186 | | | RRA:AVERAGE:0:1:720 \ |
187 | | | RRA:AVERAGE:0.3:6:2880 \ |
188 | | | RRA:AVERAGE:0.3:60:2016 \ |
189 | | | RRA:AVERAGE:0.3:360:1488 \ |
190 | | | RRA:AVERAGE:0.3:4320:1460 \ |
191 | | | RRA:MIN:0.3:6:2880 \ |
192 | | | RRA:MIN:0.3:60:2016 \ |
193 | | | RRA:MIN:0.3:360:1488 \ |
194 | | | RRA:MIN:0.3:4320:1460 \ |
195 | | | RRA:MAX:0.3:6:2880 \ |
196 | | | RRA:MAX:0.3:60:2016 \ |
197 | | | RRA:MAX:0.3:360:1488 \ |
198 | | | RRA:MAX:0.3:4320:1460 |
199 | | | fi |
200 | | | if [ $OS_TYPE = "NetBSD" ]; then |
201 | | | $BINPATH/rrdtool create rrd/$DEV.rrd --step 10 \ |
202 | | | DS:memfree:GAUGE:300:0:$MAXMEM \ |
203 | | | DS:meminac:GAUGE:300:0:$MAXMEM \ |
204 | | | DS:memacti:GAUGE:300:0:$MAXMEM \ |
205 | | | DS:memwire:GAUGE:300:0:$MAXMEM \ |
206 | | | DS:memcach:GAUGE:300:0:$MAXMEM \ |
207 | | | DS:swpfre:GAUGE:300:0:$MAXSWAP \ |
208 | | | DS:swpuse:GAUGE:300:0:$MAXSWAP \ |
209 | | | RRA:AVERAGE:0:1:720 \ |
210 | | | RRA:AVERAGE:0.3:6:2880 \ |
211 | | | RRA:AVERAGE:0.3:60:2016 \ |
212 | | | RRA:AVERAGE:0.3:360:1488 \ |
213 | | | RRA:AVERAGE:0.3:4320:1460 \ |
214 | | | RRA:MIN:0.3:6:2880 \ |
215 | | | RRA:MIN:0.3:60:2016 \ |
216 | | | RRA:MIN:0.3:360:1488 \ |
217 | | | RRA:MIN:0.3:4320:1460 \ |
218 | | | RRA:MAX:0.3:6:2880 \ |
219 | | | RRA:MAX:0.3:60:2016 \ |
220 | | | RRA:MAX:0.3:360:1488 \ |
221 | | | RRA:MAX:0.3:4320:1460 |
222 | | | fi |
223 | | | if [ $OS_TYPE = "Darwin" ]; then |
224 | | | $BINPATH/rrdtool create rrd/$DEV.rrd --step 10 \ |
225 | | | DS:memfree:GAUGE:300:0:$MAXMEM \ |
226 | | | DS:memwire:GAUGE:300:0:$MAXMEM \ |
227 | | | DS:memactv:GAUGE:300:0:$MAXMEM \ |
228 | | | DS:meminac:GAUGE:300:0:$MAXMEM \ |
229 | | | DS:swpfre:GAUGE:300:0:$MAXSWAP \ |
230 | | | DS:swpuse:GAUGE:300:0:$MAXSWAP \ |
231 | | | RRA:AVERAGE:0:1:720 \ |
232 | | | RRA:AVERAGE:0.3:6:2880 \ |
233 | | | RRA:AVERAGE:0.3:60:2016 \ |
234 | | | RRA:AVERAGE:0.3:360:1488 \ |
235 | | | RRA:AVERAGE:0.3:4320:1460 \ |
236 | | | RRA:MIN:0.3:6:2880 \ |
237 | | | RRA:MIN:0.3:60:2016 \ |
238 | | | RRA:MIN:0.3:360:1488 \ |
239 | | | RRA:MIN:0.3:4320:1460 \ |
240 | | | RRA:MAX:0.3:6:2880 \ |
241 | | | RRA:MAX:0.3:60:2016 \ |
242 | | | RRA:MAX:0.3:360:1488 \ |
243 | | | RRA:MAX:0.3:4320:1460 |
244 | | | fi |
245 | | | if [ $OS_TYPE = "SunOS" ]; then |
246 | | | $BINPATH/rrdtool create rrd/$DEV.rrd --step 10 \ |
247 | | | DS:memfre:GAUGE:300:0:$MAXMEM \ |
248 | | | DS:memshr:GAUGE:300:0:$MAXMEM \ |
249 | | | DS:membuf:GAUGE:300:0:$MAXMEM \ |
250 | | | DS:memcac:GAUGE:300:0:$MAXMEM \ |
251 | | | DS:swpfre:GAUGE:300:0:$MAXSWAP \ |
252 | | | DS:swpuse:GAUGE:300:0:$MAXSWAP \ |
253 | | | RRA:AVERAGE:0:1:720 \ |
254 | | | RRA:AVERAGE:0.3:6:2880 \ |
255 | | | RRA:AVERAGE:0.3:60:2016 \ |
256 | | | RRA:AVERAGE:0.3:360:1488 \ |
257 | | | RRA:AVERAGE:0.3:4320:1460 \ |
258 | | | RRA:MIN:0.3:6:2880 \ |
259 | | | RRA:MIN:0.3:60:2016 \ |
260 | | | RRA:MIN:0.3:360:1488 \ |
261 | | | RRA:MIN:0.3:4320:1460 \ |
262 | | | RRA:MAX:0.3:6:2880 \ |
263 | | | RRA:MAX:0.3:60:2016 \ |
264 | | | RRA:MAX:0.3:360:1488 \ |
265 | | | RRA:MAX:0.3:4320:1460 |
266 | | | fi |
267 | | | fi |
268 | | | |
269 | | | if [ "$1" = "irq" ]; then |
270 | | | DEV=irq |
271 | | | echo $SECS $MODNAME: setting up database $DEV.rrd |
272 | | | $BINPATH/rrdtool create rrd/$DEV.rrd --step 10 \ |
273 | | | DS:irqall:COUNTER:300:0:U \ |
274 | | | DS:irq00:COUNTER:300:0:U \ |
275 | | | DS:irq01:COUNTER:300:0:U \ |
276 | | | DS:irq02:COUNTER:300:0:U \ |
277 | | | DS:irq03:COUNTER:300:0:U \ |
278 | | | DS:irq04:COUNTER:300:0:U \ |
279 | | | DS:irq05:COUNTER:300:0:U \ |
280 | | | DS:irq06:COUNTER:300:0:U \ |
281 | | | DS:irq07:COUNTER:300:0:U \ |
282 | | | DS:irq08:COUNTER:300:0:U \ |
283 | | | DS:irq09:COUNTER:300:0:U \ |
284 | | | DS:irq10:COUNTER:300:0:U \ |
285 | | | DS:irq11:COUNTER:300:0:U \ |
286 | | | DS:irq12:COUNTER:300:0:U \ |
287 | | | DS:irq13:COUNTER:300:0:U \ |
288 | | | DS:irq14:COUNTER:300:0:U \ |
289 | | | DS:irq15:COUNTER:300:0:U \ |
290 | | | RRA:AVERAGE:0:1:720 \ |
291 | | | RRA:AVERAGE:0.3:6:2880 \ |
292 | | | RRA:AVERAGE:0.3:60:2016 \ |
293 | | | RRA:AVERAGE:0.3:360:1488 \ |
294 | | | RRA:AVERAGE:0.3:4320:1460 \ |
295 | | | RRA:MIN:0.3:6:2880 \ |
296 | | | RRA:MIN:0.3:60:2016 \ |
297 | | | RRA:MIN:0.3:360:1488 \ |
298 | | | RRA:MIN:0.3:4320:1460 \ |
299 | | | RRA:MAX:0.3:6:2880 \ |
300 | | | RRA:MAX:0.3:60:2016 \ |
301 | | | RRA:MAX:0.3:360:1488 \ |
302 | | | RRA:MAX:0.3:4320:1460 |
303 | | | fi |
304 | | | |
305 | | | |
306 | | | if ! [ "$(echo $1|grep uptime)" = "" ]; then |
307 | | | DEV=$1 |
308 | | | echo $SECS $MODNAME: setting up database $DEV.rrd |
309 | | | $BINPATH/rrdtool create rrd/$DEV.rrd --step 10 \ |
310 | | | DS:up:GAUGE:300:0:U \ |
311 | | | DS:idle:GAUGE:300:0:U \ |
312 | | | RRA:AVERAGE:0:1:720 \ |
313 | | | RRA:AVERAGE:0.3:6:2880 \ |
314 | | | RRA:AVERAGE:0.3:60:2016 \ |
315 | | | RRA:AVERAGE:0.3:360:1488 \ |
316 | | | RRA:AVERAGE:0.3:4320:1460 \ |
317 | | | RRA:MAX:0.3:6:2880 \ |
318 | | | RRA:MAX:0.3:60:2016 \ |
319 | | | RRA:MAX:0.3:360:1488 \ |
320 | | | RRA:MAX:0.3:4320:1460 |
321 | | | fi |
322 | | | |
323 | | | # 2h -> 720 Werte alle 10sec |
324 | | | # 2d = 48h -> 2880 Werte alle 1min (6*10sec) |
325 | | | # 2w = 14d -> 2016 Werte alle 10min (60*10sec) |
326 | | | # 2m = 62d -> 1488 Werte alle 1h (360*10sec) |
327 | | | # 2y = 730d -> 1460 Werte alle 12h (4320*10sec) |
328 | | | |