Ad Widget

Collapse

Monitor curl result..

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • marcos.schimidt
    Junior Member
    • Apr 2019
    • 18

    #1

    Monitor curl result..

    I have one script linux to monitor one service web, follows the command line:
    curl -s -X POST -H "Content-Type: application/json" -d '{ "username" : "observer.test", "password": "t3st@1234"}' https://mywebsite.com/mobile/login-usb/login | egrep '"CODE_ACCOUNT_USB" : 3359850'

    After execute this command, I see the result -->> CODE_ACCOUNT_USB" : 3359850'

    I need zimbra understand result is OK

    Thanks all
  • marcos.schimidt
    Junior Member
    • Apr 2019
    • 18

    #2
    PS: I did some tests without success :/

    Comment

    • brunohl
      Senior Member
      Zabbix Certified Specialist
      • Mar 2019
      • 215

      #3
      If you already have a script that does it, you could create a UserParameter:

      Comment

    • marcos.schimidt
      Junior Member
      • Apr 2019
      • 18

      #4
      So,
      I made the creation in my /etc/zabbix/zabbix_agentd.conf of the parameter:

      UserParameter=weblogiccpf.questions,curl -s -X POST -H "Content-Type: application/json" -d '{ "username" : "observer.test", "password": "t3st@1234"}' https://mywebsite.com/mobile/login-usb/login | egrep '"CODE_ACCOUNT_USB" : 3359850'

      Restart Zabbix agent
      After i execute, and output return is OK
      [root@zabbix ~]# zabbix_agentd -t mysql.questions
      weblogiccpf.questions [t| "CODE_ACCOUNT_USB" : 3359850,]

      Now, I do not understand, how do I monitor "alert" in zabbix, can you help me ??

      thank's

      Comment

      • brunohl
        Senior Member
        Zabbix Certified Specialist
        • Mar 2019
        • 215

        #5
        I really don't understand what you said, if the command worked or not. I would advise you, when the UserParameter gets too complicated as in yout case, to separate logic in a bash script, like:
        Code:
        UserParameter=weblogiccpf.questions,/etc/zabbix/weblogiccpf-questions.sh
        But if it is working and you'd like to keep as that, that's ok.

        The next step:
        Now you have to write a trigger to check for a determined string inside an item value (https://www.zabbix.com/documentation...gers/functions), look at the "str".

        Comment

        • kloczek
          Senior Member
          • Jun 2006
          • 1771

          #6
          Originally posted by marcos.schimidt
          I have one script linux to monitor one service web, follows the command line:
          curl -s -X POST -H "Content-Type: application/json" -d '{ "username" : "observer.test", "password": "t3st@1234"}' https://mywebsite.com/mobile/login-usb/login | egrep '"CODE_ACCOUNT_USB" : 3359850'

          After execute this command, I see the result -->> CODE_ACCOUNT_USB" : 3359850'

          I need zimbra understand result is OK
          Zabbix uses curl library in many agent keys and in webcheck.
          I'm almost sure that instead trying to use you script you should straight go to use webcheck.
          http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
          https://kloczek.wordpress.com/
          zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
          My zabbix templates https://github.com/kloczek/zabbix-templates

          Comment

          • marcos.schimidt
            Junior Member
            • Apr 2019
            • 18

            #7
            Hi..

            Problem solved
            Thank's all

            Comment

            Working...