PDA

View Full Version : Citrix xenserver 5.5


rboersma
28-01-2010, 15:06
Hi all,

I'm trying to compile the zabbix_agentd for Citrix xenserver 5.5 using the SDK VM, which you can download here:
http://www.citrix.com/lang/English/lp/lp_1688621.asp

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
28-01-2010, 15:10
What does 'ls -l /usr/local/sbin/zabbix-agentd' show? It seems that /etc/zabbix/zabbix_agent.conf doesn't exist.

rboersma
28-01-2010, 15:24
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.

elvar
28-01-2010, 21:24
Hi all,

I'm trying to compile the zabbix_agentd for Citrix xenserver 5.5 using the SDK VM, which you can download here:
http://www.citrix.com/lang/English/lp/lp_1688621.asp

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. :)

elvar
28-01-2010, 21:28
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]

deejay24
29-01-2010, 04:50
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

elvar
29-01-2010, 05:25
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! :)

deejay24
29-01-2010, 06:35
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

rboersma
29-01-2010, 08:20
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?

deejay24
29-01-2010, 08:59
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 ...

rboersma
29-01-2010, 13:44
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

rboersma
29-01-2010, 15:16
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?

cybernijntje
03-02-2010, 07:42
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 <alexei.vladishev@zabbix.com>.

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

elvar
15-04-2010, 15:47
Thanks to all who posted info on getting the zabbix agent working on XenServer. It's working great so far!




Kind regards,

elvar
27-08-2010, 06:59
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.

Axilla
27-08-2010, 21:24
anyone want to share their zabbix agent compiled for XenServer?

elvar
27-08-2010, 21:52
I had no problems compiling 1.8.2 under the XenServer 5.5 SDK VM and running it. I'm only having issues with 1.8.3 compiled under XenServer 5.6 SDK VM. Not sure what the diff is though.

Axilla
27-08-2010, 23:53
So, I have the agent compiled and running... Using Xen SDK 5.6 and 1.8.2 agent...

Problem is I can't get the xenserver to talk to zabbix

Get value from agent failed: *** Cannot connect to [192.168.5.X]:10050 [No route to host]

Any ideas?

iptables --list

ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:10050

I can ping the XenServer but I can't telnet to it.

Axilla
28-08-2010, 01:35
So uh, nevermind.. Went home for the day, and it decided it wanted to start working =/. Really strange.

I want to pass on that this is working on XenServer 5.6 using the 5.6.0 SDK and a 1.8.2 Source

elvar
02-09-2010, 21:26
So uh, nevermind.. Went home for the day, and it decided it wanted to start working =/. Really strange.

I want to pass on that this is working on XenServer 5.6 using the 5.6.0 SDK and a 1.8.2 Source


What about 1.8.3? 1.8.3 segfaults for me in Xenserver 5.6

Axilla
02-09-2010, 23:55
What about 1.8.3? 1.8.3 segfaults for me in Xenserver 5.6

I am running 1.8.2 agents with 1.8.3 Zabbix in XenServer.

carl
30-10-2010, 17:45
Using "xe host-data-source-list" and "xe host-data-source-query" I made some basic UserParameter for xenserver below.

UserParameter=xe.vmcountup,sudo /opt/xensource/bin/xe vm-list | grep running | wc -l
UserParameter=xe.vmcountdown,sudo /opt/xensource/bin/xe vm-list | grep halted | wc -l
UserParameter=xe.memory_total_kib,sudo /opt/xensource/bin/xe host-data-source-query data-source=memory_total_kib
UserParameter=xe.memory_free_kib,sudo /opt/xensource/bin/xe host-data-source-query data-source=memory_free_kib
UserParameter=xe.xapi_memory_usage_kib,sudo /opt/xensource/bin/xe host-data-source-query data-source=xapi_memory_usage_kib
UserParameter=xe.xapi_free_memory_kib,sudo /opt/xensource/bin/xe host-data-source-query data-source=xapi_free_memory_kib
UserParameter=xe.xapi_live_memory_kib,sudo /opt/xensource/bin/xe host-data-source-query data-source=xapi_live_memory_kib
UserParameter=xe.xapi_allocation_kib,sudo /opt/xensource/bin/xe host-data-source-query data-source=xapi_allocation_kib
UserParameter=xe.cpu3,sudo /opt/xensource/bin/xe host-data-source-query data-source=cpu3
UserParameter=xe.cpu2,sudo /opt/xensource/bin/xe host-data-source-query data-source=cpu2
UserParameter=xe.cpu1,sudo /opt/xensource/bin/xe host-data-source-query data-source=cpu1
UserParameter=xe.cpu0,sudo /opt/xensource/bin/xe host-data-source-query data-source=cpu0
UserParameter=xe.loadavg,sudo /opt/xensource/bin/xe host-data-source-query data-source=loadavg

I will try to write more for xe vm-data-source-list and xe vm-data-source-query and update at http://slog.carlheaton.co.uk/index.php/2010/10/zabbix-for-xenserver-work-in-progress/

forlinuxsupport
05-04-2011, 15:49
I found this guide and it seems to work :)

http://slog.carlheaton.co.uk/index.php/2010/10/zabbix-agent-rpm-on-xenserver-5-6-dom0/