Ad Widget

Collapse

Log Monitoring

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vlam
    Senior Member
    Zabbix Certified Specialist
    • Jun 2009
    • 166

    #1

    Log Monitoring

    Hi all

    I know there is lots of posts regarding log monitoring and ways on how to and not how to do it.

    I need to monitor a string on a log file:


    Current Item:
    logrt[/home/mysql/scripts/slave_check.log,Seconds_Behind_Master]

    My problem is the output:
    Seconds_Behind_Master: 0

    I only need the information behind the ":"

    Any help on this would be appreciated
    Thanks
    4 Zabbix Frontend Servers (Load balanced)
    2 Zabbix App Servers (HA)
    2 Zabbix Database Servers (HA)
    18 Zabbix Proxy Servers (HA)
    3897 Deployed Zabbix Agents
    6161 Values per second
    X-Layer Integration
    Jaspersoft report Servers (HA)
  • GPegel
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2015
    • 113

    #2
    According to the documenatation I think this is what you are looking for:

    Extracting matching part of regular expression

    Sometimes we may want to extract only the interesting value from a target file instead of returning the whole line when a regular expression match is found.

    Since Zabbix 2.2.0, log items have the ability to extract desired values from matched lines. This is accomplished by the additional output parameter in log and logrt items.

    Using the 'output' parameter allows to indicate the subgroup of the match that we may be interested in.

    So, for example

    Code:
    log[/path/to/the/file,"large result buffer allocation.*Entries: ([0-9]+)",,,,\1]
    should allow returning the entry count as found in the content of:

    Fr Feb 07 2014 11:07:36.6690 */ Thread Id 1400 (GLEWF) large result
    buffer allocation - /Length: 437136/Entries: 5948/Client Ver: >=10/RPC
    ID: 41726453/User: AUser/Form: CFG:ServiceLevelAgreement

    The reason why Zabbix will return only the number is because 'output' here is defined by \1 referring to the first and only subgroup of interest: ([0-9]+)

    And, with the ability to extract and return a number, the value can be used to define triggers.

    Comment

    • vlam
      Senior Member
      Zabbix Certified Specialist
      • Jun 2009
      • 166

      #3
      Originally posted by GPegel
      According to the documenatation I think this is what you are looking for:

      Extracting matching part of regular expression

      Sometimes we may want to extract only the interesting value from a target file instead of returning the whole line when a regular expression match is found.

      Since Zabbix 2.2.0, log items have the ability to extract desired values from matched lines. This is accomplished by the additional output parameter in log and logrt items.

      Using the 'output' parameter allows to indicate the subgroup of the match that we may be interested in.

      So, for example

      Code:
      log[/path/to/the/file,"large result buffer allocation.*Entries: ([0-9]+)",,,,\1]
      should allow returning the entry count as found in the content of:

      Fr Feb 07 2014 11:07:36.6690 */ Thread Id 1400 (GLEWF) large result
      buffer allocation - /Length: 437136/Entries: 5948/Client Ver: >=10/RPC
      ID: 41726453/User: AUser/Form: CFG:ServiceLevelAgreement

      The reason why Zabbix will return only the number is because 'output' here is defined by \1 referring to the first and only subgroup of interest: ([0-9]+)

      And, with the ability to extract and return a number, the value can be used to define triggers.
      Thanks for the reply, it helped on some of my lines, what about the output where it is not numbers but words behind the ":"
      4 Zabbix Frontend Servers (Load balanced)
      2 Zabbix App Servers (HA)
      2 Zabbix Database Servers (HA)
      18 Zabbix Proxy Servers (HA)
      3897 Deployed Zabbix Agents
      6161 Values per second
      X-Layer Integration
      Jaspersoft report Servers (HA)

      Comment

      • jeetusjeet
        Junior Member
        • Oct 2014
        • 13

        #4
        file permissions to zabbix user in log monitoring

        Hi,

        I have successfully configured log monitoring in my environment as per given in zabbix documentation but i have one query: is there any alternate method for giving read-only permissions to zabbix user.

        I am using zabbix-server and agent 2.4.8 and Centos 6.8 as client.

        Comment

        Working...