This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
сервис_zabbix [2022/04/21 08:41] val [Обработка SNMPTRAP] |
сервис_zabbix [2022/12/21 13:36] val [Мониторинг по протоколу SNMP] |
||
---|---|---|---|
Line 132: | 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> | ||
Line 205: | Line 206: | ||
===== Настройка мониторинга ===== | ===== Настройка мониторинга ===== | ||
+ | * !!! однажды Setup заработал только в chrome !!! | ||
* [[https://www.zabbix.com/documentation/current/ru/manual/quickstart|Zabbix Documentation. Быстрый старт]] | * [[https://www.zabbix.com/documentation/current/ru/manual/quickstart|Zabbix Documentation. Быстрый старт]] | ||
* Login: Admin; Pass: zabbix | * Login: Admin; Pass: zabbix | ||
Line 398: | Line 400: | ||
{{HOSTNAME}:{TRIGGER.KEY}.last(#2)} | {{HOSTNAME}:{TRIGGER.KEY}.last(#2)} | ||
</code> | </code> | ||
+ | |||
+ | Zabbix 6 | ||
+ | |||
+ | * [[https://www.zabbix.com/forum/zabbix-help/445808-display-an-items-previous-value|Display an items previous value...does not work...]] | ||
==== Простые проверки ==== | ==== Простые проверки ==== | ||
Line 597: | Line 603: | ||
Key: speedtest.download | Key: speedtest.download | ||
Type of information: Numeric (float) или Numeric (unsigned) | Type of information: Numeric (float) или Numeric (unsigned) | ||
- | Units: Бит/сек | + | Units: бит/с или bit/s |
Allowed hosts: 127.0.0.1 | Allowed hosts: 127.0.0.1 | ||
Preprocessing может понадобиться | Preprocessing может понадобиться | ||
Line 828: | Line 834: | ||
=== Пример с текстовым элементом === | === Пример с текстовым элементом === | ||
+ | Zabbix 5 | ||
<code> | <code> | ||
Name: Host {HOST.NAME} nmap change | Name: Host {HOST.NAME} nmap change | ||
Line 835: | Line 842: | ||
или | или | ||
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 943: | Line 957: | ||
<code> | <code> | ||
Configuration - Actions - Auto registration | Configuration - Actions - Auto registration | ||
- | Name: Add windows clients | + | Name: Add Windows clients # or Add Linux clients |
- | Conditions: Host name contains CLIENT | + | Conditions: Host name contains CLIENT # or client (lowercase) for linux |
- | Action operations: Add to host groups: windows clients | + | Action operations: Add to host groups: Windows clients # or Linux client |
- | Link to templates: Template OS Windows by Zabbix agent active | + | Link to templates: Windows by Zabbix agent active # or Linux by Zabbix agent active |
- | Template OS Windows list installed soft Active | + | Template OS Windows list installed soft Active # work in linux too)) |
Set host inventory mode: Automatic | Set host inventory mode: Automatic | ||
</code> | </code> | ||
Line 959: | Line 973: | ||
StartAgents=0 | StartAgents=0 | ||
ServerActive=server | ServerActive=server | ||
- | Hostname=CLIENTN | + | #Hostname=CLIENTN |
</code> | </code> | ||
=== Использование UserParameter === | === Использование UserParameter === | ||
- | * Пример для Linux/Unix | + | == Примеры для Linux == |
* [[Сервис DHCP#Статистика DHCP сервера]] | * [[Сервис DHCP#Статистика DHCP сервера]] | ||
Line 976: | Line 991: | ||
</code> | </code> | ||
- | * Windows examples | + | * [[Управление ПО в Linux#Список desktop приложений]] |
- | * [[PowerShell#Список установленного ПО]] !!! Попробовать вариант с форматированием | + | |
+ | <code> | ||
+ | linclient2:~# cat /etc/zabbix/zabbix_agentd.conf.d/listinstalledsoft.conf | ||
+ | </code><code> | ||
+ | UserParameter=listinstalledsoft,ls /usr/share/applications | awk -F '.desktop' ' { print $1}' - | ||
+ | </code> | ||
+ | |||
+ | == Примеры для Windows == | ||
+ | |||
+ | * [[PowerShell#Список установленного ПО]] | ||
<code> | <code> | ||
Line 985: | Line 1009: | ||
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 | + | UserParameter=listinstalledsoft,C:\bin\listinstalledsoft.bat | findstr /v "^$" |
UnsafeUserParameters=1 | UnsafeUserParameters=1 | ||
Line 998: | Line 1022: | ||
@echo off | @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\Microsoft\Windows\CurrentVersion\Uninstall\* | Get-ItemProperty | Where-Object 'DisplayName' | Sort-Object -Property DisplayName | Select-Object -Property DisplayName | Format-Table -AutoSize -HideTableHeaders" |
+ | powershell -command "Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Get-ItemProperty | Where-Object 'DisplayName' | Sort-Object -Property DisplayName | Select-Object -Property 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 ==== | ||
- | * Необходима [[Сервис SNMP#Установка snmp консоли]] | + | * Была необходима [[Сервис SNMP#Установка snmp консоли]] |
<code> | <code> | ||
Line 1043: | Line 1067: | ||
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 | ||
Line 1132: | Line 1157: | ||
* [[https://www.zabbix.com/forum/in-russian/44171-perl-script-%D0%90%D0%B2%D1%82%D0%BE%D1%80%D0%B8%D1%81%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F-%D1%82%D0%BE%D0%BF%D0%BE%D0%BB%D0%BE%D0%B3%D0%B8%D0%B8-%D1%81%D0%B5%D1%82%D0%B8-%D0%B2-zabbix|Perl script Авторисования топологии сети в Zabbix]] | * [[https://www.zabbix.com/forum/in-russian/44171-perl-script-%D0%90%D0%B2%D1%82%D0%BE%D1%80%D0%B8%D1%81%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F-%D1%82%D0%BE%D0%BF%D0%BE%D0%BB%D0%BE%D0%B3%D0%B8%D0%B8-%D1%81%D0%B5%D1%82%D0%B8-%D0%B2-zabbix|Perl script Авторисования топологии сети в Zabbix]] | ||
* [[https://youtu.be/MEdVvZU18ek|Видеоурок - Самый простой, но очень полезный пример использования низкоуровнего обнаружения (LLD) в Zabbix]] | * [[https://youtu.be/MEdVvZU18ek|Видеоурок - Самый простой, но очень полезный пример использования низкоуровнего обнаружения (LLD) в Zabbix]] | ||
- | * [[Утилита jq]] | + | |
=== Штатные примеры === | === Штатные примеры === | ||
<code> | <code> | ||
- | server# zabbix_get -s gate -k vfs.fs.discovery | jq | + | server# zabbix_get -s gate -k vfs.fs.discovery |
- | ... | + | </code> |
+ | * [[Утилита jq]] | ||
+ | <code> | ||
server# zabbix_get -s gate -k vfs.fs.size[/,free] | server# zabbix_get -s gate -k vfs.fs.size[/,free] | ||
server# zabbix_get -s gate -k vfs.fs.size[/,total] | server# zabbix_get -s gate -k vfs.fs.size[/,total] | ||
Line 1281: | Line 1307: | ||
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> |