Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - aachern

#1
Общие вопросы / LogWatch bug
April 06, 2018, 10:33:51 AM
Logwatch не обрабатывает последнюю строку.
#2
Допустим надо мониторить лог: C:\NetXMS_agent\demo.log и если в логе встречается 'error', то выполнять какое то действие, к примеру, alert на почту.

Я посмотрел инструкцию https://www.netxms.org/documentation/adminguide/log-monitoring.html, но из нее мало что понятно, нормальных примеров не нашел.

Давайте прямо по инструкции пойдем, с раздела Log Monitoring:

1. Agent Configuration for Log Monitoring

Это этот файл? C:\NetXMS_agent\etc\nxagentd.conf:

Quote#
#
# NetXMS agent configuration file
# Created by agent installer at Wed Mar 21 11:45:04 2018
#

MasterServers = 127.0.0.1
ConfigIncludeDir = C:\NetXMS_agent\etc\nxagentd.conf.d
LogFile = {syslog}
FileStore = C:\NetXMS_agent\var
RequireAuthentication = yes
SharedSecret = 123qweR
SubAgent = filemgr.nsm
SubAgent = ping.nsm
SubAgent = logwatch.nsm

# Below is log parsers definitions

*LOGWATCH
Parser = C:\NetXMS_agent\parser1.xml

SubAgent = portcheck.nsm
SubAgent = winperf.nsm



Parser1.xml, как и в примере:

Quote
<parser>
    <file>C:\NetXMS_agent\demo.log</file>
    <rules>
        <rule>
            <match>process startup failed</match>
            <context action="set" reset="auto">STARTUP_FAILED</context>
        </rule>
        <rule context="STARTUP_FAILED">
            <match>process:(.*)</match>
            <event params="1">200000</event>
        </rule>
    </rules>
</parser>

demo.log:

Quote
process:  5 6 54 4412345
process:  5 6 54 4412345
process:  5 6 54 4412345
process startup failed sdfsdf
process startup failed
process startup failed
process startup failed process:  5 6 54 4412345
process:  5 6 54 4412345
process:  5 6 54 4412345

А дальше что?

Есть хоть один рабочий пример, как следить за логами, или NetXMS под это не заточен, а заточен только под анализ системных логов, которые сам собирает?