Additional scripts for Zabbix agent on Linux to discover and monitor several services
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

1195 lines
50 KiB

<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>5.0</version>
<date>2021-09-22T16:01:48Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
<template>
<template>Template_App_MySQL</template>
<name>Template_App_MySQL</name>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<items>
<item>
<name>MySQL: Aborted client connections</name>
<type>DEPENDENT</type>
<key>db.mysql[Aborted_clients]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<units>!connections</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Aborted_clients</params>
</step>
<step>
<type>SIMPLE_CHANGE</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: Aborted connections</name>
<type>DEPENDENT</type>
<key>db.mysql[Aborted_connects]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<units>!conn</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Aborted_connects</params>
</step>
<step>
<type>SIMPLE_CHANGE</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: Denied access</name>
<type>DEPENDENT</type>
<key>db.mysql[Access_denied_errors]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<units>!connections</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JAVASCRIPT</type>
<params>json = JSON.parse(value);
return json.Access_denied_errors || 0;</params>
</step>
<step>
<type>SIMPLE_CHANGE</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: Number of users</name>
<type>DEPENDENT</type>
<key>db.mysql[Acl_users]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<units>!users</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JAVASCRIPT</type>
<params>json = JSON.parse(value);
return json.Acl_users || 0;</params>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: Received bytes</name>
<type>DEPENDENT</type>
<key>db.mysql[Bytes_received]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<units>B/s</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Bytes_received</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: Sent bytes</name>
<type>DEPENDENT</type>
<key>db.mysql[Bytes_sent]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<units>B/s</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Bytes_sent</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: Admin commands</name>
<type>DEPENDENT</type>
<key>db.mysql[Com_admin_commands]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<value_type>FLOAT</value_type>
<units>!qps</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Com_admin_commands</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: ALTER USER commands</name>
<type>DEPENDENT</type>
<key>db.mysql[Com_alter_user]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<value_type>FLOAT</value_type>
<units>!qps</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JAVASCRIPT</type>
<params>json = JSON.parse(value);
return json.Com_alter_user || 0;</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: BEGIN commands</name>
<type>DEPENDENT</type>
<key>db.mysql[Com_begin]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<value_type>FLOAT</value_type>
<units>!qps</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Com_begin</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: COMMIT commands</name>
<type>DEPENDENT</type>
<key>db.mysql[Com_commit]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<value_type>FLOAT</value_type>
<units>!qps</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Com_commit</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: CREATE USER commands</name>
<type>DEPENDENT</type>
<key>db.mysql[Com_create_user]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<value_type>FLOAT</value_type>
<units>!qps</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Com_create_user</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: DELETE commands</name>
<type>DEPENDENT</type>
<key>db.mysql[Com_delete]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<value_type>FLOAT</value_type>
<units>!qps</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Com_delete</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: INSERT commands</name>
<type>DEPENDENT</type>
<key>db.mysql[Com_insert]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<value_type>FLOAT</value_type>
<units>!qps</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Com_insert</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: PREPARE statements</name>
<type>DEPENDENT</type>
<key>db.mysql[Com_prepare_sql]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<value_type>FLOAT</value_type>
<units>!qps</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Com_prepare_sql</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: ROLLBACK commands</name>
<type>DEPENDENT</type>
<key>db.mysql[Com_rollback]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<value_type>FLOAT</value_type>
<units>!qps</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Com_rollback</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: SELECT commands</name>
<type>DEPENDENT</type>
<key>db.mysql[Com_select]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<value_type>FLOAT</value_type>
<units>!qps</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Com_select</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: UPDATE commands</name>
<type>DEPENDENT</type>
<key>db.mysql[Com_update]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<value_type>FLOAT</value_type>
<units>!qps</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Com_update</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: Number of connection attempts</name>
<type>DEPENDENT</type>
<key>db.mysql[Connections]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<units>!conn</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Connections</params>
</step>
<step>
<type>SIMPLE_CHANGE</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: InnoDB buffer pool size</name>
<type>DEPENDENT</type>
<key>db.mysql[Innodb_buffer_pool_bytes_data]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<units>B</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Innodb_buffer_pool_bytes_data</params>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: InnoDB dirty buffer pool size</name>
<type>DEPENDENT</type>
<key>db.mysql[Innodb_buffer_pool_bytes_dirty]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<units>B</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Innodb_buffer_pool_bytes_dirty</params>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: InnoDB buffer pool status</name>
<type>DEPENDENT</type>
<key>db.mysql[Innodb_buffer_pool_load_status]</key>
<delay>0</delay>
<history>30d</history>
<trends>0</trends>
<value_type>CHAR</value_type>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JAVASCRIPT</type>
<params>json = JSON.parse(value);
return json.Innodb_buffer_pool_load_status || 'Buffer pool(s) load completed at';</params>
</step>
<step>
<type>DISCARD_UNCHANGED_HEARTBEAT</type>
<params>6h</params>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
<triggers>
<trigger>
<expression>{str(&quot;Buffer pool(s) load completed at&quot;)}=0 and {str(&quot;not started&quot;)}=0</expression>
<name>MySQL InnoDB buffer pool is not ready</name>
<priority>WARNING</priority>
</trigger>
</triggers>
</item>
<item>
<name>MySQL: InnoDB reads not served by the buffer pool</name>
<type>DEPENDENT</type>
<key>db.mysql[Innodb_buffer_pool_reads]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<value_type>FLOAT</value_type>
<units>!reads</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Innodb_buffer_pool_reads</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: InnoDB data fsync</name>
<type>DEPENDENT</type>
<key>db.mysql[Innodb_data_fsyncs]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<value_type>FLOAT</value_type>
<units>!fsync/s</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Innodb_data_fsyncs</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: InnoDB log fsync</name>
<type>DEPENDENT</type>
<key>db.mysql[Innodb_os_log_fsyncs]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<value_type>FLOAT</value_type>
<units>!fsync/s</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Innodb_os_log_fsyncs</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: Queries that exceeded the execution time</name>
<type>DEPENDENT</type>
<key>db.mysql[Max_statement_time_exceeded]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<value_type>FLOAT</value_type>
<units>!qps</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JAVASCRIPT</type>
<params>json = JSON.parse(value);
return json.Max_statement_time_exceeded || 0;</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: Global memory usage</name>
<type>DEPENDENT</type>
<key>db.mysql[Memory_used]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<units>B</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JAVASCRIPT</type>
<params>json = JSON.parse(value);
return json.Memory_used || 0;</params>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: Opened files</name>
<type>DEPENDENT</type>
<key>db.mysql[Open_files]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<units>!files</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Open_files</params>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: Opened tables</name>
<type>DEPENDENT</type>
<key>db.mysql[Open_tables]</key>
<delay>0</delay>
<history>30d</history>
<trends>1825d</trends>
<units>!tables</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Open_tables</params>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: Requests served from the cache</name>
<type>DEPENDENT</type>
<key>db.mysql[Qcache_hits]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<value_type>FLOAT</value_type>
<units>!qps</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Qcache_hits</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: Total queries</name>
<type>DEPENDENT</type>
<key>db.mysql[Queries]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<value_type>FLOAT</value_type>
<units>!qps</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Queries</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
<triggers>
<trigger>
<expression>{avg(1h)}&gt;10*{avg(24h)}</expression>
<name>More MySQL queries than usual</name>
<priority>INFO</priority>
</trigger>
</triggers>
</item>
<item>
<name>MySQL: Slow queries</name>
<type>DEPENDENT</type>
<key>db.mysql[Slow_queries]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<value_type>FLOAT</value_type>
<units>!qps</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Slow_queries</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
<triggers>
<trigger>
<expression>{last()}&gt;{$MYSQL_SLOW_QUERIES_THRES}</expression>
<name>Too many slow queries</name>
<priority>WARNING</priority>
</trigger>
</triggers>
</item>
<item>
<name>MySQL: Active connections</name>
<type>DEPENDENT</type>
<key>db.mysql[Threads_running]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<units>!conn</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Threads_running</params>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
</item>
<item>
<name>MySQL: $1</name>
<type>DEPENDENT</type>
<key>db.mysql[Uptime]</key>
<delay>0</delay>
<history>30d</history>
<trends>1095d</trends>
<units>s</units>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.Uptime</params>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
<triggers>
<trigger>
<expression>{last()}&lt;1800</expression>
<name>MySQL service just restarted</name>
<priority>INFO</priority>
</trigger>
</triggers>
</item>
<item>
<name>MySQL: Monitoring error</name>
<type>DEPENDENT</type>
<key>db.mysql[zbx_error]</key>
<delay>0</delay>
<history>30d</history>
<trends>0</trends>
<value_type>CHAR</value_type>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.zbx_error</params>
</step>
</preprocessing>
<master_item>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
</master_item>
<triggers>
<trigger>
<expression>{last()}&lt;&gt;&quot;none&quot;</expression>
<name>Error occured while monitoring MySQL service</name>
<priority>WARNING</priority>
<manual_close>YES</manual_close>
</trigger>
</triggers>
</item>
<item>
<name>MySQL info</name>
<key>db.mysql[{$MYSQL_HOST},{$MYSQL_PORT},{$MYSQL_USER},{$MYSQL_PASSWORD},{$MYSQL_DEFAULTS},all]</key>
<delay>5m</delay>
<history>0</history>
<trends>0</trends>
<value_type>TEXT</value_type>
<applications>
<application>
<name>mysql</name>
</application>
</applications>
</item>
</items>
<macros>
<macro>
<macro>{$MYSQL_DEFAULTS}</macro>
<value>/root/.my.cnf</value>
<description>File where defaults will be read</description>
</macro>
<macro>
<macro>{$MYSQL_HOST}</macro>
<value>localhost</value>
<description>Host to connect to</description>
</macro>
<macro>
<macro>{$MYSQL_PASSWORD}</macro>
<type>SECRET_TEXT</type>
<description>Password</description>
</macro>
<macro>
<macro>{$MYSQL_PORT}</macro>
<value>3306</value>
<description>Port of the MySQL server</description>
</macro>
<macro>
<macro>{$MYSQL_SLOW_QUERIES_THRES}</macro>
<value>10</value>
<description>Number of slow queries (in qps) before alerting</description>
</macro>
<macro>
<macro>{$MYSQL_USER}</macro>
<value>root</value>
<description>User to authenticate as</description>
</macro>
</macros>
</template>
</templates>
<triggers>
<trigger>
<expression>{Template_App_MySQL:db.mysql[Acl_users].change()}=1 or {Template_App_MySQL:db.mysql[Com_alter_user].last()}&gt;0 or {Template_App_MySQL:db.mysql[Com_create_user].last()}&gt;0</expression>
<recovery_mode>NONE</recovery_mode>
<name>MySQL users modified</name>
<priority>WARNING</priority>
<manual_close>YES</manual_close>
</trigger>
</triggers>
<graphs>
<graph>
<name>MySQL : InnoDB buffer pool</name>
<graph_items>
<graph_item>
<sortorder>1</sortorder>
<drawtype>GRADIENT_LINE</drawtype>
<color>EF5350</color>
<item>
<host>Template_App_MySQL</host>
<key>db.mysql[Innodb_buffer_pool_bytes_dirty]</key>
</item>
</graph_item>
<graph_item>
<sortorder>2</sortorder>
<drawtype>GRADIENT_LINE</drawtype>
<color>FFCDD2</color>
<item>
<host>Template_App_MySQL</host>
<key>db.mysql[Innodb_buffer_pool_bytes_data]</key>
</item>
</graph_item>
</graph_items>
</graph>
<graph>
<name>MySQL : InnoDB fsyncs</name>
<type>STACKED</type>
<graph_items>
<graph_item>
<sortorder>1</sortorder>
<color>7E57C2</color>
<item>
<host>Template_App_MySQL</host>
<key>db.mysql[Innodb_data_fsyncs]</key>
</item>
</graph_item>
<graph_item>
<sortorder>2</sortorder>
<color>81D4FA</color>
<item>
<host>Template_App_MySQL</host>
<key>db.mysql[Innodb_os_log_fsyncs]</key>
</item>
</graph_item>
</graph_items>
</graph>
<graph>
<name>MySQL : Network</name>
<graph_items>
<graph_item>
<sortorder>1</sortorder>
<drawtype>GRADIENT_LINE</drawtype>
<color>1A7C11</color>
<item>
<host>Template_App_MySQL</host>
<key>db.mysql[Bytes_sent]</key>
</item>
</graph_item>
<graph_item>
<sortorder>2</sortorder>
<drawtype>GRADIENT_LINE</drawtype>
<color>F63100</color>
<item>
<host>Template_App_MySQL</host>
<key>db.mysql[Bytes_received]</key>
</item>
</graph_item>
</graph_items>
</graph>
<graph>
<name>MySQL : Queries</name>
<type>STACKED</type>
<graph_items>
<graph_item>
<sortorder>1</sortorder>
<color>C5E1A5</color>
<item>
<host>Template_App_MySQL</host>
<key>db.mysql[Com_select]</key>
</item>
</graph_item>
<graph_item>
<sortorder>2</sortorder>
<color>BBDEFB</color>
<item>
<host>Template_App_MySQL</host>
<key>db.mysql[Com_insert]</key>
</item>
</graph_item>
<graph_item>
<sortorder>3</sortorder>
<color>FFE082</color>
<item>
<host>Template_App_MySQL</host>
<key>db.mysql[Com_update]</key>
</item>
</graph_item>
<graph_item>
<sortorder>4</sortorder>
<color>0097A7</color>
<item>
<host>Template_App_MySQL</host>
<key>db.mysql[Com_begin]</key>
</item>
</graph_item>
<graph_item>
<sortorder>5</sortorder>
<color>B0BEC5</color>
<item>
<host>Template_App_MySQL</host>
<key>db.mysql[Com_commit]</key>
</item>
</graph_item>
<graph_item>
<sortorder>6</sortorder>
<color>F230E0</color>
<item>
<host>Template_App_MySQL</host>
<key>db.mysql[Com_rollback]</key>
</item>
</graph_item>
<graph_item>
<sortorder>7</sortorder>
<color>F63100</color>
<item>
<host>Template_App_MySQL</host>
<key>db.mysql[Com_prepare_sql]</key>
</item>
</graph_item>
<graph_item>
<sortorder>8</sortorder>
<color>1A7C11</color>
<item>
<host>Template_App_MySQL</host>
<key>db.mysql[Com_delete]</key>
</item>
</graph_item>
<graph_item>
<sortorder>9</sortorder>
<color>6C59DC</color>
<item>
<host>Template_App_MySQL</host>
<key>db.mysql[Com_admin_commands]</key>
</item>
</graph_item>
</graph_items>
</graph>
<graph>
<name>MySQL : Slow and total queries</name>
<graph_items>
<graph_item>
<sortorder>1</sortorder>
<drawtype>BOLD_LINE</drawtype>
<color>1A7C11</color>
<item>
<host>Template_App_MySQL</host>
<key>db.mysql[Queries]</key>
</item>
</graph_item>
<graph_item>
<sortorder>2</sortorder>
<drawtype>BOLD_LINE</drawtype>
<color>F63100</color>
<item>
<host>Template_App_MySQL</host>
<key>db.mysql[Slow_queries]</key>
</item>
</graph_item>
</graph_items>
</graph>
</graphs>
</zabbix_export>