Ad Widget

Collapse

Citrix xenserver 5.5

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rboersma
    Junior Member
    • Jan 2010
    • 29

    #1

    Citrix xenserver 5.5

    Hi all,

    I'm trying to compile the zabbix_agentd for Citrix xenserver 5.5 using the SDK VM, which you can download here:


    After compiling i'm trying to manually start the zabbix agent:
    [root@servername init.d]# ./zabbix-agentd start
    /usr/local/sbin/zabbix-agentd not installed
    which is there and executable:
    [root@servername sbin]# ls
    zabbix_agent zabbix_agentd
    when starting it from sbin:

    [root@servername sbin]# zabbix_agent
    zabbix_agent [2992]: Cannot open config file [/etc/zabbix/zabbix_agent.conf] [No such file or directory].

    Any suggestions? Also zabbix only wants to run as a user, but with citrix xenserver everything runs as root.

    best regards,

    Ruud
  • Firm
    Senior Member
    • Dec 2009
    • 342

    #2
    What does 'ls -l /usr/local/sbin/zabbix-agentd' show? It seems that /etc/zabbix/zabbix_agent.conf doesn't exist.

    Comment

    • rboersma
      Junior Member
      • Jan 2010
      • 29

      #3
      Hi,
      that shows:
      ls: /usr/local/sbin/zabbix-agentd: No such file or directory

      but it is there:
      [root@server zabbix]# cd /usr/local/sbin
      [root@server sbin]# ls
      zabbix_agent zabbix_agentd
      [root@server sbin]#

      Same counts for /etc/zabbix/zabbix_agentd.conf. The file is present.

      Comment

      • elvar
        Senior Member
        • Feb 2008
        • 226

        #4
        Originally posted by rboersma
        Hi all,

        I'm trying to compile the zabbix_agentd for Citrix xenserver 5.5 using the SDK VM, which you can download here:


        After compiling i'm trying to manually start the zabbix agent:
        [root@servername init.d]# ./zabbix-agentd start
        /usr/local/sbin/zabbix-agentd not installed
        which is there and executable:
        [root@servername sbin]# ls
        zabbix_agent zabbix_agentd
        when starting it from sbin:

        [root@servername sbin]# zabbix_agent
        zabbix_agent [2992]: Cannot open config file [/etc/zabbix/zabbix_agent.conf] [No such file or directory].

        Any suggestions? Also zabbix only wants to run as a user, but with citrix xenserver everything runs as root.

        best regards,

        Ruud

        Very excited to see someone else wanting to put a zabbix agent on Xenserver 5.5. I tried doing this too but the Xenserver 5.5 environment seems to be very controlled and restricted. I'm eager to see if you get this going without breaking anything.

        Comment

        • elvar
          Senior Member
          • Feb 2008
          • 226

          #5
          Originally posted by rboersma
          Hi,
          that shows:
          ls: /usr/local/sbin/zabbix-agentd: No such file or directory

          but it is there:
          [root@server zabbix]# cd /usr/local/sbin
          [root@server sbin]# ls
          zabbix_agent zabbix_agentd
          [root@server sbin]#

          Same counts for /etc/zabbix/zabbix_agentd.conf. The file is present.

          Did you try running specifying the config file manually?

          SYNOPSIS
          zabbix_agentd [-hpV] [-c config-file ] [-t metric]

          Comment

          • deejay24
            Junior Member
            Zabbix Certified Specialist
            • Dec 2009
            • 6

            #6
            Citrix xenserver 5.5

            Hi,

            i am using the zabbix-agent on my xenserver 5.5 system and it worked well.

            Have you created an zabbix user ?
            Is the directory / config file existent ?
            Are the user rights for the files correct ?

            And later on ...

            You have to edit some things for the firewall of the server.

            In a few hours i can post a complete install instruction for installing the zabbix agent on xenserver.

            best regards,

            deejay24

            Comment

            • elvar
              Senior Member
              • Feb 2008
              • 226

              #7
              Originally posted by deejay24
              Hi,

              i am using the zabbix-agent on my xenserver 5.5 system and it worked well.

              Have you created an zabbix user ?
              Is the directory / config file existent ?
              Are the user rights for the files correct ?

              And later on ...

              You have to edit some things for the firewall of the server.

              In a few hours i can post a complete install instruction for installing the zabbix agent on xenserver.

              best regards,

              deejay24

              That would be greatly appreciated!

              Comment

              • deejay24
                Junior Member
                Zabbix Certified Specialist
                • Dec 2009
                • 6

                #8
                HI,

                here are some install instructions

                ... my logfiles for zabbix are in /var/log/zabbix ;-)


                you have to use a special zabbix agent !!
                (bulid fo xenserver, i use a self compiled 1.4.4)

                copy zabbix agent files to /usr/local/sbin
                (zabbix_agent, zabbix_agentd, azbbix_sender)

                mkdir /etc/zabbix
                mkdir /var/log/zabbix

                copy existing zabbix_agent.conf to /etc/zabbix/
                copy existing init script to /etc/initd./

                useradd zabbix
                chown zabbix /var/log/zabbix
                chown zabbix /usr/local/sbin/zabbix*

                edit you init script
                edit the runlevel for your script via
                chkconfig --level 2345 zabbix-agentd on

                edit xenserver firewall via
                nano /etc/sysconfig/iptables

                add the line
                -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 10050 -j ACCEPT

                save this and restat the iptables service
                service iptables restart

                edit you zabbix_agentd.conf
                nano /etc/zabbix/zabbix_agentd.conf

                and last but not leased start your agent
                /etc/init.d/zabbix_agentd start
                and check via
                /tail -f /var/log/zabbix/zabbix_agentd.log

                So i hope this will help a bit.

                deejay24

                Comment

                • rboersma
                  Junior Member
                  • Jan 2010
                  • 29

                  #9
                  Thanks,
                  This is what i did so far:

                  I compiled the 1.8.1 version using the Xenserver 5.5 SDK virtual machine.
                  1. copy the src packages with winscp
                  2. log in as root on the sdk vm
                  3. untar the packages
                  4. ./configure --enable-agent --enable-static
                  5. make install
                  6. zabbix_agent and zabbix_agentd are created in /usr/local/sbin
                  7. copy the agents from the sdk box to the windows box and then to the xenserver 5.5 machine in usr/local/sbin
                  8. useradd zabbix on xenserver 5.5 no pwd supplied
                  9. chmod 755 zabbix_agent*
                  10. chown zabbix zabbix_agent*
                  11. mkdir /etc/zabbix
                  12 chown zabbix /etc/zabbix
                  13. copy zabbix_agentd.conf to /etc/zabbix
                  14. chown zabbix /etc/zabbix/zabbix-agentd.conf
                  15. mkdir /var/log/zabbix
                  16. chown zabbix /var/log/zabbix
                  17. copy existing init script to /etc/init.d
                  18 changed ZABBIX_AGENTD_BIN=/usr/sbin/zabbix-agentd in init script to ZABBIX_AGENTD_BIN=/usr/local/sbin/zabbix-agentd
                  19. edited /etc/sysconfig/iptables with line -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 10050 -j ACCEPT
                  20 restart iptables with "service iptables restart"

                  manually start agentd logged on as root:
                  ./zabbix_agentd start
                  /usr/local/sbin/zabbix-agentd not installed

                  The file /usr/local/sbin/zabbix_agentd is there. Have you got any idea what i'm doing wrong?

                  EDIT: totally missed the post made by Elvar. If agent started from /usr/local/sbin (so not using the init script) and set the -c /etc/zabbix/zabbix_agentd.conf it tried to start the agent.
                  Logfiles says "Cannot create PID file [/var/run/zabbix/zabbix_agentd.pid] [No such file or directory]"
                  So I created "mkdir /var/run/zabbix" and "chown zabbix /var/run/zabbix"
                  The agent actually starts now. Any idea why it cannot find the config on it's own?
                  And I'm not familiar with auto starting the agent at boot. how do I do that?
                  Last edited by rboersma; 29-01-2010, 09:32.

                  Comment

                  • deejay24
                    Junior Member
                    Zabbix Certified Specialist
                    • Dec 2009
                    • 6

                    #10
                    Hi,

                    here a bit of my /etc/init.d/zabbix-agentd

                    #!/bin/bash
                    # Zabbix Agentd for Xen Server
                    #
                    # chkconfig: - 50 50
                    # description: Zabbix Agentd
                    #
                    # processname: /usr/local/sbin/zabbix_agentd
                    # config: /etc/zabbix/zabbix_agentd.conf
                    # pidfile:

                    # source function library
                    . /etc/init.d/functions

                    RETVAL=0
                    prog="zabbix_agentd"

                    start() {
                    echo -n $"Starting $prog: "
                    if [ $UID -ne 0 ]; then
                    RETVAL=1
                    failure
                    else
                    daemon /usr/local/sbin/zabbix_agentd
                    RETVAL=$?
                    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/zabbix_agentd
                    fi;
                    echo
                    return $RETVAL
                    }


                    and in zabbix_agentd.conf

                    # Name of PID file
                    PidFile=/var/tmp/zabbix_agentd.pid

                    ... this works for me ...

                    Comment

                    • rboersma
                      Junior Member
                      • Jan 2010
                      • 29

                      #11
                      files

                      Hi,

                      I want toattached the files that are needed to run the zabbix agent on xenserver 5.5, but the forum does not allow it. Please let me no where to send them.
                      The files are compiled on the xenserver 5.5 SDK virtual machine.

                      I have tested the agent succesfully.

                      Ruud Boersma
                      Last edited by rboersma; 29-01-2010, 15:15.

                      Comment

                      • rboersma
                        Junior Member
                        • Jan 2010
                        • 29

                        #12
                        One last thing.
                        everything seems to work fine for now except one strange thing.
                        The zabbix hosts commmunicates with the agent and sees what version of the agent is running. But it also tells me it cannot communicate with the agent.
                        Number of running processes zabbix-agentd 0 (is red error on host)
                        Version of zabbix-agent(d) running 1.8.1 ( it sees this version info and all other info that is within the default linux template)

                        Any suggestions?

                        Comment

                        • cybernijntje
                          Junior Member
                          • Sep 2008
                          • 16

                          #13
                          Our zabbix XenServer installation

                          Copy the zabbix client (X:\Install\Apps\Linux\Zabbix_client\zabbix_client .tar.gz)
                          to the /tmp directory of the Xenhost. Then execute the following commands:

                          svr-zen5[xx] # cd /tmp
                          svr-zen5[xx] # tar -zxvf zabbix_client.tar.gz
                          svr-zen5[xx] # mkdir –p /usr/local/zabbix/bin
                          svr-zen5[xx] # cd zabbix
                          svr-zen5[xx] # mv zabbix_agentd /usr/local/zabbix/bin/
                          svr-zen5[xx] # mkdir /etc/zabbix
                          svr-zen5[xx] # mv zabbix_agentd.conf /etc/zabbix/
                          svr-zen5[xx] # mv zabbix_agent /etc/rc.d/init.d/
                          svr-zen5[xx] # cp /etc/zabbix/zabbix_agentd.conf \
                          /etc/zabbix/zabbix_agentd.conf.orig
                          svr-zen5[xx] # vi /etc/zabbix/zabbix_agentd.conf

                          # This is config file for zabbix_agentd
                          # To get more information about ZABBIX, go http://www.zabbix.com

                          ############ GENERAL PARAMETERS #################

                          # List of comma delimited IP addresses (or hostnames) of ZABBIX servers.
                          # No spaces allowed. First entry is used for sending active checks.
                          # Note that hostnames must resolve hostname->IP address and
                          # IP address->hostname.

                          Server=10.85.207.60

                          # Server port for sending active checks

                          ServerPort=10051

                          # Unique hostname. Required for active checks.

                          Hostname=SVR-Zen[xx]

                          # Disable active checks. The agent will work in passive mode listening server.

                          DisableActive=1

                          # Specifies debug level
                          # 0 - debug is not created
                          # 1 - critical information
                          # 2 - error information
                          # 3 - warnings (default)
                          # 4 - for debugging (produces lots of information)

                          DebugLevel=1

                          ####### USER-DEFINED MONITORED PARAMETERS #######
                          UserParameter=xe.vmcountup,expr `sudo /opt/xensource/bin/xe vm-list | grep running | wc –l` - 1
                          UserParameter=xe.vmcountdown,sudo /opt/xensource/bin/xe vm-list | grep halted | wc –l


                          svr-zen5[xx] # cp /etc/sudoers /etc/sudoers.orig
                          svr-zen5[xx] # vi /etc/sudoers


                          #Defaults requiretty

                          # User privilege specification
                          zabbix ALL = NOPASSWD: /opt/xensource/bin/xe vm-list


                          svr-zen5[xx] # cp /etc/rc.d/init.d/zabbix_agent \
                          /etc/rc.d/init.d/zabbix_agent.orig
                          svr-zen5[xx] # vi /etc/rc.d/init.d/zabbix_agent

                          #!/bin/sh
                          #
                          # Zabbix agent start/stop script.
                          #
                          # Written by Alexei Vladishev <[email protected]>.

                          PATH=/bin:/usr/bin:/sbin:/usr/sbin:/home/zabbix/bin
                          DAEMON=/usr/local/zabbix/bin/zabbix_agentd
                          CONFIG=/etc/zabbix/zabbix_agentd.conf
                          NAME=zabbix_agentd
                          DESC="Zabbix agent"
                          PID=/var/tmp/$NAME.pid

                          test -f $DAEMON || exit 0

                          set -e

                          case "$1" in
                          start)
                          echo "Starting $DESC: $NAME"
                          $DAEMON -c $CONFIG
                          ;;
                          stop)
                          echo "Stopping $DESC: $NAME"
                          ps -ef| grep -iv grep | grep $NAME|awk '{print$2}'| xargs kill
                          ;;
                          restart|force-reload)
                          #
                          # If the "reload" option is implemented, move the "force-reload"
                          # option to the "reload" entry above. If not, "force-reload" is
                          # just the same as "restart".
                          #
                          echo -n "Restarting $DESC"
                          ps -ef| grep -iv grep | grep $NAME|awk '{print$2}'| xargs kill
                          sleep 2
                          $DAEMON -c $CONFIG
                          ;;
                          *)
                          N=/etc/init.d/$NAME
                          # echo "Usage: $N {start|stop|restart|force-reload}" >&2
                          echo "Usage: $N {start|stop|restart|force-reload}" >&2
                          exit 1
                          ;;
                          esac
                          exit 0


                          svr-zen5[xx] # chmod 755 /etc/init.d/zabbix_agent
                          svr-zen5[xx] # cp /etc/rc.d/rc.local /etc/rc.d/rc.local.orig
                          svr-zen5[xx] # vi /etc/rc.d/rc.local

                          add the following rule:
                          /usr/local/zabbix/bin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf

                          svr-zen5[xx] # cp /etc/sysconfig/iptables /etc/sysconfig/iptables.orig
                          svr-zen5[xx] # vi /etc/sysconfig/iptables

                          # Firewall configuration written by system-config-securitylevel

                          -A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 694 -j ACCEPT
                          -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
                          -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
                          -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
                          -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 6600 -j ACCEPT
                          -A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
                          COMMIT


                          svr-zen5[xx] # service iptables restart
                          svr-zen5[xx] # rm –rf /tmp/zabbix*
                          svr-zen5[xx] # /etc/init.d/zabbix_agent start



                          hope this helps

                          Comment

                          • elvar
                            Senior Member
                            • Feb 2008
                            • 226

                            #14
                            Thanks to all who posted info on getting the zabbix agent working on XenServer. It's working great so far!




                            Kind regards,

                            Comment

                            • elvar
                              Senior Member
                              • Feb 2008
                              • 226

                              #15
                              Anyone been able to compile Zabbix Agent 1.8.3 inside the XenServer 5.6 SDK VM and get it to run? When I run it on my Xenserver 5.6 it crashes...

                              [root@xs01 init.d]# /usr/local/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
                              Segmentation fault


                              *** UPDATE ***

                              Changed ownership of /usr/local/sbin/zabbix_agentd to zabbix:zabbix and it runs fine.

                              *** UPDATE 2 ***
                              If I run as user zabbix it doesn't segfault. If I run as root it segfaults.
                              Last edited by elvar; 27-08-2010, 08:46. Reason: Updates

                              Comment

                              Working...