2008-11-26 Sancho Lerena <slerena@artica.es>

* util/plugin/mysql_plugin.sh: New Mysql plugin for Plugin server.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1263 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2008-11-26 16:38:00 +00:00
parent 80cf5e1a13
commit 0ea1032176
2 changed files with 55 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2008-11-26 Sancho Lerena <slerena@artica.es>
* util/plugin/mysql_plugin.sh: New Mysql plugin for Plugin server.
2008-11-11 Sancho Lerena <slerena@artica.es>
* conf/pandora_server.conf: Added mta_user parameter who defines

View File

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