Difference between revisions of "Talk:Monitoring openvz resources using munin"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(New page: I made another version which can handle per VE graphs and labelling. This is good for me, because I can present this graphs to my subscribers. <pre> #!/bin/sh # # plugin to monitor OpenVZ...)
 
(use source tag; use unsigned)
 
Line 1: Line 1:
 
I made another version which can handle per VE graphs and labelling. This is good for me, because I can present this graphs to my subscribers.
 
I made another version which can handle per VE graphs and labelling. This is good for me, because I can present this graphs to my subscribers.
  
<pre>
+
<source lang="bash">
 
#!/bin/sh
 
#!/bin/sh
 
#
 
#
Line 74: Line 74:
 
         echo "${name}.value ${vals[1]}"
 
         echo "${name}.value ${vals[1]}"
 
done
 
done
</pre>
+
</source>
 
Then I can made links to the /etc/munin/plugins in this way:
 
Then I can made links to the /etc/munin/plugins in this way:
 
<pre>
 
<pre>
Line 84: Line 84:
 
</pre>
 
</pre>
 
It's not better or worster than the original. It has just different purpose. Maybe this can be put on the front page as an option.
 
It's not better or worster than the original. It has just different purpose. Maybe this can be put on the front page as an option.
 +
{{unsigned|Arpad|16:06, 29 June 2007}}

Latest revision as of 08:29, 25 December 2007

I made another version which can handle per VE graphs and labelling. This is good for me, because I can present this graphs to my subscribers.

#!/bin/sh
#
# plugin to monitor OpenVZ bean counters.
#
#
#%# family=auto
#%# capabilities=autoconf suggest

VEID=$(basename $0 | sed -e 's/^vz_//g' -e 's/_.*$//g')
NAME="$VEID: "$(basename $0 | sed -e 's/^vz_[0-9]\+_//' -e 's/_.*//' -e 's/-/ /g')
ATTRS=$(basename $0 | sed -e 's/^vz_[0-9]\+_[^_]\+_//g' -e 's/_/|/g')

if [ "$1" == "autoconf" ]
then
        if [ -r /proc/bc/0/resources ]
        then
                echo yes
                exit 0
        else
                echo "no (/proc/bc/0/resources not found)"
                exit 1
        fi
fi

if [ "$1" == "suggest" ]
then

        if [ -r /proc/bc/$VEID/resources ]
        then
            cat /proc/bc/$VEID/resources |
            while read str
            do
                vals=($str)
                echo ${vals[0]}
            done

                exit 0
        else
                exit 1
        fi
fi


if [ "$1" == "config" ]
then

#       echo "graph_order down up"
        echo "graph_title $NAME"
        echo 'graph_category OpenVZ'
        echo "graph_info '$NAME'"


        grep -E $ATTRS /proc/bc/$VEID/resources |
        while read str
        do
                vals=($str)
                name=${vals[0]}
                echo ${name}.label $name
                echo "${name}.warning  ${vals[3]}"
                echo "${name}.critical  ${vals[4]}"
        done

        exit 0
fi


grep -E "$ATTRS" /proc/bc/$VEID/resources | while read str
do
        vals=($str)
        name=${vals[0]}
        echo "${name}.value ${vals[1]}"
done

Then I can made links to the /etc/munin/plugins in this way:

vz_1013_Filesystem-informations_numfile_numflock -> /root/munin/vz
vz_1013_Memory_privvmpages -> /root/munin/vz
vz_1013_Network-buffers_tcpsndbuf_tcprcvbuf_dgramrcvbuf_othersockbuf -> /root/munin/vz
vz_1013_Number-of-processes_numproc -> /root/munin/vz
vz_1013_Number-of-sockets_numtcpsock_numothersock -> /root/munin/vz

It's not better or worster than the original. It has just different purpose. Maybe this can be put on the front page as an option. —The preceding unsigned comment was added by Arpad (talkcontribs) 16:06, 29 June 2007.