Ad Widget

Collapse

Trigger from Web Monitoring Required Field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • benjaminconnelly
    Junior Member
    • Jul 2012
    • 12

    #1

    Trigger from Web Monitoring Required Field

    I have created a Web Monitor to log in to ZoneMinder's XML skin and look for the required text <RUNNING>1</RUNNING> . I would like to create a trigger to alert me when either <RUNNING>0</RUNNING> is returned or if I understand the web monitor correctly when the step that <RUNNING>1</RUNNING> is required fails. How can I do this? I see that there are Items automatically created for web monitoring:

    .test.in[Scenario,Step,bps]
    .test.time[Scenario,Step]
    .test.rspcode[Scenario,Step]

    But not one for Required...

    Also, just in case anyone is having trouble with POST I used this:

    Variables:
    {user}=username
    {password}=password

    Post:
    username={user}&password={password}&action=login
  • Yello
    Senior Member
    • Apr 2011
    • 309

    #2
    Have a look at web.test.fail.

    Regards,
    David

    Comment

    • benjaminconnelly
      Junior Member
      • Jul 2012
      • 12

      #3
      That doesn't seem to be what I am looking for. web.test.fail returns an integer based on the number of steps that fail.

      I want to use the output of XML based on the Required fiels. <RUNNING>1</RUNNING> means the apps is running, <RUNNING>0</RUNNING> means the app has stopped and should be restarted. Can this be done? Am I going about it the wrong way?

      Comment

      • Yello
        Senior Member
        • Apr 2011
        • 309

        #4
        Originally posted by benjaminconnelly
        That doesn't seem to be what I am looking for. web.test.fail returns an integer based on the number of steps that fail.

        I want to use the output of XML based on the Required fiels. <RUNNING>1</RUNNING> means the apps is running, <RUNNING>0</RUNNING> means the app has stopped and should be restarted. Can this be done? Am I going about it the wrong way?
        First of all, the implementation of web scenarios isn't ideal. You want an item that explicitly captures that the page content hasn't loaded correctly. There isn't one. However, I think you can simulate this...

        If you have a check to confirm that the httpd daemon is working correctly you can then "assume" this (pseudo-code):

        if (web.test.fail(scenario) & http protocol is up & data has been received for scenario)
        then
        assume that page has errored
        fi

        But really, if you want more control then you'll need to use an external tool like selenium and push the data back to the server via zabbix_sender. Also, if you have specific requirements for web scenarios I recommend that you raise a feature request.


        Regards,
        David

        Comment

        • trikke
          Senior Member
          • Aug 2007
          • 140

          #5
          HI Benjamin,

          In that case i set up an item:

          Type: Zabbix Agent
          Key: system.run[curl <put your parms here>]
          Type of Information: TEXT

          And then put a trigger on the result!

          greets
          Patrick

          Comment

          • benjaminconnelly
            Junior Member
            • Jul 2012
            • 12

            #6
            I was able to do a curl POST and then grep with Perl expressions turned on as sh did not love awk or sed or cut very much. I did this as a userparameter and then created an action if less than 1 was returned.

            Thank you both for your ideas. I have learned this last two weeks there is 30 ways to do the same thing in zabbix.
            Last edited by benjaminconnelly; 04-07-2012, 23:52.

            Comment

            • benjaminconnelly
              Junior Member
              • Jul 2012
              • 12

              #7
              Here is the userparameter if anyone is interested. This will cut output between XML output.

              curl -s --data 'username=blah&password=blah&action=login' 'http://192.x.x.x/xmlpage.xml' | grep -Po '<XMLTGAG>\K.*?(?=<.*?>)'

              Yay for Perl regex in grep!

              Comment

              Working...