Ad Widget

Collapse

Output from a curl command using system.run

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • emcevoy
    Junior Member
    Zabbix Certified Specialist
    • Nov 2015
    • 1

    #1

    Output from a curl command using system.run

    I have an active Zabbix item running a curl command on my server.

    Code:
    system.run[curl http://localhost:8080/mypage]
    When I run this curl command manually the output is a number.

    but in Zabbix I get:

    Code:
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
    100     3  100     3    0     0    434      0 --:--:-- --:--:-- --:--:--   500
    146
    The only thing I want to see is the '146' at the end, can I stop Zabbix from outputting the other information.

    Preferably I would like the data type to be numeric - decimal but I'm having to set it to text for the item to work. Am I going about this the wrong way?
  • Firm
    Senior Member
    • Dec 2009
    • 342

    #2
    Try to redirect stderr output of curl to /dev/null by adding 2> /dev/null at the end. Or even use -s switch.
    Last edited by Firm; 15-01-2016, 09:41.

    Comment

    • shahrizalz
      Junior Member
      • Apr 2021
      • 1

      #3
      Originally posted by emcevoy
      I have an active Zabbix item running a curl command on my server.

      Code:
      system.run[curl http://localhost:8080/mypage]
      When I run this curl command manually the output is a number.

      but in Zabbix I get:

      Code:
      % Total % Received % Xferd Average Speed Time Time Time Current
      Dload Upload Total Spent Left Speed
      
      0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
      100 3 100 3 0 0 434 0 --:--:-- --:--:-- --:--:-- 500
      146
      The only thing I want to see is the '146' at the end, can I stop Zabbix from outputting the other information.

      Preferably I would like the data type to be numeric - decimal but I'm having to set it to text for the item to work. Am I going about this the wrong way?
      Try add flag '-s' beetwen the curl and url. That's for silent curl

      Comment

      • jsrozo
        Junior Member
        • May 2023
        • 6

        #4
        If you change the type of result for numeric in box Type of information, maybe work.
        I created preprocessing rule and done, but my situation is a result json.

        Comment

        Working...