mirror of
https://github.com/myvesta/vesta
synced 2025-08-21 13:54:28 -07:00
changed function order per convention
This commit is contained in:
parent
66b749909a
commit
86eba5df8b
3 changed files with 43 additions and 17 deletions
|
@ -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
|
||||
|
|
|
@ -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 #
|
||||
#----------------------------------------------------------#
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
#!/bin/bash
|
||||
# info: updating ssh rrd
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue