Ad Widget

Collapse

Zabbix Install Bash Script - *nux

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tekben
    Junior Member
    • Oct 2007
    • 5

    #1

    Zabbix Install Bash Script - *nux

    Hi guys,

    As I like this software a lot, I wrote a simple bash deploy script which get the source, compile, and run the agent.

    It's very basic but it works, feel free to improve it.

    Ps: don't forget to change the server IP and eventually the binaries location.

    Code:
    ###########################################
    ##
    ##	Zabbix Client install Script	 
    ##				
    ###########################################
    
    #!/bin/bash
    
    wget http://heanet.dl.sourceforge.net/sourceforge/zabbix/zabbix-1.4.2.tar.gz
    sleep 2
    
    tar xzf zabbix-1.4.2.tar.gz
    cd zabbix-1.4.2
    ./configure --enable-agent
    make
    make install
    
    echo "make complete"
    sleep 2
    
    groupadd zabbix
    useradd -c 'zabbix' -d /home/zabbix -g zabbix -s /dev/null zabbix
    
    echo "zabbix_agent 10050/tcp # Zabbix ports" >> /etc/services
    echo "zabbix_trap 10051/tcp" >> /etc/services
    
    echo Hostname=`uname -n` >> ./misc/conf/zabbix_agentd.conf
    
    mkdir /etc/zabbix/
    
    sed -e 's/Server=127.0.0.1/Server=XXXXXXXXXXX/g' ./misc/conf/zabbix_agentd.conf > /etc/zabbix/zabbix_agentd.conf
    
    chown -R zabbix.zabbix /etc/zabbix
    
    #Init Script
    sed -e 's/progdir=\"\/usr\/local\/zabbix\/bin\/\"/progdir=\"\/usr\/local\/bin\/\"/g' ./misc/init.d/redhat/8.0/zabbix_agentd > /etc/init.d/zabbix-agent
    chmod +x /etc/init.d/zabbix-agent
    
    #Debian
    #update-rc.d defaults zabbix-agent
    
    #Redhat
    chkconfig --add zabbix-agent
    
    /etc/init.d/zabbix-agent start
    
    
    #tail /tmp/zabbix_agentd.log
  • alj
    Senior Member
    • Aug 2006
    • 188

    #2
    This is evil ;-)

    Especially this:
    >echo "zabbix_agent 10050/tcp # Zabbix ports" >> /etc/services
    >echo "zabbix_trap 10051/tcp" >> /etc/services

    (how many zabbix lines you will have in /etc/services after couple installations?)

    Those procedures should be done via OS packaging.

    So zabbix deployment script should look like:

    Code:
    #!/bin/sh
    servers=x.x.x.x,y.y.y.y
    echo "zabbix-agent zabbix-agent/server string ${servers}" | debconf-set-selections
    apt-get install zabbix-agent
    or the same via yast/yum/whatever package system you use.

    Comment

    • tekben
      Junior Member
      • Oct 2007
      • 5

      #3
      Yeah Right for the OS packaging.

      just one last thing, I made this script for redhat and I could't find any RPM so...here's the way to simplify... a deployment.

      Comment

      • the_jaymz
        Junior Member
        • Sep 2007
        • 8

        #4
        RPMs are in the EPEL repository.

        Comment

        • tekben
          Junior Member
          • Oct 2007
          • 5

          #5
          Ok thanks, I'll have a look

          Comment

          • mcjohn87
            Junior Member
            • Aug 2009
            • 1

            #6
            thanks

            thanks so much for useful info
            script install

            Comment

            Working...