26.10.10

munin custom plugins script


#!/bin/bash
#this script will create custom munin plugins (if_custom_$) for ISND
#interface(s) errors: overruns (tx/rx), carrier (tx) and frame (tx)

#
#script should work on debian. adjust path and sympath for other
#os's accordingly
#
#remove comment to cleanup any unwanted plugins that came by #default
#find /etc/munin/plugins -type l \( ! -iname "asterisk_channels" ! -iname "cpu" ! -iname "interrupts" ! -iname "sensors_*" \) -delete


isdn_ifs=(`egrep '\' /proc/net/dev | cut -f1 -d: | sed 's/ //g' | tr '\n' '\t'`)
path=/usr/share/munin/plugins/
sympath=/etc/munin/plugins
plugin1=if_custom_errors_overruns_tx_
plugin2=if_custom_errors_overruns_rx_
plugin3=if_custom_errors_carrier_tx_
plugin4=if_custom_errors_frame_rx_

for i in ${isdn_ifs[@]}
do
cp -f $path/$plugin1 $path/$plugin1$i
ln -sf $path/$plugin1$i $sympath/$plugin1$i

cp -f $path/$plugin2 $path/$plugin2$i
ln -sf $path/$plugin2$i $sympath/$plugin2$i

cp -f $path/$plugin3 $path/$plugin3$i
ln -sf $path/$plugin3$i $sympath/$plugin3$i

cp -f $path/$plugin4 $path/$plugin4$i
ln -sf $path/$plugin4$i $sympath/$plugin4$i

done

###end of script###

0 comments: