Ad Widget

Collapse

monitor several path logs in the same item

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • marcioale
    Junior Member
    • Sep 2019
    • 14

    #1

    monitor several path logs in the same item

    Hi everyone,

    I would like to know if it is possible to configure only one item/trigger in zabbix to monitor the same log file, distributed in several paths with the same structure, for example like the paths below, which are on the same host in a linux server.

    /opt/applications/web01/processing.log
    /opt/applications/web02/processing.log
    /opt/applications/web03/processing.log
    /opt/applications/web04/processing.log

    Is it possible to configure a single item to monitore the word "failure" in the 4 pathlogs above using wildcard as an asterisk?
    I configured a single item as below but zabbix does not seem to accept the asterisk. So the item goes to "unsupported status" when I tried this configuration.

    log [/opt/applications/web0*/processing.log, failure]


    Which takes me to the conclusion that the only way possible to monitor several paths (within the same directory tree) is to create an item for each path to be monitored. Is that right?

    Thanks a lot,
  • Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    #2
    You are right - its not possible.

    Comment

    • 1berto
      Senior Member
      • Sep 2018
      • 182

      #3
      0) Had you tried log [/opt/applications/web0[0-9]/processing.log, failure] of something like it?
      Maybe there is a way with log clause (but i don't use it), you can also try:
      1) If you can use remote commands (check zabbix agent configurattion)
      system.run[ grep failure /opt/applications/web01/*.log >> /dev/null; echo $? ]
      Will return 0 if found, 1 if not
      Or
      2) If you need a more complexa solution you can try:
      (on the agent)
      UserParameter=search_for_failure,/path/to/script
      Then you can create a item with the key: search_for_failure
      If you need to pass parameters for the script:
      UserParameter=search_for_failure[*},/path/to/script $1, $2, ...
      and the key: search_for_failure[ parameter1, parameter2 ]
      So the agent will execute the following on the host:
      /path/to/script parameter1, parameter2
      Of course i'm imagining the worst case scenario (create a script), but if you can execute commands d


      (search for system.run)





      Comment

      • marcioale
        Junior Member
        • Sep 2019
        • 14

        #4
        Thanks a lot!
        I´m gonna give it a try.

        Comment

        Working...