# 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=80.93.83.31,80.93.83.32,80.93.83.33,80.93.83.34,80.93.83.38,80.93.83.39,80.93.83.100,80.93.83.101,80.93.83.102,80.93.83.103,80.93.83.104,80.93.83.105,80.93.83.106,80.93.83.107,80.93.83.108,80.93.83.109,80.93.83.110,80.93.83.111,80.93.83.112,80.93.83.113,80.93.83.114,80.93.83.115,80.93.83.116,80.93.83.117,80.93.83.118,80.93.83.119,80.93.83.120,80.93.83.121,80.93.83.122,80.93.83.123,80.93.83.124,80.93.83.125,80.93.83.126,80.93.83.127,80.93.83.128,80.93.83.129,80.93.83.130

# Server port for sending active checks

ServerPort=10051

# Unique hostname. Required for active checks.

Hostname=changehost

# Listen port. Default is 10050

ListenPort=10050

# IP address to bind agent
# If missing, bind to all available IPs

#ListenIP=127.0.0.1

# Source IP address for outgouing connections
#SourceIP=

# Number of pre-forked instances of zabbix_agentd.
# Default value is 5
# This parameter must be between 1 and 16

StartAgents=5

# How often refresh list of active checks. 2 minutes by default.

#RefreshActiveChecks=120

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

DisableActive=1

# Enable remote commands for ZABBIX agent. By default remote commands disabled.

EnableRemoteCommands=0

# 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=3

# Name of PID file

PidFile=/var/tmp/zabbix_agentd.pid

# Name of log file.
# If not set, syslog will be used

LogFile=/var/log/zabbix/zabbix_agentd.log

# Maximum size of log file in MB. Set to 0 to disable automatic log rotation.
LogFileSize=10

# Spend no more than Timeout seconds on processing
# Must be between 1 and 30

Timeout=3

####### USER-DEFINED MONITORED PARAMETERS #######
# Format: UserParameter=<key>,<shell command>
# Note that shell command must not return empty string or EOL only
#UserParameter=system.test,who|wc -l


#SYSTEM MONITORING
UserParameter=mdstat[*],grep -A1 $1 /proc/mdstat | grep -c _
UserParameter=ram.used,free -bt | grep Mem: | awk '{print $3'}
UserParameter=swap.used,free -bt | grep Swap: | awk '{print $3'}

#HARDWARE MONITORING
UserParameter=smartctl[*],grep $1 /var/log/zabbix/daily_results | cut -d":" -f2 |tr -d " "
UserParameter=sas2ircu.raid.status,sudo /usr/local/bin/sas2ircu 0 STATUS | grep -c Optimal

#SOFTWARE MONITORING
UserParameter=kernelver,uname -r | tr -d " "
UserParameter=rkhunter,grep RKHunter /var/log/zabbix/daily_results | cut -d":" -f2 |tr -d " "
UserParameter=queue[*],grep $1 /var/log/zabbix/hourly_results | cut -d":" -f2 |tr -d " "
UserParameter=vzlic.expiration,export vzlicexpiration=`/usr/sbin/vzlicview |grep expiration|head -n1|cut -d '"' -f2` && export vzlicexp_unix=`date --date="$vzlicexpiration CET" +%s |tr -d " "` && export now_unix=`date +%s` && expr $vzlicexp_unix - $now_unix |tr -d " "
UserParameter=checkvip,cat /var/log/zabbix/checkvip.log |tr -d " " 

#DISK STATS MONITORING
UserParameter=custom.vfs.dev.read.ops[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$4}'
UserParameter=custom.vfs.dev.read.ms[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$7}'
UserParameter=custom.vfs.dev.write.ops[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$8}'
UserParameter=custom.vfs.dev.write.ms[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$11}'
UserParameter=custom.vfs.dev.io.active[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$12}'
UserParameter=custom.vfs.dev.io.ms[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$13}'
UserParameter=custom.vfs.dev.read.sectors[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$6}'
UserParameter=custom.vfs.dev.write.sectors[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$10}'

# MYSQL MONITORING
### Set of parameter for monitoring MySQL server (v3.23.42 and later)
### Change -u<username> and add -p<password> if required
UserParameter=mysql.ping,mysqladmin -umysqluser -pmysqlpasswd ping|grep alive|wc -l|tr -d " "
UserParameter=mysql.uptime,mysqladmin -umysqluser -pmysqlpasswd status|cut -f2 -d":"|cut -f1 -d"T"|tr -d " "
UserParameter=mysql.threads,mysqladmin -umysqluser -pmysqlpasswd status|cut -f3 -d":"|cut -f1 -d"Q"|tr -d " "
UserParameter=mysql.questions,mysqladmin -umysqluser -pmysqlpasswd status|cut -f4 -d":"|cut -f1 -d"S"|tr -d " "
UserParameter=mysql.slowqueries,mysqladmin -umysqluser -pmysqlpasswd status|cut -f5 -d":"|cut -f1 -d"O"|tr -d " "
UserParameter=mysql.qps,mysqladmin -umysqluser -pmysqlpasswd status|cut -f9 -d":"|tr -d " "
UserParameter=mysql.version,mysql -V |cut -f1 -d","|cut -f2 -d"b"|cut -f2 -d" "|tr -d " "
UserParameter=mysql.replstatus,echo "show slave status \G" | mysql -umysqluser -pmysqlpasswd | grep -i 'Seconds_Behind_Master' | cut -f2 -d':' | tr -d " "
UserParameter=mysql.slaverunning,mysqladmin -umysqluser -pmysqlpasswd extended-status | grep -i 'Slave_running' | cut -f3 -d'|' | sed "s/OFF/0/; s/ON/1/"

#APACHE MONITORING : /!\ NEED mod_status /!\
UserParameter=apache.accesses,wget --quiet -O - http://localhost/server-status?auto | head -n 9 | grep Accesses | cut -d " " -f 3
UserParameter=apache.totalkb,wget --quiet -O - http://localhost/server-status?auto | head -n 9 | grep kBytes | cut -d " " -f 3
UserParameter=apache.cpuload,wget --quiet -O - http://localhost/server-status?auto | head -n 9 | grep CPULoad | cut -d " " -f 2
UserParameter=apache.uptime,wget --quiet -O - http://localhost/server-status?auto | head -n 9 | grep Uptime | cut -d " " -f 2
UserParameter=apache.reqpersec,wget --quiet -O - http://localhost/server-status?auto | head -n 9 | grep ReqPerSec | cut -d " " -f 2
UserParameter=apache.bytespersec,wget --quiet -O - http://localhost/server-status?auto | head -n 9 | grep BytesPerSec | cut -d " " -f 2
UserParameter=apache.bytesperreq,wget --quiet -O - http://localhost/server-status?auto | head -n 9 | grep BytesPerReq | cut -d " " -f 2
UserParameter=apache.busyworkers,wget --quiet -O - http://localhost/server-status?auto | head -n 9 | grep BusyWorkers | cut -d " " -f 2
UserParameter=apache.idleworkers,wget --quiet -O - http://localhost/server-status?auto | head -n 9 | grep IdleWorkers | cut -d " " -f 2
