Ad Widget

Collapse

Agent on Debian 2.6.26-25lenny1 dont working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • osrevrep
    Junior Member
    • Dec 2015
    • 4

    #1

    Agent on Debian 2.6.26-25lenny1 dont working

    Hello, sorry for my bad english....

    I downloaded the pre-compiled agent from http://www.zabbix.com/downloads/2.4...._4.i386.tar.gz and extracted for my personal machine, copied all in /bin and /sbin folders for the server of I want to monitoring, copied all /conf files to /usr/local/etc folder in server. I make one file /etc/init.d/zabbix-agent that contains:

    #! /bin/sh
    counter=0
    zabbix_counter=$(ps -ef | grep zabbix_agentd | grep -v grep | wc -l)

    start(){
    echo "-------------------------------------------------------------------"
    echo " LAUNCHING ZABBIX AGENT"

    if [ $zabbix_counter -gt 0 ]; then
    echo " * Zabbix agent was previously running"
    echo " * Number of Zabbix agentd instances= $zabbix_counter"
    echo "-----------------------------------------------------------------"
    fi

    # Checking if the user is able to start the agent.... if the user is not able to, script performs su to
    # the user zabbix and starts the agent

    if [ $(whoami) != "zabbix" ];then
    sudo -u zabbix zabbix_agentd
    else
    # Script is acting as the zabbix user, so it can start the agent.
    zabbix_agentd
    fi
    sleep 10

    zabbix_counter=$(ps -ef | grep zabbix_agentd | grep -v grep | wc -l)
    if [ $zabbix_counter -gt 0 ]; then
    echo " * Zabbix agent succesfully started"
    echo " * Number of zabbix agentd instances= $zabbix_counter"
    echo "-------------------------------------------------------------------"
    else
    echo " * Zabbix agent couldn't be started, check Zabbix logs"
    echo "-------------------------------------------------------------------"
    fi

    }

    stop(){
    # Checking if the user is able to stop the agent.... if the user is not able to, script performs su to
    # the user zabbix and kills the agent. Also script tries to kill zabbix-agent processes 5 times using a counter, if at
    # the fith try the agent is still there, script outputs a message to the console.

    echo "-------------------------------------------------------------------"
    echo " STOPPING ZABBIX AGENT"

    if [ $zabbix_counter -eq 0 ]; then
    echo " * Zabbix agent was not running on this machine"
    echo "-------------------------------------------------------------------"
    fi

    while [ $zabbix_counter -gt 0 ] && [ $counter -lt 5 ] ; do

    let counter=counter+1

    echo " * Number of Attempts (Max 5)=$counter"
    echo " * Stopping zabbix.."
    echo " * Number of zabbix agentd instances= $zabbix_counter"

    if [ $(whoami) != "zabbix" ];then
    sudo -u zabbix killall zabbix_agentd > /dev/null &
    else
    killall zabbix_agentd > /dev/null &
    fi

    sleep 10
    # Script has a 10 second delay to avoid attempting to kill a process that is still shutting down. If the script
    # can't kill the processes, an error will appear.
    # After 10 seconds script checks again the number of zabbix_agentd processes running,
    # if it's 0, script will exit the loop and continue on

    zabbix_counter=$(ps -ef | grep zabbix_agentd | grep -v grep | wc -l)

    done

    if [ $zabbix_counter -gt 0 ]; then
    echo " * Zabbix agent couldn't be stopped, check Zabbix logs"
    echo "-------------------------------------------------------------------"
    fi

    if [ $zabbix_counter -eq 0 ]; then
    echo " * Zabbix agent successfully stopped"
    echo "-------------------------------------------------------------------"
    fi

    }

    restart(){
    stop
    # Gives system some time to stop processes before script restarts service
    sleep 10
    # Now script can start the agent again
    start
    }

    case "$1" in
    start)
    start
    ;;
    stop)
    stop
    ;;
    restart)
    restart
    ;;
    *)
    echo "Usage: zabbix {start|stop|restart}"
    exit 1
    esac

    exit 0

    After start the file zabbix agent dont communicate with the server.

    ps -ef | grep zabbix_agentd shows:

    zabbix 23918 1 0 15:10 ? 00:00:00 zabbix_agentd
    zabbix 23920 23918 0 15:10 ? 00:00:00 zabbix_agentd: collector [idle 1 sec]
    zabbix 23921 23918 0 15:10 ? 00:00:00 zabbix_agentd: listener #1 [waiting for connection]
    zabbix 23922 23918 0 15:10 ? 00:00:00 zabbix_agentd: listener #2 [waiting for connection]
    zabbix 23923 23918 0 15:10 ? 00:00:00 zabbix_agentd: listener #3 [waiting for connection]
    zabbix 23924 23918 0 15:10 ? 00:00:00 zabbix_agentd: active checks #1 [idle 1 sec]
    root 25130 23164 0 16:16 pts/0 00:00:00 grep zabbix_agentd

    My linux version is:

    Linux version 2.6.26-2-686-bigmem (Debian 2.6.26-25lenny1) ([email protected]) (gcc version 4.1.3 20080704 (prerelease) (Debian 4.1.2-25)) #1 SMP Thu Sep 16 20:29:07 UTC 2010



    I NEED HELP!
    Last edited by osrevrep; 15-12-2015, 16:08.
  • osrevrep
    Junior Member
    • Dec 2015
    • 4

    #2
    Help? Please!
    Last edited by osrevrep; 15-12-2015, 17:44.

    Comment

    • ingus.vilnis
      Senior Member
      Zabbix Certified Trainer
      Zabbix Certified SpecialistZabbix Certified Professional
      • Mar 2014
      • 908

      #3
      Hi,

      Start with checking the zabbix_agentd.conf file. Do you have correct values set in Hostname, Server and ServerActive parameters?

      Check firewall if it is not blocking the communication.

      Best Regards,
      Ingus

      Comment

      Working...