Ad Widget

Collapse

Web monitoring of a pattern in a status log file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • martinsm
    Junior Member
    • Jun 2011
    • 5

    #1

    Web monitoring of a pattern in a status log file

    Hi. I have a status .txt file on a web server, with the following data:

    Code:
    VIDEO_BLACK|NO
    VIDEO_FREEZE|NO
    AUDIO_TRACK1_SILENCE|NO
    AUDIO_TRACK2_SILENCE|NO
    AUDIO_TRACK3_SILENCE|YES
    What I want to do is to use Web monitoring to monitor the .txt file for specific patterns. For example, I want to know when "VIDEO_FREEZE|NO" changes to "VIDEO_FREEZE|YES".

    I have created a Web monitoring element with step to check for pattern in the specific text, but it does not work as intented:
    1. If I use "*VIDEO_FREEZE|NO*", it just stays at status of "1" all the time, even if the value of it changes to "YES"
    2. If I use "VIDEO_FREEZE|NO", it stays at "0" all the time, even if it changes to "VIDEO_FREEZE|YES"


    How can I achieve the following? Is it possible to monitor this status file in some different way? (with Zabbix agent, analyzing it as log?)
  • aib
    Senior Member
    • Jan 2014
    • 1615

    #2
    Do you mind to try the way described on this conversation?
    Sincerely yours,
    Aleksey

    Comment

    • martinsm
      Junior Member
      • Jun 2011
      • 5

      #3
      Hi. Thanks for answer.

      Would it work in my case thou, since what I have is not really a log file where new entries are sequentially added, but a status file where the specific elements exist and are replaced in case something fails?

      Comment

      • aib
        Senior Member
        • Jan 2014
        • 1615

        #4
        Well, you also have the way which use Zabbix_agent UserParameter key and additional item/trigger configured on Zabbix server for that host

        1) Add line to zabbix_agent.conf on client's PC
        UserParameter=video.freeze, grep VIDEO_FREEZE status.txt | awk '{split($0,array,"|")} END{print array[2]}'

        2) restart zabbix_agent

        3) add New Item in host configuration on Zabbix Server
        name: Video Freezing Control
        type: Zabbix Agent
        key: video.freezing.control
        host interface: ....
        type of information: character
        data type: boolean
        ....... (rest of field has to be filled in usual way for your setup)

        4) create a trigger
        name: {HOST.NAME} video was freezed in last 5 check
        expression: {(name_of_PC):video.freezing.control.max(#5)}=0
        ....... (rest of field has to be filled in usual way for your setup)


        For Windows agent the UserParameter line has to be changed, but nothing hard to do.

        Let me know if this way works for you.
        Sincerely yours,
        Aleksey

        Comment

        • martinsm
          Junior Member
          • Jun 2011
          • 5

          #5
          Aib - thanks for your help, will use your example in future. I have an use case for it in mind. <3

          I got this working with Web Scenarios - basically, I removed the special symbols "_", "|" from text, left just dash ("-"), and it started working as supposed to. I reckon there's some incompatibility with either of these 2 symbols existing in the pattern.

          So now my text is "VIDEO-FREEZE-YES" instead of "VIDEO_FREEZE|YES", and the Web scenario checks for patterns work as intended.

          Comment

          • aib
            Senior Member
            • Jan 2014
            • 1615

            #6
            Good for you!
            Nice to hear that you solve your problem.
            Sincerely yours,
            Aleksey

            Comment

            Working...