File tree Expand file tree Collapse file tree 3 files changed +43
-17
lines changed
Expand file tree Collapse file tree 3 files changed +43
-17
lines changed Original file line number Diff line number Diff line change @@ -20,9 +20,36 @@ json_list_rrd() {
2020 if [ " $i " -ne 1 ]; then
2121 echo -e " \t},"
2222 fi
23- echo -e " \\ t\" $i \" : {"
23+
24+ # Define title
25+ if [ " $type " = ' la' ]; then
26+ title=" Load Average"
27+ fi
28+
29+ if [ " $type " = ' mem' ]; then
30+ title=" Memory Usage"
31+ fi
32+
33+ if [ " $type " = ' net' ]; then
34+ title=" Bandwidth Usage $rrd "
35+ fi
36+
37+ if [ " $type " = ' web' ] || [ " $type " = ' ftp' ] || \
38+ [ " $type " = ' ssh' ]; then
39+ title=" $( echo $rrd | tr ' [:lower:]' ' [:upper:]' ) Usage"
40+ fi
41+
42+ if [ " $type " = ' db' ]; then
43+ db_type=$( echo $rrd | cut -f 1 -d _ | sed -e ' s/mysql/MySQL/g' \
44+ -e ' s/pgsql/PostgreSQL/g' )
45+ db_host=$( echo $rrd | cut -f 2 -d _ )
46+ title=" $db_type Usage on $db_host "
47+ fi
48+
49+ echo -e " \t\" $i \" : {"
2450 echo -e " \t\t\" TYPE\" : \" $type \" " ,
25- echo -e " \t\t\" RRD\" : \" $rrd \" "
51+ echo -e " \t\t\" RRD\" : \" $rrd \" " ,
52+ echo -e " \t\t\" TITLE\" : \" $title \" "
2653 (( ++ i))
2754 done
2855 done
Original file line number Diff line number Diff line change @@ -13,20 +13,6 @@ format=${2-shell}
1313source $VESTA /conf/vars.conf
1414source $V_FUNC /shared.func
1515
16-
17- # ----------------------------------------------------------#
18- # Verifications #
19- # ----------------------------------------------------------#
20-
21- # Checking arg number
22- check_args ' 1' " $# " ' user'
23-
24- # Checking argument format
25- format_validation ' user'
26-
27- # Checking user
28- is_user_valid
29-
3016# Json function
3117json_list_wtpl () {
3218 i=' 1' # iterator
@@ -68,6 +54,20 @@ shell_list_wtpl() {
6854}
6955
7056
57+ # ----------------------------------------------------------#
58+ # Verifications #
59+ # ----------------------------------------------------------#
60+
61+ # Checking arg number
62+ check_args ' 1' " $# " ' user'
63+
64+ # Checking argument format
65+ format_validation ' user'
66+
67+ # Checking user
68+ is_user_valid
69+
70+
7171# ----------------------------------------------------------#
7272# Action #
7373# ----------------------------------------------------------#
Original file line number Diff line number Diff line change 1-
21#! /bin/bash
32# info: updating ssh rrd
43
You can’t perform that action at this time.
0 commit comments