User Tools

Site Tools


сервис_zabbix

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
сервис_zabbix [2021/12/04 17:24]
val [Debian 10]
сервис_zabbix [2022/07/24 12:11]
val [Настройка триггеров]
Line 89: Line 89:
 http://​server.corpX.un/​zabbix/​setup.php http://​server.corpX.un/​zabbix/​setup.php
  
 +!!! После работы визарда рекомендуется ​
 +
 +# mv /​usr/​share/​zabbix/​setup.php /​usr/​share/​zabbix/​setup.php_stop
 +
 +что бы никто его не повторил)
 </​code><​code>​ </​code><​code>​
 # less /​etc/​zabbix/​zabbix.conf.php # less /​etc/​zabbix/​zabbix.conf.php
Line 117: Line 122:
 ===== Установка и запуск proxy ===== ===== Установка и запуск proxy =====
  
-==== Из репозитория Zabbix ​====+==== sqlite3 ==== 
 + 
 +=== Из репозитория Zabbix ===
  
   * Подключить репозиторий из раздела [[https://​www.zabbix.com/​download|Download and install Zabbix]]   * Подключить репозиторий из раздела [[https://​www.zabbix.com/​download|Download and install Zabbix]]
Line 125: Line 132:
 # mkdir /​var/​lib/​zabbix # mkdir /​var/​lib/​zabbix
  
 +# В 6-й версии не нужно, БД будет создана автоматически
 # zcat /​usr/​share/​doc/​zabbix-proxy-sqlite3/​schema.sql.gz | sqlite3 /​var/​lib/​zabbix/​zabbix.db # zcat /​usr/​share/​doc/​zabbix-proxy-sqlite3/​schema.sql.gz | sqlite3 /​var/​lib/​zabbix/​zabbix.db
 </​code>​ </​code>​
-==== Из репозитория Debian ​====+=== Из репозитория Debian ===
 <​code>​ <​code>​
 # apt install zabbix-proxy-sqlite3 # apt install zabbix-proxy-sqlite3
Line 135: Line 143:
 # zcat /​usr/​share/​zabbix-proxy-sqlite3/​schema.sql.gz | sqlite3 /​var/​lib/​zabbix/​zabbix.db # zcat /​usr/​share/​zabbix-proxy-sqlite3/​schema.sql.gz | sqlite3 /​var/​lib/​zabbix/​zabbix.db
 </​code>​ </​code>​
-==== Настройка и запуск ​====+=== Настройка и запуск ===
 <​code>​ <​code>​
 # chown -R zabbix:​zabbix /​var/​lib/​zabbix # chown -R zabbix:​zabbix /​var/​lib/​zabbix
Line 148: Line 156:
 </​code>​ </​code>​
  
-==== Debian/MySQL ====+==== MySQL ==== 
 + 
 +=== Из репозитория Debian ​===
  
 <​code>​ <​code>​
Line 196: Line 206:
 ===== Настройка мониторинга ===== ===== Настройка мониторинга =====
  
-  * [[https://​www.zabbix.com/​documentation/​4.0/​ru/​manual/​quickstart|Zabbix Documentation ​4.0. Быстрый старт]]+  * [[https://​www.zabbix.com/​documentation/​current/​ru/​manual/​quickstart|Zabbix Documentation. Быстрый старт]]
   * Login: Admin; Pass: zabbix   * Login: Admin; Pass: zabbix
 +
 <​code>​ <​code>​
-http://server.corpX.un/zabbix/+http://192.168.X.10/zabbix/
 </​code>​ </​code>​
 ==== Настройка уведомлений о событиях ==== ==== Настройка уведомлений о событиях ====
Line 364: Line 375:
 {ITEM.NAME1} ({HOST.NAME1}:​{ITEM.KEY1}): ​ {ITEM.NAME1} ({HOST.NAME1}:​{ITEM.KEY1}): ​
  
-Current:+==CURRENT==
  
 {ITEM.VALUE1} {ITEM.VALUE1}
  
-Previous:+==PREVIOUS==
  
 {{HOSTNAME}:​{TRIGGER.KEY}.last(#​2)} {{HOSTNAME}:​{TRIGGER.KEY}.last(#​2)}
Line 388: Line 399:
 {{HOSTNAME}:​{TRIGGER.KEY}.last(#​2)} {{HOSTNAME}:​{TRIGGER.KEY}.last(#​2)}
 </​code>​ </​code>​
 +
 +  * [[https://​www.zabbix.com/​forum/​zabbix-help/​445808-display-an-items-previous-value|Display an items previous value...does not work...]]
 ==== Простые проверки ==== ==== Простые проверки ====
  
Line 416: Line 429:
     Type: Simple check     Type: Simple check
     Key: net.tcp.service[tcp,​192.168.X.5,​3389]     Key: net.tcp.service[tcp,​192.168.X.5,​3389]
 +#    Key: net.tcp.service[tcp,​192.168.X.29,​3389]
     Applications:​ Service check     Applications:​ Service check
 </​code>​ </​code>​
Line 479: Line 493:
  
 speedtest-cli --csv $A | cut -d','​ -f $F speedtest-cli --csv $A | cut -d','​ -f $F
 +</​code><​code>​
 +# /​etc/​zabbix/​externalscripts/​speedtest.sh upload
 +
 +# /​etc/​zabbix/​externalscripts/​speedtest.sh download
 </​code><​code>​ </​code><​code>​
 Cofiguration->​Hosts->​server.corpX.un Cofiguration->​Hosts->​server.corpX.un
Line 487: Line 505:
     Type of information:​ Numeric (float)     Type of information:​ Numeric (float)
     Units: Бит/​сек     Units: Бит/​сек
 +    Update interval: 30m
 +
 ...    ​ ...    ​
     Name: speedtest upload     Name: speedtest upload
Line 723: Line 743:
   Variables   Variables
     {token1} regex:​name="​_token"​ value="​([0-9A-Za-z]{32})"​     {token1} regex:​name="​_token"​ value="​([0-9A-Za-z]{32})"​
 +Можно проще:
 +    {token1} regex:​name="​_token"​ value="​(.{32})"​
  
   Required string: Roundcube Webmail   Required string: Roundcube Webmail
Line 739: Line 761:
  
   Variables   Variables
-    {token2}: regex:​name="​_token"​ value="​([0-9A-Za-z]{32})"+    {token2}: regex:​name="​_token"​ value="​(.{32})"
     ​     ​
   Follow redirects: YES   Follow redirects: YES
Line 764: Line 786:
 Host: server.corpX.un Host: server.corpX.un
     Name: gate.isp.un is unreachable     Name: gate.isp.un is unreachable
-    Expression: {server.corpX.un:​icmpping[gate.isp.un].last()}=0+    Expression: {server.corpX.un:​icmpping[gate.isp.un].last()}=0 ​   ​Zabbix < 5.4 
 +    Expression: last(/​server.corpX.un/​icmpping[gate.isp.un])=0 ​    ​Zabbix >= 5.4
     Severity: High     Severity: High
  
     Name: RDP service on host is not available     Name: RDP service on host is not available
     Expression: {server.corpX.un:​net.tcp.service[tcp,​192.168.X.5,​3389].last()}=0     Expression: {server.corpX.un:​net.tcp.service[tcp,​192.168.X.5,​3389].last()}=0
 +    Expression: last(/​server.corpX.un/​net.tcp.service[tcp,​192.168.X.29,​3389])=0
     Severity: Warning     Severity: Warning
  
Line 774: Line 798:
     Name: HTTPS service on {HOST.NAME} is not available     Name: HTTPS service on {HOST.NAME} is not available
     Expression: {ya.ru:​net.tcp.service.perf[https].last(#​2)}=0     Expression: {ya.ru:​net.tcp.service.perf[https].last(#​2)}=0
 +    Expression: last(/​ya.ru/​net.tcp.service.perf[https],#​2)=0
  
     Dependencies:​ Zabbix server: gate.isp.un is unreachable ​       Dependencies:​ Zabbix server: gate.isp.un is unreachable ​  
Line 785: Line 810:
 Host: ya.ru                                        Host: ya.ru                                       
     Name: HTTP service on {HOST.NAME} is slow     Name: HTTP service on {HOST.NAME} is slow
 +    ​
 +    Значение подобрать на основе графика
 +    ​
 +    Expression: {ya.ru:​my.avg.perf.http.last()}>​0.4
     Expression: {ya.ru:​net.tcp.service.perf[https].avg(5m)}>​0.4  ​     Expression: {ya.ru:​net.tcp.service.perf[https].avg(5m)}>​0.4  ​
 +    Expression: avg(/​ya.ru/​net.tcp.service.perf[https],​5m)>​0.4
  
- 
-    Expression: {ya.ru:​my.avg.perf.http.last()}>​0.4 
- 
-    Значение подобрать на основе графика 
     Severity: Warning     Severity: Warning
 </​code>​ </​code>​
Line 812: Line 838:
   или   или
 Expression: {val.bmstu.ru:​my.nmap.diff()}=1 Expression: {val.bmstu.ru:​my.nmap.diff()}=1
 +</​code>​
 +Zabbix 6
 +<​code>​
 +Name: installed soft on host {HOST.NAME} change
 +Severity: Warning
 +
 +Expression: (last(/​Template OS Windows list installed soft Active/​listinstalledsoft,#​1)<>​last(/​Template OS Windows list installed soft Active/​listinstalledsoft,#​2))=1
 </​code>​ </​code>​
  
Line 822: Line 855:
 Severity: Hight Severity: Hight
 Expression: {server.corpX.un:​web.test.fail[mail corpX].last()}>​0 Expression: {server.corpX.un:​web.test.fail[mail corpX].last()}>​0
 +Expression: last(/​server.corpX.un/​web.test.fail[mail corpX])>​0
 </​code>​ </​code>​
  
Line 961: Line 995:
 Timeout=30 Timeout=30
  
-UserParameter=listinstalledsoft,​powershell -Command Get-ChildItem HKLM:​\Software\Microsoft\Windows\CurrentVersion\Uninstall;​ powershell -Command Get-ChildItem HKLM:​\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall+#UserParameter=listinstalledsoft,​powershell -Command Get-ChildItem HKLM:​\Software\Microsoft\Windows\CurrentVersion\Uninstall;​ powershell -Command Get-ChildItem HKLM:​\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall 
 + 
 +UserParameter=listinstalledsoft,​C:​\bin\listinstalledsoft.bat | findstr /v "​^$"​
  
 UnsafeUserParameters=1 UnsafeUserParameters=1
Line 967: Line 1003:
 UserParameter=runcommand[*],​$1 UserParameter=runcommand[*],​$1
 UserParameter=lmstat[*],​C:​\Progra~1\PTC\flexnet\bin\lmutil lmstat -a -c $1 UserParameter=lmstat[*],​C:​\Progra~1\PTC\flexnet\bin\lmutil lmstat -a -c $1
 +</​code><​code>​
 +C:​\>​notepad C:​\bin\listinstalledsoft.bat
 +</​code><​code>​
 +@echo off
 +
 +powershell -command "​Get-ItemProperty HKLM:​\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName | Format-Table -AutoSize -HideTableHeaders"​
 +
 +powershell -command "​Get-ItemProperty HKLM:​\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName | Format-Table -AutoSize -HideTableHeaders"​
 </​code>​ </​code>​
 ==== Мониторинг по протоколу SNMP ==== ==== Мониторинг по протоколу SNMP ====
Line 1009: Line 1053:
              4.XX Template Module Interfaces Simple SNMPv2              4.XX Template Module Interfaces Simple SNMPv2
              5.XX Template Net Cisco IOS SNMP                  !!!! Уменьшить период Discovery !!!!              5.XX Template Net Cisco IOS SNMP                  !!!! Уменьшить период Discovery !!!!
 +             6.XX Cisco IOS SNMP
       Set host inventory mode: Automatic       Set host inventory mode: Automatic
     Add     Add
 </​code>​ </​code>​
 +
 +=== SNMPv3 ===
 +
 +  * [[https://​blog.zabbix.com/​monitoring-network-hardware-with-snmpv3-in-zabbix/​10093/​|Monitoring network hardware with SNMPv3 in Zabbix]]
 ==== Проверки через SSH ==== ==== Проверки через SSH ====
  
Line 1021: Line 1070:
   * [[https://​www.zabbix.com/​documentation/​3.0/​ru/​manual/​config/​items/​itemtypes/​snmptrap|Zabbix Documentation SNMP трапы]]   * [[https://​www.zabbix.com/​documentation/​3.0/​ru/​manual/​config/​items/​itemtypes/​snmptrap|Zabbix Documentation SNMP трапы]]
   * [[https://​gist.github.com/​jpawlowski/​152abb4951f39ce1cfa0b1c5220b8635|SNMPTT installation on CentOS 7 for Zabbix integration]]   * [[https://​gist.github.com/​jpawlowski/​152abb4951f39ce1cfa0b1c5220b8635|SNMPTT installation on CentOS 7 for Zabbix integration]]
 +  * [[https://​programmersought.com/​article/​39768892920/​|How to deploy SNMP Traps in Centos8]]
   * [[https://​www.zabbix.com/​forum/​zabbix-help/​28463-catch-all-snmp-traps-with-general-event|catch all snmp traps with general event]]   * [[https://​www.zabbix.com/​forum/​zabbix-help/​28463-catch-all-snmp-traps-with-general-event|catch all snmp traps with general event]]
 +  * [[https://​blog.zabbix.com/​snmp-traps-in-zabbix/​8210/​|SNMP Traps in Zabbix]]
 +  * [[https://​youtu.be/​fVK2YWdTalQ|youtube SNMP Traps in Zabbix Tutorial]]
  
 <​code>​ <​code>​
Line 1071: Line 1123:
 Configuration Configuration
   Templates   Templates
-    Template App SSH Service+    Template App SSH Service/SSH Service
   Full Clone   Full Clone
-    Template App SSH Port Service+    Template App SSH Port Service/SSH Port Service
   Add   Add
  
   Templates   Templates
-    Template App SSH Port Service+    Template App SSH Port Service/SSH Port Service
       Items       Items
         SSH service is running         SSH service is running
Line 1240: Line 1292:
       Name: On {HOST.NAME} in the DHCP pool {#POOLNAME}       Name: On {HOST.NAME} in the DHCP pool {#POOLNAME}
       Expression: {Template App DHCP Pools:​dhcp.pools.shared-network[{#​POOLNAME},​used].last()}/​{Template App DHCP Pools:​dhcp.pools.shared-network[{#​POOLNAME},​defined].last()}*100 > {$DHCP.POOLS.MAX.PERCENT}       Expression: {Template App DHCP Pools:​dhcp.pools.shared-network[{#​POOLNAME},​used].last()}/​{Template App DHCP Pools:​dhcp.pools.shared-network[{#​POOLNAME},​defined].last()}*100 > {$DHCP.POOLS.MAX.PERCENT}
 +                  last(/​Template App DHCP Pools/​dhcp.pools.shared-network[{#​POOLNAME},​used])/​last(/​Template App DHCP Pools/​dhcp.pools.shared-network[{#​POOLNAME},​defined])*100 > {$DHCP.POOLS.MAX.PERCENT}
       Severity: Warning       Severity: Warning
 </​code>​ </​code>​
Line 1253: Line 1306:
 ===== API ===== ===== API =====
  
-  * [[https://​ru.wikipedia.org/​wiki/​JSON|Материал из Википедии. ​JSON]]+  * [[Формат JSON]]
   * [[https://​www.zabbix.com/​documentation/​1.8/​ru/​api/​getting_started|Zabbix Documentation Начало работы с Zabbix API]]   * [[https://​www.zabbix.com/​documentation/​1.8/​ru/​api/​getting_started|Zabbix Documentation Начало работы с Zabbix API]]
  
Line 1401: Line 1454:
 } " http://​127.0.0.1/​zabbix/​api_jsonrpc.php } " http://​127.0.0.1/​zabbix/​api_jsonrpc.php
 </​code><​code>​ </​code><​code>​
-server.corp1.un:​~#​ /​root/​zab_set_map_name.sh 2 "Super MAP"+server.corp1.un:​~#​ /​root/​zab_set_map_name.sh 2 "ISP1"
 </​code>​ </​code>​
сервис_zabbix.txt · Last modified: 2024/06/10 17:10 by val