В файл zabbix.conf на клиенте, необходимо добавить следующие строки:
UserParameter=<имя элемента данных zabbix>,powershell -NoProfile -ExecutionPolicy Bypass -command "$ErrorActionPreference = 'silentlycontinue'; $evlist = @(Get-EventLog -LogName <имя журнала Windows> -EntryType <тип сообщения>).Count ;
$evlist"
Примеры использования
Для получения количества предупреждений в журнале System:
UserParameter=sys_warnings.count,powershell -NoProfile -ExecutionPolicy Bypass -command "$ErrorActionPreference = 'silentlycontinue'; $evlist = @(Get-EventLog -LogName System -EntryType Warning).Count ; $evlist"
Для получения количества предупреждений в журнале Application:
UserParameter=app_warnings.count,powershell -NoProfile -ExecutionPolicy Bypass -command "$ErrorActionPreference = 'silentlycontinue'; $evlist = @(Get-EventLog -LogName Application -EntryType Warning).Count ; $evlist"
Для получения количества ошибок в журнале Application:
UserParameter=sys_errors.count,powershell -NoProfile -ExecutionPolicy Bypass -command "$ErrorActionPreference = 'silentlycontinue'; $evlist = @(Get-EventLog -LogName System -EntryType Error).Count ; $evlist"
Для получения количества ошибок в журнале Application для определенной службы Windows Backup:
UserParameter=backup_events.count,powershell -NoProfile -ExecutionPolicy Bypass -command "$ErrorActionPreference = 'silentlycontinue'; $evlist = (@(Get-EventLog -LogName Application -EntryType Error -Source Microsoft-Windows-Backup).Count)+(@(Get-EventLog -LogName Application -EntryType Warning -Source Microsoft-Windows-Backup).Count) ; $evlist"
UserParameter=<имя элемента данных zabbix>,powershell -NoProfile -ExecutionPolicy Bypass -command "$ErrorActionPreference = 'silentlycontinue'; $evlist = @(Get-EventLog -LogName <имя журнала Windows> -EntryType <тип сообщения>).Count ;
$evlist"
Примеры использования
Для получения количества предупреждений в журнале System:
UserParameter=sys_warnings.count,powershell -NoProfile -ExecutionPolicy Bypass -command "$ErrorActionPreference = 'silentlycontinue'; $evlist = @(Get-EventLog -LogName System -EntryType Warning).Count ; $evlist"
Для получения количества предупреждений в журнале Application:
UserParameter=app_warnings.count,powershell -NoProfile -ExecutionPolicy Bypass -command "$ErrorActionPreference = 'silentlycontinue'; $evlist = @(Get-EventLog -LogName Application -EntryType Warning).Count ; $evlist"
Для получения количества ошибок в журнале Application:
UserParameter=sys_errors.count,powershell -NoProfile -ExecutionPolicy Bypass -command "$ErrorActionPreference = 'silentlycontinue'; $evlist = @(Get-EventLog -LogName System -EntryType Error).Count ; $evlist"
Для получения количества ошибок в журнале Application для определенной службы Windows Backup:
UserParameter=backup_events.count,powershell -NoProfile -ExecutionPolicy Bypass -command "$ErrorActionPreference = 'silentlycontinue'; $evlist = (@(Get-EventLog -LogName Application -EntryType Error -Source Microsoft-Windows-Backup).Count)+(@(Get-EventLog -LogName Application -EntryType Warning -Source Microsoft-Windows-Backup).Count) ; $evlist"
Комментариев нет:
Отправить комментарий