Ad Widget

Collapse

Problem with Bash script as external check

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sebelk
    Member
    • Nov 2007
    • 72

    #1

    Problem with Bash script as external check

    Hi,
    I have a script that outputs the ssCpuRawUser which is as follows:
    #! /bin/bash

    IP="$1"

    export user=`snmpwalk -v2c "$IP" -OQvs -c "paparulo" 1.3.6.1.4.1.2021.11.50.0`



    export system=`snmpwalk -v2c "$IP" -OQvs -c "paparulo" 1.3.6.1.4.1.2021.11.52.0`



    export idle=`snmpwalk -v2c "$IP" -OQvs -c "paparulo" 1.3.6.1.4.1.2021.11.53.0`



    export waiting=`snmpwalk -v2c "$IP" -OQvs -c "paparulo" 1.3.6.1.4.1.2021.11.54.0`


    export TOTAL=`echo "$user" + "$system" + "$idle" + "$waiting" | bc`

    export peruser=`echo "$user" / "$TOTAL" \* 100| bc -l`

    EOF


    Well as documentation state hostname is passed as first parameter, but log says:

    13014:20071205:121109 Parameter [cpu-user.sh] is not supported by agent on host [Spectrum] Old status [0]

    I've tried to use something as simple as:

    #! /bin/bash
    echo "$1"


    And problem remains.

    Could you help me to fix that?

    Thanks in advance!
    Last edited by sebelk; 14-04-2008, 21:02. Reason: I wanted
  • vikty
    Senior Member
    • Jul 2007
    • 104

    #2
    Enable

    In the agentd config file there is a parameter that disable the external check

    To default
    Code:
    # Disable active checks. The agent will work in passive mode listening server.
    DisableActive=1
    comment the disable prameter
    Code:
    # Disable active checks. The agent will work in passive mode listening server.
    #DisableActive=1
    In second the script must be insert in the agent config file
    for example
    Code:
    UserParameter=system.test,who|wc -l
    Code:
    UserParameter=key,cmd
    or you can use the external check in items config section...

    Comment

    • Tenzer
      Senior Member
      • Nov 2007
      • 316

      #3
      There is a difference between active checks and external checks.
      - Active checks are run on the agent side, and the result is sent to the server, instead of the server polling from the client.
      - External check are run on the server, and can be used to check services from the server, which you can't set up in Zabbix, like a specific DB query.

      You should be aware that when using external checks, the host's name is passed on to the script, which means that either has to be a valid DNS hostname, or that host should be added in the servers hosts file. It doesn't seem like your code is optimized for this.
      There is a patch here on the forums for how to change the behavior of external checks, in order to make them use the IP/hostname defined for each host:

      Comment

      • vikty
        Senior Member
        • Jul 2007
        • 104

        #4
        SORRY
        Code:
        # Enable remote commands for ZABBIX agent. By default remote commands disabled.
        #EnableRemoteCommands=1
        I have inserted a bad line of the agent config file....

        Comment

        • freak
          Member
          • Oct 2007
          • 52

          #5
          No, remote commands again are not External Checks.
          Remote Commands allow the agent to execute just about any script on the host it runs on. (Note that it is in most cases insecure and dangerous to activate this..)

          External Checks are external scripts run by the server on the host the server runs on.

          i.e. a traceroute to the given monitored host.

          hth
          Sebastian

          Comment

          Working...