1 |
dpavlin |
61 |
#!/bin/bash |
2 |
|
|
|
3 |
|
|
cp vebc_ /usr/share/munin/plugins/ || exit |
4 |
|
|
grep -q vebc /etc/munin/plugin-conf.d/munin-node || echo -e "\n[vebc*]\nuser root\n" >> /etc/munin/plugin-conf.d/munin-node || exit |
5 |
|
|
|
6 |
|
|
FILE=`mktemp /tmp/ln-vebc-XXXXXX` |
7 |
|
|
|
8 |
|
|
cd /etc/munin/plugins |
9 |
|
|
|
10 |
|
|
for resources in kmemsize \ |
11 |
|
|
lockedpages_privvmpages_shmpages_physpages_vmguarpages_oomguarpages \ |
12 |
|
|
numproc \ |
13 |
|
|
numtcpsock_numflock_numpty_numsiginfo_numothersock_numiptent \ |
14 |
|
|
tcpsndbuf_tcprcvbuf_othersockbuf_dgramrcvbuf \ |
15 |
|
|
dcachesize \ |
16 |
|
|
numfile |
17 |
|
|
do |
18 |
|
|
for VE in 0 `/usr/sbin/vzlist | sed "s/^ *//" |grep '^[0-9]' | cut -f 1 -d " "` ; do |
19 |
|
|
ln -sf /usr/share/munin/plugins/vebc_ "vebc_"$resources"_"$VE |
20 |
|
|
echo "vebc_"$resources"_"$VE >> $FILE |
21 |
|
|
done |
22 |
|
|
done |
23 |
|
|
|
24 |
|
|
# remove no longer deserved links (ie. links pointing to machines |
25 |
|
|
# which were destroyed or stoped) |
26 |
|
|
|
27 |
|
|
find -type l -name vebc_\* | sed "s/\.\///" | while read LN; do |
28 |
|
|
if grep ^$LN$ $FILE >/dev/null; then |
29 |
|
|
true |
30 |
|
|
else |
31 |
|
|
rm $LN |
32 |
|
|
fi |
33 |
|
|
done |
34 |
|
|
|
35 |
|
|
rm $FILE |
36 |
|
|
|
37 |
|
|
/etc/init.d/munin-node restart |