changed function order per convention

This commit is contained in:
Serghey Rodin 2011-12-28 12:21:52 +02:00
commit 86eba5df8b
3 changed files with 43 additions and 17 deletions

View file

@ -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

View file

@ -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 #
#----------------------------------------------------------#

View file

@ -1,4 +1,3 @@
#!/bin/bash
# info: updating ssh rrd