-
-
Save av-jok/da16b83ae1539100d9e3f30d8bb9e921 to your computer and use it in GitHub Desktop.
Zabbix Mysql Statistcs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This script get all Mysql database size (except the internal one) and display it as a Json | |
# that can be used to Zabbix Discovery Rules. | |
# | |
# This simple script was created by RafaelFoster: rafaelgfoster (at) gmail (dot) com | |
# | |
# Json Output: {"data": [ { "{#DBNAME}" : "database_name","{#DBSIZE}":"size_in_bytes"},{"{#DBNAME}":"database_name2","{#DBSIZE}":"size_in_bytes"} ] } | |
cd $HOME | |
SQL_CMD="AS 'Database', SUM(data_length + index_length) AS 'Size' FROM information_schema.TABLES" | |
SQL_ExceptionDB="information_schema|performance_schema|mysql" | |
db_name=$1 | |
if [ $# -eq 0 ]; then | |
db_name="DB.DISCOVERY" | |
fi | |
IFSBKP=$IFS | |
IFS=$'\n' | |
myJsonStr="{\"data\": [" | |
case "$db_name" in | |
"DB.SIZE.TOTAL") | |
SQL_Command="Select 'total' $SQL_CMD" | |
;; | |
"DB.DISCOVERY") | |
SQL_Command="Select table_schema FROM information_schema.TABLES GROUP BY table_schema" | |
;; | |
*) | |
SQL_Command="Select table_schema $SQL_CMD WHERE table_schema = '$db_name' GROUP BY table_schema" | |
echo $(mysql --skip-column-names -Ne "$SQL_Command" | grep -vwE "$SQL_ExceptionDB" |awk '{print $2}' ) | |
exit; | |
;; | |
esac | |
MYOUT=$(mysql -Ne "$SQL_Command" | grep -vwE "$SQL_ExceptionDB") | |
if [ $? -eq 1 ]; then | |
echo "Some error occurred with mysql command" | |
exit; | |
fi | |
for sqlOutput in $MYOUT | |
do | |
dbName=$(echo $sqlOutput |awk '{print $1}') | |
dbSize=$(echo $sqlOutput |awk '{print $2}') | |
JsonStr=$(echo $JsonStr\{ ) | |
JsonStr=$(echo $JsonStr\"{#DBNAME}\":\"$dbName\") | |
if [ ! -z $dbSize ]; then | |
JsonStr=$(echo $JsonStr\"{#DBSIZE}\":\"$dbSize\" ) | |
fi | |
JsonStr=$(echo $JsonStr\}, ) | |
done | |
myJsonStr=$(echo $myJsonStr $JsonStr |sed -e "s/,$//g") | |
echo $myJsonStr "] }" | |
IFS=$IFSBKP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<zabbix_export> | |
<version>2.0</version> | |
<date>2014-11-13T14:14:07Z</date> | |
<groups> | |
<group> | |
<name>Templates Agent</name> | |
</group> | |
</groups> | |
<templates> | |
<template> | |
<template>Template_App_MySQL</template> | |
<name>Template_App_MySQL</name> | |
<groups> | |
<group> | |
<name>Templates Agent</name> | |
</group> | |
</groups> | |
<applications> | |
<application> | |
<name>MySQL</name> | |
</application> | |
</applications> | |
<items> | |
<item> | |
<name>MySQL begin operations</name> | |
<type>7</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>mysql.status[Com_begin]</key> | |
<delay>60</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>0</value_type> | |
<allowed_hosts/> | |
<units>qps</units> | |
<delta>1</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description>It requires user parameter mysql.status[*], which is defined in userparameter_mysql.conf.</description> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name>MySQL</name> | |
</application> | |
</applications> | |
<valuemap/> | |
</item> | |
<item> | |
<name>MySQL bytes received</name> | |
<type>7</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>mysql.status[Bytes_received]</key> | |
<delay>60</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>0</value_type> | |
<allowed_hosts/> | |
<units>Bps</units> | |
<delta>1</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description>The number of bytes received from all clients. | |
| |
It requires user parameter mysql.status[*], which is defined in | |
userparameter_mysql.conf.</description> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name>MySQL</name> | |
</application> | |
</applications> | |
<valuemap/> | |
</item> | |
<item> | |
<name>MySQL bytes sent</name> | |
<type>7</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>mysql.status[Bytes_sent]</key> | |
<delay>60</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>0</value_type> | |
<allowed_hosts/> | |
<units>Bps</units> | |
<delta>1</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description>The number of bytes sent to all clients. | |
| |
It requires user parameter mysql.status[*], which is defined in userparameter_mysql.conf.</description> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name>MySQL</name> | |
</application> | |
</applications> | |
<valuemap/> | |
</item> | |
<item> | |
<name>MySQL commit operations</name> | |
<type>7</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>mysql.status[Com_commit]</key> | |
<delay>60</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>0</value_type> | |
<allowed_hosts/> | |
<units>qps</units> | |
<delta>1</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description>It requires user parameter mysql.status[*], which is defined in userparameter_mysql.conf.</description> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name>MySQL</name> | |
</application> | |
</applications> | |
<valuemap/> | |
</item> | |
<item> | |
<name>Mysql Database Size</name> | |
<type>7</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>mysql.db.size[DB.SIZE.TOTAL]</key> | |
<delay>3600</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>3</value_type> | |
<allowed_hosts/> | |
<units/> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name>MySQL</name> | |
</application> | |
</applications> | |
<valuemap/> | |
</item> | |
<item> | |
<name>MySQL delete operations</name> | |
<type>7</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>mysql.status[Com_delete]</key> | |
<delay>60</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>0</value_type> | |
<allowed_hosts/> | |
<units>qps</units> | |
<delta>1</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description>It requires user parameter mysql.status[*], which is defined in userparameter_mysql.conf.</description> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name>MySQL</name> | |
</application> | |
</applications> | |
<valuemap/> | |
</item> | |
<item> | |
<name>MySQL insert operations</name> | |
<type>7</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>mysql.status[Com_insert]</key> | |
<delay>60</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>0</value_type> | |
<allowed_hosts/> | |
<units>qps</units> | |
<delta>1</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description>It requires user parameter mysql.status[*], which is defined in userparameter_mysql.conf.</description> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name>MySQL</name> | |
</application> | |
</applications> | |
<valuemap/> | |
</item> | |
<item> | |
<name>MySQL queries</name> | |
<type>7</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>mysql.status[Questions]</key> | |
<delay>60</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>0</value_type> | |
<allowed_hosts/> | |
<units>qps</units> | |
<delta>1</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description>It requires user parameter mysql.status[*], which is defined in userparameter_mysql.conf.</description> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name>MySQL</name> | |
</application> | |
</applications> | |
<valuemap/> | |
</item> | |
<item> | |
<name>MySQL rollback operations</name> | |
<type>7</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>mysql.status[Com_rollback]</key> | |
<delay>60</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>0</value_type> | |
<allowed_hosts/> | |
<units>qps</units> | |
<delta>1</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description>It requires user parameter mysql.status[*], which is defined in userparameter_mysql.conf.</description> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name>MySQL</name> | |
</application> | |
</applications> | |
<valuemap/> | |
</item> | |
<item> | |
<name>MySQL select operations</name> | |
<type>7</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>mysql.status[Com_select]</key> | |
<delay>60</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>0</value_type> | |
<allowed_hosts/> | |
<units>qps</units> | |
<delta>1</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description>It requires user parameter mysql.status[*], which is defined in userparameter_mysql.conf.</description> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name>MySQL</name> | |
</application> | |
</applications> | |
<valuemap/> | |
</item> | |
<item> | |
<name>MySQL slow queries</name> | |
<type>7</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>mysql.status[Slow_queries]</key> | |
<delay>60</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>3</value_type> | |
<allowed_hosts/> | |
<units/> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description>It requires user parameter mysql.status[*], which is defined in userparameter_mysql.conf.</description> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name>MySQL</name> | |
</application> | |
</applications> | |
<valuemap/> | |
</item> | |
<item> | |
<name>MySQL status</name> | |
<type>7</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>mysql.ping</key> | |
<delay>60</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>3</value_type> | |
<allowed_hosts/> | |
<units/> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description>It requires user parameter mysql.ping, which is defined in userparameter_mysql.conf | |
| |
0 - MySQL server is down | |
1 - MySQL server is up</description> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name>MySQL</name> | |
</application> | |
</applications> | |
<valuemap> | |
<name>Service state</name> | |
</valuemap> | |
</item> | |
<item> | |
<name>MySQL update operations</name> | |
<type>7</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>mysql.status[Com_update]</key> | |
<delay>60</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>0</value_type> | |
<allowed_hosts/> | |
<units>qps</units> | |
<delta>1</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description>It requires user parameter mysql.status[*], which is defined in userparameter_mysql.conf.</description> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name>MySQL</name> | |
</application> | |
</applications> | |
<valuemap/> | |
</item> | |
<item> | |
<name>MySQL uptime</name> | |
<type>7</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>mysql.status[Uptime]</key> | |
<delay>60</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>3</value_type> | |
<allowed_hosts/> | |
<units>uptime</units> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description>It requires user parameter mysql.status, which is defined in userparameter_mysql.conf.</description> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name>MySQL</name> | |
</application> | |
</applications> | |
<valuemap/> | |
</item> | |
<item> | |
<name>MySQL version</name> | |
<type>7</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>mysql.version</key> | |
<delay>3600</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>1</value_type> | |
<allowed_hosts/> | |
<units/> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description>It requires user parameter mysql.uptime, which is defined in userparameter_mysql.conf.</description> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name>MySQL</name> | |
</application> | |
</applications> | |
<valuemap/> | |
</item> | |
</items> | |
<discovery_rules> | |
<discovery_rule> | |
<name>Mysql Database Discovery</name> | |
<type>7</type> | |
<snmp_community/> | |
<snmp_oid/> | |
<key>mysql.db.discovery</key> | |
<delay>30</delay> | |
<status>0</status> | |
<allowed_hosts/> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<filter>:</filter> | |
<lifetime>30</lifetime> | |
<description/> | |
<item_prototypes> | |
<item_prototype> | |
<name>{#DBNAME} size</name> | |
<type>7</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>mysql.db.size[{#DBNAME}]</key> | |
<delay>60</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>3</value_type> | |
<allowed_hosts/> | |
<units/> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name>MySQL</name> | |
</application> | |
</applications> | |
<valuemap/> | |
</item_prototype> | |
</item_prototypes> | |
<trigger_prototypes/> | |
<graph_prototypes> | |
<graph_prototype> | |
<name>Database size ({#DBNAME})</name> | |
<width>900</width> | |
<height>200</height> | |
<yaxismin>0.0000</yaxismin> | |
<yaxismax>100.0000</yaxismax> | |
<show_work_period>1</show_work_period> | |
<show_triggers>1</show_triggers> | |
<type>0</type> | |
<show_legend>1</show_legend> | |
<show_3d>0</show_3d> | |
<percent_left>0.0000</percent_left> | |
<percent_right>0.0000</percent_right> | |
<ymin_type_1>0</ymin_type_1> | |
<ymax_type_1>0</ymax_type_1> | |
<ymin_item_1>0</ymin_item_1> | |
<ymax_item_1>0</ymax_item_1> | |
<graph_items> | |
<graph_item> | |
<sortorder>0</sortorder> | |
<drawtype>2</drawtype> | |
<color>C80000</color> | |
<yaxisside>0</yaxisside> | |
<calc_fnc>2</calc_fnc> | |
<type>0</type> | |
<item> | |
<host>Template_App_MySQL</host> | |
<key>mysql.db.size[{#DBNAME}]</key> | |
</item> | |
</graph_item> | |
</graph_items> | |
</graph_prototype> | |
</graph_prototypes> | |
<host_prototypes/> | |
</discovery_rule> | |
</discovery_rules> | |
<macros/> | |
<templates/> | |
<screens> | |
<screen> | |
<name>MySQL performance</name> | |
<hsize>2</hsize> | |
<vsize>1</vsize> | |
<screen_items> | |
<screen_item> | |
<resourcetype>0</resourcetype> | |
<width>500</width> | |
<height>200</height> | |
<x>0</x> | |
<y>0</y> | |
<colspan>1</colspan> | |
<rowspan>1</rowspan> | |
<elements>0</elements> | |
<valign>1</valign> | |
<halign>0</halign> | |
<style>0</style> | |
<url/> | |
<dynamic>0</dynamic> | |
<sort_triggers>0</sort_triggers> | |
<resource> | |
<name>MySQL operations</name> | |
<host>Template_App_MySQL</host> | |
</resource> | |
<application/> | |
</screen_item> | |
<screen_item> | |
<resourcetype>0</resourcetype> | |
<width>500</width> | |
<height>270</height> | |
<x>1</x> | |
<y>0</y> | |
<colspan>1</colspan> | |
<rowspan>1</rowspan> | |
<elements>0</elements> | |
<valign>1</valign> | |
<halign>0</halign> | |
<style>0</style> | |
<url/> | |
<dynamic>0</dynamic> | |
<sort_triggers>0</sort_triggers> | |
<resource> | |
<name>MySQL bandwidth</name> | |
<host>Template_App_MySQL</host> | |
</resource> | |
<application/> | |
</screen_item> | |
</screen_items> | |
</screen> | |
</screens> | |
</template> | |
</templates> | |
<triggers> | |
<trigger> | |
<expression>{Template_App_MySQL:mysql.ping.last(0)}=0</expression> | |
<name>MySQL is down</name> | |
<url/> | |
<status>0</status> | |
<priority>2</priority> | |
<description/> | |
<type>0</type> | |
<dependencies/> | |
</trigger> | |
</triggers> | |
<graphs> | |
<graph> | |
<name>MySQL bandwidth</name> | |
<width>900</width> | |
<height>200</height> | |
<yaxismin>0.0000</yaxismin> | |
<yaxismax>100.0000</yaxismax> | |
<show_work_period>1</show_work_period> | |
<show_triggers>1</show_triggers> | |
<type>0</type> | |
<show_legend>1</show_legend> | |
<show_3d>0</show_3d> | |
<percent_left>0.0000</percent_left> | |
<percent_right>0.0000</percent_right> | |
<ymin_type_1>1</ymin_type_1> | |
<ymax_type_1>0</ymax_type_1> | |
<ymin_item_1>0</ymin_item_1> | |
<ymax_item_1>0</ymax_item_1> | |
<graph_items> | |
<graph_item> | |
<sortorder>0</sortorder> | |
<drawtype>5</drawtype> | |
<color>00AA00</color> | |
<yaxisside>0</yaxisside> | |
<calc_fnc>2</calc_fnc> | |
<type>0</type> | |
<item> | |
<host>Template_App_MySQL</host> | |
<key>mysql.status[Bytes_received]</key> | |
</item> | |
</graph_item> | |
<graph_item> | |
<sortorder>1</sortorder> | |
<drawtype>5</drawtype> | |
<color>3333FF</color> | |
<yaxisside>0</yaxisside> | |
<calc_fnc>2</calc_fnc> | |
<type>0</type> | |
<item> | |
<host>Template_App_MySQL</host> | |
<key>mysql.status[Bytes_sent]</key> | |
</item> | |
</graph_item> | |
</graph_items> | |
</graph> | |
<graph> | |
<name>MySQL operations</name> | |
<width>900</width> | |
<height>200</height> | |
<yaxismin>0.0000</yaxismin> | |
<yaxismax>100.0000</yaxismax> | |
<show_work_period>1</show_work_period> | |
<show_triggers>1</show_triggers> | |
<type>0</type> | |
<show_legend>1</show_legend> | |
<show_3d>0</show_3d> | |
<percent_left>0.0000</percent_left> | |
<percent_right>0.0000</percent_right> | |
<ymin_type_1>1</ymin_type_1> | |
<ymax_type_1>0</ymax_type_1> | |
<ymin_item_1>0</ymin_item_1> | |
<ymax_item_1>0</ymax_item_1> | |
<graph_items> | |
<graph_item> | |
<sortorder>1</sortorder> | |
<drawtype>0</drawtype> | |
<color>C8C800</color> | |
<yaxisside>0</yaxisside> | |
<calc_fnc>2</calc_fnc> | |
<type>0</type> | |
<item> | |
<host>Template_App_MySQL</host> | |
<key>mysql.status[Com_begin]</key> | |
</item> | |
</graph_item> | |
<graph_item> | |
<sortorder>2</sortorder> | |
<drawtype>0</drawtype> | |
<color>006400</color> | |
<yaxisside>0</yaxisside> | |
<calc_fnc>2</calc_fnc> | |
<type>0</type> | |
<item> | |
<host>Template_App_MySQL</host> | |
<key>mysql.status[Com_commit]</key> | |
</item> | |
</graph_item> | |
<graph_item> | |
<sortorder>3</sortorder> | |
<drawtype>0</drawtype> | |
<color>C80000</color> | |
<yaxisside>0</yaxisside> | |
<calc_fnc>2</calc_fnc> | |
<type>0</type> | |
<item> | |
<host>Template_App_MySQL</host> | |
<key>mysql.status[Com_delete]</key> | |
</item> | |
</graph_item> | |
<graph_item> | |
<sortorder>4</sortorder> | |
<drawtype>0</drawtype> | |
<color>0000EE</color> | |
<yaxisside>0</yaxisside> | |
<calc_fnc>2</calc_fnc> | |
<type>0</type> | |
<item> | |
<host>Template_App_MySQL</host> | |
<key>mysql.status[Com_insert]</key> | |
</item> | |
</graph_item> | |
<graph_item> | |
<sortorder>5</sortorder> | |
<drawtype>0</drawtype> | |
<color>640000</color> | |
<yaxisside>0</yaxisside> | |
<calc_fnc>2</calc_fnc> | |
<type>0</type> | |
<item> | |
<host>Template_App_MySQL</host> | |
<key>mysql.status[Com_rollback]</key> | |
</item> | |
</graph_item> | |
<graph_item> | |
<sortorder>6</sortorder> | |
<drawtype>0</drawtype> | |
<color>00C800</color> | |
<yaxisside>0</yaxisside> | |
<calc_fnc>2</calc_fnc> | |
<type>0</type> | |
<item> | |
<host>Template_App_MySQL</host> | |
<key>mysql.status[Com_select]</key> | |
</item> | |
</graph_item> | |
<graph_item> | |
<sortorder>7</sortorder> | |
<drawtype>0</drawtype> | |
<color>C800C8</color> | |
<yaxisside>0</yaxisside> | |
<calc_fnc>2</calc_fnc> | |
<type>0</type> | |
<item> | |
<host>Template_App_MySQL</host> | |
<key>mysql.status[Com_update]</key> | |
</item> | |
</graph_item> | |
<graph_item> | |
<sortorder>0</sortorder> | |
<drawtype>2</drawtype> | |
<color>960000</color> | |
<yaxisside>0</yaxisside> | |
<calc_fnc>7</calc_fnc> | |
<type>0</type> | |
<item> | |
<host>Template_App_MySQL</host> | |
<key>mysql.status[Questions]</key> | |
</item> | |
</graph_item> | |
</graph_items> | |
</graph> | |
</graphs> | |
</zabbix_export> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For all the following commands HOME should be set to the directory that has .my.cnf file with password information. | |
# Flexible parameter to grab global variables. On the frontend side, use keys like mysql.status[Com_insert]. | |
# Key syntax is mysql.status[variable]. | |
UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | HOME=/var/lib/zabbix mysql -N | awk '{print $$2}' | |
# Flexible parameter to determine database or table size. On the frontend side, use keys like mysql.size[zabbix,history,data]. | |
# Key syntax is mysql.size[<database>,<table>,<type>]. | |
# Database may be a database name or "all". Default is "all". | |
# Table may be a table name or "all". Default is "all". | |
# Type may be "data", "index", "free" or "both". Both is a sum of data and index. Default is "both". | |
# Database is mandatory if a table is specified. Type may be specified always. | |
# Returns value in bytes. | |
# 'sum' on data_length or index_length alone needed when we are getting this information for whole database instead of a single table | |
UserParameter=mysql.db.discovery,$HOME/mysql_statics.sh | |
UserParameter=mysql.db.size[*],$HOME/mysql_statics.sh $1 | |
UserParameter=mysql.ping,/usr/bin/mysqladmin ping | grep -c alive | |
UserParameter=mysql.version,mysql -V | |
UserParameter=mysql.teste,mysqladmin ping |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment