Ad Widget

Collapse

External Scripts Unsupported - Timed out.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • troseph
    Junior Member
    • Mar 2013
    • 10

    #1

    External Scripts Unsupported - Timed out.

    I have a problem with a couple external scripts I'm trying to use to gather metrics from nginx status page. Script looks like this:

    Code:
    #!/bin/sh
    # Set Variables
    runfunc=$1
    hostIP=$2
    port="80"
    ftch="curl -s "
    #ftch="wget -O- -q "
    # Functions to return nginx stats
    function active {
            $ftch "http://$hostIP:$port/nginx_status" | grep 'Active' | awk '{print $NF}'
            }
    
    function reading {
            $ftch "http://$hostIP:$port/nginx_status" | grep 'Reading' | awk '{print $2}'
            }
    
    function writing {
            $ftch "http://$hostIP:$port/nginx_status" | grep 'Writing' | awk '{print $4}'
            }
    
    function waiting {
            $ftch "http://$hostIP:$port/nginx_status" | grep 'Waiting' | awk '{print $6}'
            }
    
    function accepts {
            $ftch "http://$hostIP:$port/nginx_status" | awk NR==3 | awk '{print $1}'
            }
    
    function handled {
            $ftch "http://$hostIP:$port/nginx_status" | awk NR==3 | awk '{print $2}'
            }
    
    function requests {
            $ftch "http://$hostIP:$port/nginx_status" | awk NR==3 | awk '{print $3}'
            }
    # Run the requested function
    $runfunc
    Runs fine in shell:
    Code:
    [zabbix@dev scripts]# time ./nginx_status.sh accepts dev02.local
    457
    
    real    0m0.018s
    user    0m0.000s
    sys     0m0.000s
    Key (external script):
    Code:
    nginx_status.sh["active","{HOST.HOST1}"]
    Yet I still get unsupported "timeout while executing a shell script" from zabbix. I've tried wget, curl, I've rewritten this in PHP, but zabbix will have nothing to do with it.

    Any ideas?
    Last edited by troseph; 21-05-2013, 00:35.
  • heaje
    Senior Member
    Zabbix Certified Specialist
    • Sep 2009
    • 325

    #2
    What data type is the item configured to receive? Is it set to be an unsigned integer? If so, is your item putting a newline character at the end of the line? That would cause it to not be supported (because a newline is definitely not a digit ).

    If what I mentioned above doesn't resolve the problem, try setting the data type to text to see if you can get data into the item at all (regardless of what Zabbix thinks it is). If that works, then you'll need to identify why Zabbix thinks that it isn't an unsigned integer (assuming that's what it should be).

    Comment

    • troseph
      Junior Member
      • Mar 2013
      • 10

      #3
      I'll try that, but it seems it's not even running the script. You're thinking zabbix would throw "timeout while executing a shell script" if the data type was wrong or it's not getting anything?

      Comment

      • troseph
        Junior Member
        • Mar 2013
        • 10

        #4
        still no love with it set as a text item not returning anything, going unsupported as soon as it runs.

        Comment

        • neogan
          Senior Member
          Zabbix Certified Trainer
          Zabbix Certified SpecialistZabbix Certified Professional
          • Sep 2011
          • 118

          #5
          What is zabbix_agent DEBUG=4 shows? Do you try zabbix_get?

          Comment

          Working...