diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2015-11-20 01:19:29 +0200 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2015-11-20 01:19:29 +0200 |
commit | f86722e7a092f5d1c6c7815499bd61866c75045c (patch) | |
tree | 1449a86a8220a42909192ba1508c9d31bfe2b3c1 /charts.d/mysql.chart.sh | |
parent | 93921bbb7cd15c3f3a4e4f52386cf3611eadd8d0 (diff) |
normalized all charts.d plugins
Diffstat (limited to 'charts.d/mysql.chart.sh')
-rwxr-xr-x | charts.d/mysql.chart.sh | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/charts.d/mysql.chart.sh b/charts.d/mysql.chart.sh index 934e3bda89..b9bb93775d 100755 --- a/charts.d/mysql.chart.sh +++ b/charts.d/mysql.chart.sh @@ -28,9 +28,6 @@ mysql_check() { local x m mysql_cmd - require_cmd egrep || return 1 - require_cmd sed || return 1 - [ -z "${mysql_cmd}" ] && mysql_cmd="$(which mysql)" if [ ${#mysql_opts[@]} -eq 0 ] @@ -45,13 +42,13 @@ mysql_check() { [ -z "${mysql_cmds[$m]}" ] && mysql_cmds[$m]="$mysql_cmd" if [ -z "${mysql_cmds[$m]}" ] then - echo >&2 "mysql: cannot get mysql command for '$m'. Please set mysql_cmds[$m]='/path/to/mysql', in $confd/mysql.conf" + echo >&2 "$PROGRAM_NAME: mysql: cannot get mysql command for '$m'. Please set mysql_cmds[$m]='/path/to/mysql', in $confd/mysql.conf" fi x="$(mysql_get "${mysql_cmds[$m]}" ${mysql_opts[$m]} | grep "^Connections[[:space:]]")" if [ ! $? -eq 0 -o -z "$x" ] then - echo >&2 "mysql: cannot get global status for '$m'. Please set mysql_opts[$m]='options' to whatever needed to get connected to the mysql server, in $confd/mysql.conf" + echo >&2 "$PROGRAM_NAME: mysql: cannot get global status for '$m'. Please set mysql_opts[$m]='options' to whatever needed to get connected to the mysql server, in $confd/mysql.conf" unset mysql_cmds[$m] unset mysql_opts[$m] unset mysql_ids[$m] @@ -63,7 +60,8 @@ mysql_check() { if [ ${#mysql_opts[@]} -eq 0 ] then - echo >&2 "mysql: no mysql servers found. Please set mysql_opts[name]='options' to whatever needed to get connected to the mysql server, in $confd/mysql.conf" + echo >&2 "$PROGRAM_NAME: mysql: no mysql servers found. Please set mysql_opts[name]='options' to whatever needed to get connected to the mysql server, in $confd/mysql.conf" + return 1 fi return 0 @@ -157,7 +155,7 @@ mysql_update() { unset mysql_ids[$m] unset mysql_opts[$m] unset mysql_cmds[$m] - echo >&2 "mysql: failed to get values for '$m', disabling it." + echo >&2 "$PROGRAM_NAME: mysql: failed to get values for '$m', disabling it." continue fi @@ -209,7 +207,7 @@ END VALUESEOF done - [ ${#mysql_ids[@]} -eq 0 ] && echo >&2 "mysql: no mysql servers left active." && return 1 + [ ${#mysql_ids[@]} -eq 0 ] && echo >&2 "$PROGRAM_NAME: mysql: no mysql servers left active." && return 1 return 0 } |