Browse files

Merge pull request #267 from Harvie/patch-1

Added openvz_ support for laverage and status
  • Loading branch information...
2 parents b780b5e + a80bc90 commit 2a31f93e4afd3e8c16faa9bea8eb709d554520b0 @kenyon kenyon committed Mar 7, 2013
Showing with 6 additions and 1 deletion.
  1. +6 −1 plugins/openvz/openvz_
View
7 plugins/openvz/openvz_
@@ -36,7 +36,12 @@ if [ "$1" = "config" ]; then
exit 0
fi
-vzlist -a -H -o hostname,$ATTRIBUTE | awk '{gsub(/\./,"_",$1)
+filter() { cat; }
+[ "$ATTRIBUTE" = 'laverage' ] && filter() { sed -e 's/[0-9\.]*\/\(.*\)\/.*$/\1/g'; }
+[ "$ATTRIBUTE" = 'status' ] && filter() { sed -e 's/running/10/g;s/stopped/0/g'; }
+#TODO: filter for uptime
+
+vzlist -a -H -o hostname,$ATTRIBUTE | filter | awk '{gsub(/\./,"_",$1)
print("'$ATTRIBUTE'"$1".value "$2)}'
exit 0

0 comments on commit 2a31f93

Please sign in to comment.