From 86eba5df8b1a8a469d31524798175d8e589f055f Mon Sep 17 00:00:00 2001 From: Serghey Rodin Date: Wed, 28 Dec 2011 12:21:52 +0200 Subject: [PATCH] changed function order per convention --- bin/v_list_sys_rrd | 31 +++++++++++++++++++++++++++++-- bin/v_list_web_templates | 28 ++++++++++++++-------------- bin/v_update_sys_rrd_ssh | 1 - 3 files changed, 43 insertions(+), 17 deletions(-) diff --git a/bin/v_list_sys_rrd b/bin/v_list_sys_rrd index bb82a1ea1..26a1f9792 100755 --- a/bin/v_list_sys_rrd +++ b/bin/v_list_sys_rrd @@ -20,9 +20,36 @@ json_list_rrd() { if [ "$i" -ne 1 ]; then echo -e "\t}," fi - echo -e "\\t\"$i\": {" + + # Define title + if [ "$type" = 'la' ]; then + title="Load Average" + fi + + if [ "$type" = 'mem' ]; then + title="Memory Usage" + fi + + if [ "$type" = 'net' ]; then + title="Bandwidth Usage $rrd" + fi + + if [ "$type" = 'web' ] || [ "$type" = 'ftp' ] ||\ + [ "$type" = 'ssh' ]; then + title="$(echo $rrd| tr '[:lower:]' '[:upper:]') Usage" + fi + + if [ "$type" = 'db' ]; then + db_type=$(echo $rrd|cut -f 1 -d _ |sed -e 's/mysql/MySQL/g' \ + -e 's/pgsql/PostgreSQL/g' ) + db_host=$(echo $rrd|cut -f 2 -d _ ) + title="$db_type Usage on $db_host" + fi + + echo -e "\t\"$i\": {" echo -e "\t\t\"TYPE\": \"$type\"", - echo -e "\t\t\"RRD\": \"$rrd\"" + echo -e "\t\t\"RRD\": \"$rrd\"", + echo -e "\t\t\"TITLE\": \"$title\"" (( ++i)) done done diff --git a/bin/v_list_web_templates b/bin/v_list_web_templates index 5fe4e7395..887de3e5a 100755 --- a/bin/v_list_web_templates +++ b/bin/v_list_web_templates @@ -13,20 +13,6 @@ format=${2-shell} source $VESTA/conf/vars.conf source $V_FUNC/shared.func - -#----------------------------------------------------------# -# Verifications # -#----------------------------------------------------------# - -# Checking arg number -check_args '1' "$#" 'user' - -# Checking argument format -format_validation 'user' - -# Checking user -is_user_valid - # Json function json_list_wtpl() { i='1' # iterator @@ -68,6 +54,20 @@ shell_list_wtpl() { } +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '1' "$#" 'user' + +# Checking argument format +format_validation 'user' + +# Checking user +is_user_valid + + #----------------------------------------------------------# # Action # #----------------------------------------------------------# diff --git a/bin/v_update_sys_rrd_ssh b/bin/v_update_sys_rrd_ssh index 84712017a..02d423648 100755 --- a/bin/v_update_sys_rrd_ssh +++ b/bin/v_update_sys_rrd_ssh @@ -1,4 +1,3 @@ - #!/bin/bash # info: updating ssh rrd