diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 1950e96e15..f0c1285577 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,7 @@ +2008-11-26 Sancho Lerena + + * util/plugin/mysql_plugin.sh: New Mysql plugin for Plugin server. + 2008-11-11 Sancho Lerena * conf/pandora_server.conf: Added mta_user parameter who defines diff --git a/pandora_server/util/plugin/mysql_plugin.sh b/pandora_server/util/plugin/mysql_plugin.sh new file mode 100755 index 0000000000..284bf96f39 --- /dev/null +++ b/pandora_server/util/plugin/mysql_plugin.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# Mysql remote Plugin for Pandora FMS Plugin server +# (c) ArticaST, Sancho Lerena 2008 + + +# Default values +PASSWORD="" +SERVER="" +USER="" + +function help { + echo -e "MySQL Plugin for Pandora FMS Plugin server. http://pandorafms.com" + echo -e "Syntax:" + echo -e "\t\t-u username" + echo -e "\t\t-p password" + echo -e "\t\t-s server" + echo -e "\t\t-q query string (global status), for example 'Aborted_connects'\n" + echo -e "Samples:" + echo " ./mysql_plugin.sh -u root -p none -s localhost -q Com_select" + echo " ./mysql_plugin.sh -u root -p none -s localhost -q Com_update" + echo " ./mysql_plugin.sh -u root -p none -s localhost -q Connections" + echo " ./mysql_plugin.sh -u root -p anypass -s 192.168.50.24 -q Innodb_rows_read" + echo "" +} + +# Main parsing code + +while getopts "u:p:s:q:" optname + do + case "$optname" in + "u") + USER=$OPTARG + ;; + "p") + PASSWORD=$OPTARG + ;; + "s") + SERVER=$OPTARG + ;; + "q") + QUERY=$OPTARG + ;; + + esac +done + +# Execution + +echo "show global status" | mysql -u $USER -p$PASSWORD -h$SERVER | grep "$QUERY" | awk '{ print $2 }' + +