[Zabbix] Citrix Xenserver 监控

时间:2024-03-22 10:07:59

一、SNMP 方式监控

1xenserver 开启SNMP

# 参考 http://www.fucking-it.com/articles/xenserver/50-xenserver-snmp-installation

# vi /etc/sysconfig/iptables

 

-A RH-Firewall-1-INPUT -m conntrack --ctstate NEW -m udp -p udp --dport 161 -j ACCEPT

 

Add the above line before the lines below:

-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT

 

Restart the iptables firewall service through the command below.

# service iptables restart

 

Edit the SNMP configuration file on your server with the command below.

# vi /etc/snmp/snmpd.conf

 

Locate and change the public community in the line below.

com2sec notConfigUser  default public

 

To the name of a desired community.

com2sec notConfigUser  default VegetaRocks

 

Execute the following commands to restart the SNMP and configure SNMP to start automatically with your computer.

# service snmpd restart

# chkconfig snmpd on

On a Linux computer, install the snmpwalk utility and test the SNMP configuration using the following commands.

 

# apt-get install snmp

# snmpwalk –v1 –c VegetaRocks 10.10.10.10

  • Change the name of SNMP community VegetaRocks to the desired name
  • Change the IP for the IP address of your device.

CONCLUSION

This tutorial presented the SNMP service installation process on a Xenserver..

 

2WEB 端配置

[Zabbix] Citrix Xenserver 监控

[Zabbix] Citrix Xenserver 监控

 


 

二、MonitoringCitrix XENSERVER Host and VMs based on Python XENApi

参考:https://share.zabbix.com/cat-app/cluster/monitoring-citrix-xenserver-host-and-vms-based-on-pyton-xenapi

Following steps on zabbix server or zabbix proxy

1. Download Pyton XENApi.py from https://github.com/xapi-project/xen-api/tree/master/scripts/examples/python. Please use the last version, becaus of ssl support changes in pyton

 

2. Copy file XENApi.py to directory /usr/local/lib/python

If you want to change, please change line sys.path.append('/usr/local/lib/python') also!

 

3. Copy citrix.xenserver.py from attached archive to you externel script path and set userrights (chmod 755).

4. Import the templates

zbx_template_xenserver_host.xml -->Monitoring XEN Host

zbx_template_xenserver_vm.xml --> Monitoring XEN VMs

Please note, the the name in zabbix and the name in xen have to be the same!

 

5. Set macros (Global on on all host you use this templates)

{$XENMASTER} -->Masterserver of XENCLUSTER

{$XENUSERNAME} --> Username for connect to XENCLUSTER

{$XENPASSWORD} --> Password for connect to XENCLUSTER

 

Important note:

If you test this script by executing as root it will be created an cachefile as user root. So, if zabbix later start this script as user user zabbix or www-data, the old cache file (creates by user root) can not open for writing. This script will exit with error!!!!!!!!!

 

Used python modules in citrix.xenserver.py:

import urllib2

import xml.dom.minidom

import sys, time

import itertools

import re

import shutil

import ssl

import getopt

import os

import fcntl

import logging

import logging.handlers

Used python modules in XemAPI.py:

import gettext

import xmlrpclib

import httplib

import socket

import sys