Editing Monitoring openvz resources using nagios and snmp

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 226: Line 226:
 
#!/bin/bash
 
#!/bin/bash
 
RET=0
 
RET=0
DATA=`echo;sudo /usr/sbin/vzlist -1 2>/dev/null | xargs -I {} bash -c "echo {}:;sudo /usr/sbin/vzquota stat {} | sed 's/\*//g'"`
+
DATA=`echo;sudo /usr/sbin/vzlist -1 | xargs -I {} bash -c "echo {}:;sudo /usr/sbin/vzquota stat {} | sed 's/\*//g'"`
 
if [ -z "$DATA" ]; then
 
if [ -z "$DATA" ]; then
         VPS_err=$(sudo /usr/sbin/vzlist -1 2>&1 1>/dev/null)
+
         echo "UNKNOWN - VZquota stats are not readable or empty. Maybe it is only readable for root and this script should be called by sudo.";
        if [ -n "$VPS_err" ] && [ "$VPS_err" == "Container(s) not found" ]; then
+
        exit 3;
                echo "OK - $VPS_err";
 
                exit 0;
 
        else
 
                if [ -n "$VPS_err" ]; then
 
                        echo "UNKNOWN - Error: $VPS_err";
 
                else
 
                        echo "UNKNOWN - VZquota stats are not readable or empty. Maybe it is only readable for root and this script should be called by sudo.";
 
                fi
 
                exit 3;
 
        fi
 
 
fi
 
fi
  

Please note that all contributions to OpenVZ Virtuozzo Containers Wiki may be edited, altered, or removed by other contributors. If you don't want your writing to be edited mercilessly, then don't submit it here.
If you are going to add external links to an article, read the External links policy first!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)