Ad Widget

Collapse

Help to monitor queue sizes from txt files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Lurnux
    Junior Member
    • May 2014
    • 22

    #1

    Help to monitor queue sizes from txt files

    Hello,

    Could someone hold my hand and help me a bit to get few things monitored in Zabbix since i'm quite new with it. I'm currently running Zabbix 2.4.1 server and 2.4.2 agents.

    I need to monitor some queue lenghts and dates from text files which are created to the servers directory.

    From listing1.txt I need to monitor the first number string so that alarm would triggered if the number is over 20000 and the name behind that would be stated in the alarm.
    I also need to create graph from these numbers and automatically import queue names form the txt file.

    listning1.txt:
    41930 222-in-someta
    11183 713-in-sometb
    2367 181-in-sometc
    158 521-in-sesta
    0 361-in-sestab
    ...
    ...
    ...

    From listing2.txt i need to monitor date field and trigger an alarm if the date is older than 24h.

    listing2.txt:
    12-JAN-15 07.11.30.543000 PM 222-in-someta
    13-JAN-15 03.54.42.564000 AM 713-in-sometb
    13-JAN-15 12.41.49.665000 PM 81-in-sometc
    13-JAN-15 07.56.20.136000 PM 521-in-sesta
    14-JAN-15 01.10.58.189000 AM 361-in-sestab
    ...
    ...
    ...

    Finally from listing3.txt i need to monitor both, the number and the date. The queue size should trigger an alarm if it exceeds 1000 and also alarm should be triggered if the date is older than 24h.
    Also graph would be needed from the queue sizes and also automatically import queue names to the graph.

    listing3.txt:
    446 14-JAN-15 08.43.51.906000 AM 222-in-someta
    26 14-JAN-15 09.03.26.566000 AM 713-in-sometb
    25 14-JAN-15 09.01.51.295000 AM 181-in-sometc
    21 14-JAN-15 09.02.13.609000 AM 521-in-sesta
    18 14-JAN-15 09.02.36.028000 AM 361-in-sestab
    ...
    ...
    ...


    Thanks in advance.
  • Lurnux
    Junior Member
    • May 2014
    • 22

    #2
    Anyone? Any tutorials out there on how to create graphs form logfiles like I mentioned?

    Comment

    • ingus.vilnis
      Senior Member
      Zabbix Certified Trainer
      Zabbix Certified SpecialistZabbix Certified Professional
      • Mar 2014
      • 908

      #3
      Hi,

      I will try to help you somehow.

      But before we start, please remember to check the file paths and adjust accordingly. I am giving you just examples.
      listing1.txt
      From listing1.txt I need to monitor the first number string so that alarm would triggered if the number is over 20000 and the name behind that would be stated in the alarm.
      1. Create a log item
      2. Use key:
      Code:
      log["C:\Zabbix\test\listing1.txt","([0-9]+) ([0-9]+)-([0-9a-zA-Z -]+)",,,,\1]
      This item will display the numbers
      3. Clone this log item to create a new item with key:
      Code:
      log["C:\Zabbix\test\listing1.txt","([0-9]+) ([0-9]+)-([0-9a-zA-Z -]+)",,,,\3]
      This item will display the location
      4. Create a new calculated item

      5. Use key:
      Code:
      last("log[\"C:\Zabbix\test\listing1.txt\",\"([0-9]+) ([0-9]+)-([0-9a-zA-Z -]+)\",,,,\1]")
      Type of information: Numeric
      This item will be used to display your values on the graph
      6. Create Trigger
      7. Use Trigger expression
      Code:
      ({ZBX-test Windows:log["C:\Zabbix\test\listing1.txt","([0-9]+) ([0-9]+)-([0-9a-zA-Z -]+)",,,,\1].last()}>20000 and 
       {ZBX-test Windows:log["C:\Zabbix\test\listing1.txt","([0-9]+) ([0-9]+)-([0-9a-zA-Z -]+)",,,,\3].regexp("[0-9a-zA-Z -]+")}=1) or 
       {ZBX-test Windows:log["C:\Zabbix\test\listing1.txt","([0-9]+) ([0-9]+)-([0-9a-zA-Z -]+)",,,,\1].nodata(86400)}=1
      NB! Don't forget to check the file names!
      10. For notifications use {ITEM.VALUE<1-9>} Macros to display both values - queue and location.

      11. The requirement for triggering if the date is older than 24h can be achieved with this part in the trigger expression:
      Code:
      {ZBX-test Windows:log["C:\Zabbix\test\listing1.txt","([0-9]+) ([0-9]+)-([0-9a-zA-Z -]+)",,,,\1].nodata(86400)}=1
      12. Create graph from the calculated item.

      NB! Text values (location in your case) cannot be displayed in graphs.


      listing2.txt
      From listing2.txt i need to monitor date field and trigger an alarm if the date is older than 24h.
      Use nodata trigger function as described before because I cannot think of a way to decode non-ISO date format 12-JAN-15 07.11.30


      listing3.txt
      Use the knowledge from the previous files to combine what you need.

      Hope this helps you somehow. And don't forget to check multiple sections of Zabbix documentation to get more info.

      Best Regards,
      Ingus

      Comment

      Working...