Ad Widget

Collapse

Zabbix Agent2 - can't make ANY userparam work at all

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • a.sciancalepore
    Junior Member
    • Feb 2022
    • 3

    #1

    Zabbix Agent2 - can't make ANY userparam work at all

    Hi all,
    on my setup I've got Zabbix 6.2.2 Server and Zabbix Agent 2 installed on the hosts (zabbix_agent2-6.2.2).
    I want to use userparams to catch automatically with Zabbix Agent 2 the current (today) date from the server in yyyy-mm-aa format to let an item I've configured in Zabbix Server to read log files and catch some different expections on Tomcat logs.

    At this moment I've configured this item in Zabbix Server using these configurations:

    Code:
    Type: Zabbix agent active
    Key: log[D:/Tomcats/logs/catalina-2024-11-23.log,FATAL|NullPointerException|SQLSyntaxErrorE xception|IndexOutOfBoundsException]
    Information: Log
    This works pretty well, but the thing here is that those logfiles are with rotation (current date) so I should use logrt instead... and here come the issue... I can't place any wildcard within logrt key, I've already tried with:

    Code:
    logrt[D:/Tomcats/logs/catalina*.log,FATAL|NullPointerException|SQLSyntax ErrorE xception|IndexOutOfBoundsException]
    Code:
    logrt[D:/Tomcats/logs/catalina-????-??-??.log,FATAL|NullPointerException|SQLSyntax ErrorE xception|IndexOutOfBoundsException]
    But they don't work, Zabbix is telling me that he can't find the proper file/directory.

    So the idea here is to use a ps1 script on the server, let the Zabbix Agent 2 execute that script with an userparam and let it resolve the correct log name complete of the date:

    For example I've tried in the Zabbig Agent 2 conf file (findCatalina.ps1 is a script that give me the name complete of the date, for example catalina-2024-11-23.log):

    Code:
    UserParameter=log.findCatalina,powershell.exe -ExecutionPolicy Bypass -File "C:/scripts/findCatalina.ps1"

    And then I've tried to update my key in the item in this manner:

    Code:
    logrt[{log.findCatalina},FATAL|NullPointerException|SQLSyntaxErrorException|IndexOutOfBoundsException]
    The issue here is that it seems that no userparam works in the agent, I can't make them work in any matter, anything I try it gives me this error:

    Code:
    C:\Users\Administrator>zabbix_agent2 -t log.findcatalina
    log.findcatalina [m|ZBX_NOTSUPPORTED] [Unknown metric log.findcatalina]
    ​
    Restarted countless time the agent, no luck at all...

    So, any suggestion to help me fixing this issue?
  • glesys-andreas
    Junior Member
    • Nov 2024
    • 3

    #2
    Can i be a simple typo in the userparameter? Capital C in config and not in query?

    Code:
    pi@raspberrypi:~ $ cat /etc/zabbix/zabbix_agent2.d/test.conf
    UserParameter=log.findCatalina,echo "Hello world"​
    Code:
    pi@raspberrypi:~ $ zabbix_agent2 -t log.findcatalina
    log.findcatalina [m|ZBX_NOTSUPPORTED] [Unknown metric log.findcatalina]
    pi@raspberrypi:~ $ zabbix_agent2 -t log.findCatalina
    log.findCatalina [s|Hello world]

    Comment

    Working...