Skip to content

Commit

Permalink
Service MySQL: merge some changes already present in Nginx, php-fpm:
Browse files Browse the repository at this point in the history
- Items:
  - PROC::mysqld
    - change hardcoded MySQL process name to the macro {$SVC_MYSQL_PROC}
    - add "proceses" missing unit
  - "version" add "Discard unchanged with hartbeat" filter which allows
    change sampling rate from 1d to 5min with HB preriod 7d
- Triggers:
  - "SYS::processes::{$SVC_MYSQL_PROC} is not running" severity changed
    to disaster
- Add use md markups in template description
  • Loading branch information
kloczek committed Aug 9, 2019
1 parent 0786629 commit 1172df1
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 28 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@ This repository provides a set of templates which offers the alternative set of
- Macro ```{$HTTP_SERVICE_PROCESS}```: has bee nadded to allow easy use it on Debian/Ubuntu. Default value is ```http```. On Ubuntu/Debian that value needs to be changed to ```apache2```
- Triggers:
- rename ```SVC::Apache tcp/{$HTTP_SERVICE_PORT} is DOWN``` to ```NET::Apache tcp/{$HTTP_SERVICE_PORT} is DOWN```
- **Service MySQL**
- Items:
- ```PROC::mysqld```
- change hardcoded MySQL process name to the macro ``{$SVC_MYSQL_PROC}```
- add missing "processes" unit
- ```version``` add ```Discard unchanged with hartbeat``` filter which allows
change sampling rate from 1d to 5min with HB preriod 7d
- Triggers:
- ```SYS::processes::{$SVC_MYSQL_PROC} is not running``` severity changed
to disaster
- Add use md markups in template description
- **Service Nginx**
- Macros:
- Rename ```{$NGINX_*}``` macros to ```{$SVC_NGINX_*}```
Expand Down
41 changes: 27 additions & 14 deletions Service MySQL/README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,46 @@
#### Version: 1.0.4 (2018-06-11)

#### Description:
MySQL engine monitoring over Zabbix agent.

#### Version: (devel)
URL: https://github.com/kloczek/zabbix-templates/tree/master/Service%20MySQL

| Macro | Default value | Description |
| :-- | :-- | :-- |
| {$SVC_MYSQL_CMD} | HOME=/var/lib/zabbix /usr/bin/mysql --login-path=monitoring -Nse | mysql command used in system.run[] keys |
| {$SVC_MYSQL_PROC} | mysqld | MySQL process name |

#### Notes:
- Tested on MySQL 5.7 and it not uses MySQL 5.6 backward compatibility. The
template requires to disable MySQL 5.6 backward compatibility and it will
raise alarm that show_compatibility_56 is OFF. To disable MySQL 5.6
backward compatibility best to add in my.cnf:
* Tested on MySQL 5.7 and it not designed to be uses with MySQL older than 5.7 backward compatibility so it can be used to monitor MySQL engine which in my.cnf has:
```
[mysqld]
show_compatibility_56=OFF
show_compatibility_56 = OFF
```
- By default this template is monitoring the engine working on localhost
- To be able to use this template on a host you need to setup a monitoring account with the proper privileges. To add such account you can use below queries:
My advice is even to disable show_compatibility_56 to not start by mistake use some older metrics which in next version of the MySQL no longer will be available as an option.
* By default this template is monitoring the engine working on localhost.
* To be able to use this template on a host you need to setup a monitoring account with the proper privileges.
* To add such account you can use below queries:
```
CREATE USER 'monitoring'@'localhost' IDENTIFIED BY 'monitoring';
GRANT SELECT, INDEX, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'monitoring'@'localhost';
FLUSH PRIVILEGES;
```
- MySQL 5.7 documentation:
- http://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html
- http://dev.mysql.com/doc/refman/5.7/en/innodb-configuration.html
- http://dev.mysql.com/doc/refman/5.7/en/innodb-information-schema.html
* MySQL 5.7 documentation:
http://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html
http://dev.mysql.com/doc/refman/5.7/en/innodb-configuration.html
http://dev.mysql.com/doc/refman/5.7/en/innodb-information-schema.html

#### Changelog:
- (devel):
- Items:
- make template zabbix 4.0.x ready by remove using $1-$9 macros in items names
- ```PROC::mysqld```
- change hardcoded MySQL process name to the macro ``{$SVC_MYSQL_PROC}```
- add missing "processes" unit
- ```version``` add ```Discard unchanged with hartbeat``` filter which allows
change sampling rate from 1d to 5min with HB preriod 7d
- Triggers:
- ```SYS::processes::{$SVC_MYSQL_PROC} is not running`` severity changed
to disaster
- Add use md markups in template description
- 1.0.4 (2018-06-11):
- Applications:
- new ```SVC::MySQL::cfg``` for all read configuration parameters
Expand Down
43 changes: 29 additions & 14 deletions Service MySQL/Service MySQL.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>4.2</version>
<date>2019-06-03T14:55:01Z</date>
<date>2019-08-09T15:37:41Z</date>
<groups>
<group>
<name>Templates</name>
Expand All @@ -13,20 +13,24 @@
<name>Service MySQL</name>
<description>MySQL engine monitoring over Zabbix agent.&#13;
&#13;
Version: 1.0.4 (2018-06-11)&#13;
#### Version: (devel)&#13;
URL: https://github.com/kloczek/zabbix-templates/tree/master/Service%20MySQL&#13;
&#13;
| Macro | Default value | Description |&#13;
| :-- | :-- | :-- |&#13;
| {$SVC_MYSQL_CMD} | HOME=/var/lib/zabbix /usr/bin/mysql --login-path=monitoring -Nse | mysql command used in system.run[] keys |&#13;
| {$SVC_MYSQL_PROC} | mysqld | MySQL process name |&#13;
&#13;
#### Notes:&#13;
* Tested on MySQL 5.7 and it not designed to be uses with MySQL older than 5.7 backward compatibility so it can be used to monitor MySQL engine which in my.cnf has:&#13;
```&#13;
[mysqld]&#13;
show_compatibility_56 = OFF &#13;
```&#13;
My advice is even to disable show_compatibility_56 to not start by mistake use some older metrics which in next version of the MySQL no longer will be available as an option.&#13;
&#13;
* By default this template is monitoring the engine working on localhost.&#13;
To be able to use this template on a host you need to setup a monitoring account with the proper privileges.&#13;
To add such account you can use below queries:&#13;
* To be able to use this template on a host you need to setup a monitoring account with the proper privileges.&#13;
* To add such account you can use below queries:&#13;
```&#13;
CREATE USER 'monitoring'@'localhost' IDENTIFIED BY 'monitoring';&#13;
GRANT SELECT, INDEX, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'monitoring'@'localhost';&#13;
Expand Down Expand Up @@ -70,14 +74,14 @@ http://dev.mysql.com/doc/refman/5.7/en/innodb-information-schema.html</descripti
<type>7</type>
<snmp_community/>
<snmp_oid/>
<key>proc.num[mysqld]</key>
<key>proc.num[{$SVC_MYSQL_PROC}]</key>
<delay>1m</delay>
<history>2w</history>
<trends>365d</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<units>processes</units>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
Expand All @@ -93,7 +97,7 @@ http://dev.mysql.com/doc/refman/5.7/en/innodb-information-schema.html</descripti
<publickey/>
<privatekey/>
<port/>
<description/>
<description>Number MySQL processes.</description>
<inventory_link>0</inventory_link>
<applications>
<application>
Expand Down Expand Up @@ -4573,7 +4577,7 @@ This level is like REPEATABLE READ, but InnoDB implicitly converts all plain SEL
<snmp_community/>
<snmp_oid/>
<key>system.run[{$MYSQL_CMD} "SELECT variable_value FROM performance_schema.global_variables WHERE variable_name='version';",]</key>
<delay>1d</delay>
<delay>5m</delay>
<history>2w</history>
<trends>0</trends>
<status>0</status>
Expand Down Expand Up @@ -4604,7 +4608,14 @@ This level is like REPEATABLE READ, but InnoDB implicitly converts all plain SEL
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing/>
<preprocessing>
<step>
<type>20</type>
<params>7d</params>
<error_handler>0</error_handler>
<error_handler_params/>
</step>
</preprocessing>
<jmx_endpoint/>
<timeout>3s</timeout>
<url/>
Expand Down Expand Up @@ -4928,6 +4939,10 @@ SELECT variable_value FROM information_schema.global_status WHERE variable_name
<macro>{$MYSQL_CMD}</macro>
<value>HOME=/var/lib/zabbix /usr/bin/mysql --login-path=monitoring -Nse</value>
</macro>
<macro>
<macro>{$SVC_MYSQL_PROC}</macro>
<value>mysqld</value>
</macro>
</macros>
<templates/>
<screens>
Expand Down Expand Up @@ -5372,16 +5387,16 @@ Possible restart has been done.</description>
<tags/>
</trigger>
<trigger>
<expression>{Service MySQL:proc.num[mysqld].last(0)}&lt;1</expression>
<expression>{Service MySQL:proc.num[{$SVC_MYSQL_PROC}].last(0)}&lt;1</expression>
<recovery_mode>0</recovery_mode>
<recovery_expression/>
<name>SYS::processes::mysqld is not running</name>
<name>SYS::processes::{$SVC_MYSQL_PROC} is not running</name>
<correlation_mode>0</correlation_mode>
<correlation_tag/>
<url/>
<status>0</status>
<priority>4</priority>
<description/>
<priority>5</priority>
<description>The MySQL process is not running.</description>
<type>0</type>
<manual_close>0</manual_close>
<dependencies/>
Expand Down

0 comments on commit 1172df1

Please sign in to comment.