Skip to content

Commit 1172df1

Browse files
committed
Service MySQL: merge some changes already present in Nginx, php-fpm:
- 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
1 parent 0786629 commit 1172df1

File tree

3 files changed

+67
-28
lines changed

3 files changed

+67
-28
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,17 @@ This repository provides a set of templates which offers the alternative set of
101101
- 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```
102102
- Triggers:
103103
- rename ```SVC::Apache tcp/{$HTTP_SERVICE_PORT} is DOWN``` to ```NET::Apache tcp/{$HTTP_SERVICE_PORT} is DOWN```
104+
- **Service MySQL**
105+
- Items:
106+
- ```PROC::mysqld```
107+
- change hardcoded MySQL process name to the macro ``{$SVC_MYSQL_PROC}```
108+
- add missing "processes" unit
109+
- ```version``` add ```Discard unchanged with hartbeat``` filter which allows
110+
change sampling rate from 1d to 5min with HB preriod 7d
111+
- Triggers:
112+
- ```SYS::processes::{$SVC_MYSQL_PROC} is not running``` severity changed
113+
to disaster
114+
- Add use md markups in template description
104115
- **Service Nginx**
105116
- Macros:
106117
- Rename ```{$NGINX_*}``` macros to ```{$SVC_NGINX_*}```

Service MySQL/README.md

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,46 @@
1-
#### Version: 1.0.4 (2018-06-11)
2-
3-
#### Description:
41
MySQL engine monitoring over Zabbix agent.
52

3+
#### Version: (devel)
4+
URL: https://github.com/kloczek/zabbix-templates/tree/master/Service%20MySQL
5+
6+
| Macro | Default value | Description |
7+
| :-- | :-- | :-- |
8+
| {$SVC_MYSQL_CMD} | HOME=/var/lib/zabbix /usr/bin/mysql --login-path=monitoring -Nse | mysql command used in system.run[] keys |
9+
| {$SVC_MYSQL_PROC} | mysqld | MySQL process name |
10+
611
#### Notes:
7-
- Tested on MySQL 5.7 and it not uses MySQL 5.6 backward compatibility. The
8-
template requires to disable MySQL 5.6 backward compatibility and it will
9-
raise alarm that show_compatibility_56 is OFF. To disable MySQL 5.6
10-
backward compatibility best to add in my.cnf:
12+
* 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:
1113
```
1214
[mysqld]
13-
show_compatibility_56=OFF
15+
show_compatibility_56 = OFF
1416
```
15-
- By default this template is monitoring the engine working on localhost
16-
- 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:
17+
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.
18+
* By default this template is monitoring the engine working on localhost.
19+
* To be able to use this template on a host you need to setup a monitoring account with the proper privileges.
20+
* To add such account you can use below queries:
1721
```
1822
CREATE USER 'monitoring'@'localhost' IDENTIFIED BY 'monitoring';
1923
GRANT SELECT, INDEX, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'monitoring'@'localhost';
2024
FLUSH PRIVILEGES;
2125
```
22-
- MySQL 5.7 documentation:
23-
- http://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html
24-
- http://dev.mysql.com/doc/refman/5.7/en/innodb-configuration.html
25-
- http://dev.mysql.com/doc/refman/5.7/en/innodb-information-schema.html
26+
* MySQL 5.7 documentation:
27+
http://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html
28+
http://dev.mysql.com/doc/refman/5.7/en/innodb-configuration.html
29+
http://dev.mysql.com/doc/refman/5.7/en/innodb-information-schema.html
2630

2731
#### Changelog:
2832
- (devel):
2933
- Items:
3034
- make template zabbix 4.0.x ready by remove using $1-$9 macros in items names
35+
- ```PROC::mysqld```
36+
- change hardcoded MySQL process name to the macro ``{$SVC_MYSQL_PROC}```
37+
- add missing "processes" unit
38+
- ```version``` add ```Discard unchanged with hartbeat``` filter which allows
39+
change sampling rate from 1d to 5min with HB preriod 7d
40+
- Triggers:
41+
- ```SYS::processes::{$SVC_MYSQL_PROC} is not running`` severity changed
42+
to disaster
43+
- Add use md markups in template description
3144
- 1.0.4 (2018-06-11):
3245
- Applications:
3346
- new ```SVC::MySQL::cfg``` for all read configuration parameters

Service MySQL/Service MySQL.xml

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<zabbix_export>
33
<version>4.2</version>
4-
<date>2019-06-03T14:55:01Z</date>
4+
<date>2019-08-09T15:37:41Z</date>
55
<groups>
66
<group>
77
<name>Templates</name>
@@ -13,20 +13,24 @@
1313
<name>Service MySQL</name>
1414
<description>MySQL engine monitoring over Zabbix agent.&#13;
1515
&#13;
16-
Version: 1.0.4 (2018-06-11)&#13;
16+
#### Version: (devel)&#13;
1717
URL: https://github.com/kloczek/zabbix-templates/tree/master/Service%20MySQL&#13;
1818
&#13;
19+
| Macro | Default value | Description |&#13;
20+
| :-- | :-- | :-- |&#13;
21+
| {$SVC_MYSQL_CMD} | HOME=/var/lib/zabbix /usr/bin/mysql --login-path=monitoring -Nse | mysql command used in system.run[] keys |&#13;
22+
| {$SVC_MYSQL_PROC} | mysqld | MySQL process name |&#13;
23+
&#13;
1924
#### Notes:&#13;
2025
* 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;
2126
```&#13;
2227
[mysqld]&#13;
2328
show_compatibility_56 = OFF &#13;
2429
```&#13;
2530
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;
26-
&#13;
2731
* By default this template is monitoring the engine working on localhost.&#13;
28-
To be able to use this template on a host you need to setup a monitoring account with the proper privileges.&#13;
29-
To add such account you can use below queries:&#13;
32+
* To be able to use this template on a host you need to setup a monitoring account with the proper privileges.&#13;
33+
* To add such account you can use below queries:&#13;
3034
```&#13;
3135
CREATE USER 'monitoring'@'localhost' IDENTIFIED BY 'monitoring';&#13;
3236
GRANT SELECT, INDEX, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'monitoring'@'localhost';&#13;
@@ -70,14 +74,14 @@ http://dev.mysql.com/doc/refman/5.7/en/innodb-information-schema.html</descripti
7074
<type>7</type>
7175
<snmp_community/>
7276
<snmp_oid/>
73-
<key>proc.num[mysqld]</key>
77+
<key>proc.num[{$SVC_MYSQL_PROC}]</key>
7478
<delay>1m</delay>
7579
<history>2w</history>
7680
<trends>365d</trends>
7781
<status>0</status>
7882
<value_type>3</value_type>
7983
<allowed_hosts/>
80-
<units/>
84+
<units>processes</units>
8185
<snmpv3_contextname/>
8286
<snmpv3_securityname/>
8387
<snmpv3_securitylevel>0</snmpv3_securitylevel>
@@ -93,7 +97,7 @@ http://dev.mysql.com/doc/refman/5.7/en/innodb-information-schema.html</descripti
9397
<publickey/>
9498
<privatekey/>
9599
<port/>
96-
<description/>
100+
<description>Number MySQL processes.</description>
97101
<inventory_link>0</inventory_link>
98102
<applications>
99103
<application>
@@ -4573,7 +4577,7 @@ This level is like REPEATABLE READ, but InnoDB implicitly converts all plain SEL
45734577
<snmp_community/>
45744578
<snmp_oid/>
45754579
<key>system.run[{$MYSQL_CMD} "SELECT variable_value FROM performance_schema.global_variables WHERE variable_name='version';",]</key>
4576-
<delay>1d</delay>
4580+
<delay>5m</delay>
45774581
<history>2w</history>
45784582
<trends>0</trends>
45794583
<status>0</status>
@@ -4604,7 +4608,14 @@ This level is like REPEATABLE READ, but InnoDB implicitly converts all plain SEL
46044608
</applications>
46054609
<valuemap/>
46064610
<logtimefmt/>
4607-
<preprocessing/>
4611+
<preprocessing>
4612+
<step>
4613+
<type>20</type>
4614+
<params>7d</params>
4615+
<error_handler>0</error_handler>
4616+
<error_handler_params/>
4617+
</step>
4618+
</preprocessing>
46084619
<jmx_endpoint/>
46094620
<timeout>3s</timeout>
46104621
<url/>
@@ -4928,6 +4939,10 @@ SELECT variable_value FROM information_schema.global_status WHERE variable_name
49284939
<macro>{$MYSQL_CMD}</macro>
49294940
<value>HOME=/var/lib/zabbix /usr/bin/mysql --login-path=monitoring -Nse</value>
49304941
</macro>
4942+
<macro>
4943+
<macro>{$SVC_MYSQL_PROC}</macro>
4944+
<value>mysqld</value>
4945+
</macro>
49314946
</macros>
49324947
<templates/>
49334948
<screens>
@@ -5372,16 +5387,16 @@ Possible restart has been done.</description>
53725387
<tags/>
53735388
</trigger>
53745389
<trigger>
5375-
<expression>{Service MySQL:proc.num[mysqld].last(0)}&lt;1</expression>
5390+
<expression>{Service MySQL:proc.num[{$SVC_MYSQL_PROC}].last(0)}&lt;1</expression>
53765391
<recovery_mode>0</recovery_mode>
53775392
<recovery_expression/>
5378-
<name>SYS::processes::mysqld is not running</name>
5393+
<name>SYS::processes::{$SVC_MYSQL_PROC} is not running</name>
53795394
<correlation_mode>0</correlation_mode>
53805395
<correlation_tag/>
53815396
<url/>
53825397
<status>0</status>
5383-
<priority>4</priority>
5384-
<description/>
5398+
<priority>5</priority>
5399+
<description>The MySQL process is not running.</description>
53855400
<type>0</type>
53865401
<manual_close>0</manual_close>
53875402
<dependencies/>

0 commit comments

Comments
 (0)