From 903736c78fdee9a4e510320d64fca101ae91316d Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 14 Jun 2012 12:16:52 +0200 Subject: [PATCH] premier commit --- createlinks | 20 + .../defaults/zabbix-agent/RemoteCommands | 1 + .../configuration/defaults/zabbix-agent/ServerPort | 1 + .../db/configuration/defaults/zabbix-agent/Servers | 1 + .../db/configuration/defaults/zabbix-agent/TCPPort | 1 + .../db/configuration/defaults/zabbix-agent/access | 1 + .../db/configuration/defaults/zabbix-agent/active | 1 + .../db/configuration/defaults/zabbix-agent/passive | 1 + .../db/configuration/defaults/zabbix-agent/status | 1 + .../db/configuration/defaults/zabbix-agent/type | 1 + .../templates/etc/crontab/zabbix_mail_stats | 20 + .../templates/etc/sudoers/00zabbixAgentAlias | 11 + .../e-smith/templates/etc/sudoers/30zabbixAgent | 2 + .../etc/zabbix/zabbix_agent.conf/00header | 5 + .../etc/zabbix/zabbix_agent.conf/10zabbixServers | 6 + .../etc/zabbix/zabbix_agent.conf/20timeout | 5 + .../etc/zabbix/zabbix_agent.conf/30monitor10mysql | 14 + .../etc/zabbix/zabbix_agentd.conf/00header | 6 + .../etc/zabbix/zabbix_agentd.conf/10zabbixServers | 12 + .../etc/zabbix/zabbix_agentd.conf/15hostname | 6 + .../etc/zabbix/zabbix_agentd.conf/20listen | 12 + .../templates/etc/zabbix/zabbix_agentd.conf/30fork | 7 + .../templates/etc/zabbix/zabbix_agentd.conf/40freq | 20 + .../etc/zabbix/zabbix_agentd.conf/50active_passive | 8 + .../etc/zabbix/zabbix_agentd.conf/60remoteCommands | 5 + .../templates/etc/zabbix/zabbix_agentd.conf/70logs | 21 ++ .../etc/zabbix/zabbix_agentd.conf/80timeout | 5 + .../zabbix_agentd.conf/90UserParameters_asterisk | 28 ++ .../zabbix_agentd.conf/90UserParameters_certExpire | 13 + .../zabbix_agentd.conf/90UserParameters_cpuNum | 14 + .../zabbix_agentd.conf/90UserParameters_diskIO | 42 +++ .../zabbix_agentd.conf/90UserParameters_extIP | 9 + .../zabbix/zabbix_agentd.conf/90UserParameters_lvm | 10 + .../zabbix_agentd.conf/90UserParameters_mailIn | 15 + .../zabbix_agentd.conf/90UserParameters_mailOut | 16 + .../zabbix_agentd.conf/90UserParameters_megaRaid | 37 ++ .../zabbix_agentd.conf/90UserParameters_memory | 24 ++ .../zabbix_agentd.conf/90UserParameters_mysql | 16 + .../zabbix_agentd.conf/90UserParameters_netStats | 62 ++++ .../zabbix_agentd.conf/90UserParameters_sensors | 11 + .../zabbix_agentd.conf/90UserParameters_smart | 43 +++ .../zabbix_agentd.conf/90UserParameters_squid | 53 +++ .../zabbix_agentd.conf/90UserParameters_swRaid | 16 + .../zabbix_agentd.conf/90UserParameters_swap | 12 + .../zabbix/zabbix_agentd.conf/90UserParameters_ups | 34 ++ .../zabbix_agentd.conf/90UserParameters_yumUpdates | 11 + root/var/lib/zabbix/bin/cert_expire.pl | 142 ++++++++ root/var/lib/zabbix/bin/check_asterisk | 210 +++++++++++ root/var/lib/zabbix/bin/check_lvm | 36 ++ root/var/lib/zabbix/bin/logtail.pl | 95 +++++ root/var/lib/zabbix/bin/mail_in.sh | 15 + root/var/lib/zabbix/bin/mail_out.sh | 11 + root/var/lib/zabbix/bin/mailstatus.pl | 23 ++ root/var/lib/zabbix/bin/mdstat-parser.pl | 137 +++++++ root/var/lib/zabbix/bin/megaraid-parser.pl | 226 ++++++++++++ root/var/lib/zabbix/bin/mysqladmin_status | 5 + root/var/lib/zabbix/bin/parse_mail_in.pl | 103 ++++++ root/var/lib/zabbix/bin/parse_mail_out.pl | 70 ++++ root/var/lib/zabbix/bin/sensors | 57 +++ smeserver-zabbix-agent.spec | 403 +++++++++++++++++++++ 60 files changed, 2193 insertions(+) create mode 100644 createlinks create mode 100644 root/etc/e-smith/db/configuration/defaults/zabbix-agent/RemoteCommands create mode 100644 root/etc/e-smith/db/configuration/defaults/zabbix-agent/ServerPort create mode 100644 root/etc/e-smith/db/configuration/defaults/zabbix-agent/Servers create mode 100644 root/etc/e-smith/db/configuration/defaults/zabbix-agent/TCPPort create mode 100644 root/etc/e-smith/db/configuration/defaults/zabbix-agent/access create mode 100644 root/etc/e-smith/db/configuration/defaults/zabbix-agent/active create mode 100644 root/etc/e-smith/db/configuration/defaults/zabbix-agent/passive create mode 100644 root/etc/e-smith/db/configuration/defaults/zabbix-agent/status create mode 100644 root/etc/e-smith/db/configuration/defaults/zabbix-agent/type create mode 100644 root/etc/e-smith/templates/etc/crontab/zabbix_mail_stats create mode 100644 root/etc/e-smith/templates/etc/sudoers/00zabbixAgentAlias create mode 100644 root/etc/e-smith/templates/etc/sudoers/30zabbixAgent create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agent.conf/00header create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agent.conf/10zabbixServers create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agent.conf/20timeout create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agent.conf/30monitor10mysql create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/00header create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/10zabbixServers create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/15hostname create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/20listen create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/30fork create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/40freq create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/50active_passive create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/60remoteCommands create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/70logs create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/80timeout create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_asterisk create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_certExpire create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_cpuNum create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_diskIO create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_extIP create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_lvm create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_mailIn create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_mailOut create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_megaRaid create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_memory create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_mysql create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_netStats create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_sensors create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_smart create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_squid create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_swRaid create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_swap create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_ups create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_yumUpdates create mode 100644 root/var/lib/zabbix/bin/cert_expire.pl create mode 100644 root/var/lib/zabbix/bin/check_asterisk create mode 100644 root/var/lib/zabbix/bin/check_lvm create mode 100644 root/var/lib/zabbix/bin/logtail.pl create mode 100644 root/var/lib/zabbix/bin/mail_in.sh create mode 100644 root/var/lib/zabbix/bin/mail_out.sh create mode 100644 root/var/lib/zabbix/bin/mailstatus.pl create mode 100644 root/var/lib/zabbix/bin/mdstat-parser.pl create mode 100644 root/var/lib/zabbix/bin/megaraid-parser.pl create mode 100644 root/var/lib/zabbix/bin/mysqladmin_status create mode 100644 root/var/lib/zabbix/bin/parse_mail_in.pl create mode 100644 root/var/lib/zabbix/bin/parse_mail_out.pl create mode 100644 root/var/lib/zabbix/bin/sensors create mode 100644 smeserver-zabbix-agent.spec diff --git a/createlinks b/createlinks new file mode 100644 index 0000000..ace5414 --- /dev/null +++ b/createlinks @@ -0,0 +1,20 @@ +#!/usr/bin/perl -w + +use esmith::Build::CreateLinks qw(:all); + +# Templates to expand +templates2events("/etc/zabbix/zabbix_agent.conf", qw(zabbix-agent-update bootstrap-console-save)); +templates2events("/etc/zabbix/zabbix_agentd.conf", qw(zabbix-agent-update bootstrap-console-save)); +templates2events("/etc/sudoers", "zabbix-agent-update"); +templates2events("/etc/rc.d/init.d/masq", "zabbix-agent-update"); +templates2events("/etc/crontab", "zabbix-agent-update"); + +# Services to restart +safe_symlink("restart", "root/etc/e-smith/events/zabbix-agent-update/services2adjust/zabbix-agent"); +safe_symlink("adjust", "root/etc/e-smith/events/zabbix-agent-update/services2adjust/masq"); + +# Start and stop links +service_link_enhanced("zabbix-agent", "S98", "7"); +service_link_enhanced("zabbix-agent", "K10", "6"); +service_link_enhanced("zabbix-agent", "K10", "0"); + diff --git a/root/etc/e-smith/db/configuration/defaults/zabbix-agent/RemoteCommands b/root/etc/e-smith/db/configuration/defaults/zabbix-agent/RemoteCommands new file mode 100644 index 0000000..7a68b11 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/zabbix-agent/RemoteCommands @@ -0,0 +1 @@ +disabled diff --git a/root/etc/e-smith/db/configuration/defaults/zabbix-agent/ServerPort b/root/etc/e-smith/db/configuration/defaults/zabbix-agent/ServerPort new file mode 100644 index 0000000..f02a806 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/zabbix-agent/ServerPort @@ -0,0 +1 @@ +10051 diff --git a/root/etc/e-smith/db/configuration/defaults/zabbix-agent/Servers b/root/etc/e-smith/db/configuration/defaults/zabbix-agent/Servers new file mode 100644 index 0000000..7b9ad53 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/zabbix-agent/Servers @@ -0,0 +1 @@ +127.0.0.1 diff --git a/root/etc/e-smith/db/configuration/defaults/zabbix-agent/TCPPort b/root/etc/e-smith/db/configuration/defaults/zabbix-agent/TCPPort new file mode 100644 index 0000000..f8d7468 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/zabbix-agent/TCPPort @@ -0,0 +1 @@ +10050 diff --git a/root/etc/e-smith/db/configuration/defaults/zabbix-agent/access b/root/etc/e-smith/db/configuration/defaults/zabbix-agent/access new file mode 100644 index 0000000..3e18ebf --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/zabbix-agent/access @@ -0,0 +1 @@ +private diff --git a/root/etc/e-smith/db/configuration/defaults/zabbix-agent/active b/root/etc/e-smith/db/configuration/defaults/zabbix-agent/active new file mode 100644 index 0000000..86981e6 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/zabbix-agent/active @@ -0,0 +1 @@ +enabled diff --git a/root/etc/e-smith/db/configuration/defaults/zabbix-agent/passive b/root/etc/e-smith/db/configuration/defaults/zabbix-agent/passive new file mode 100644 index 0000000..7a68b11 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/zabbix-agent/passive @@ -0,0 +1 @@ +disabled diff --git a/root/etc/e-smith/db/configuration/defaults/zabbix-agent/status b/root/etc/e-smith/db/configuration/defaults/zabbix-agent/status new file mode 100644 index 0000000..86981e6 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/zabbix-agent/status @@ -0,0 +1 @@ +enabled diff --git a/root/etc/e-smith/db/configuration/defaults/zabbix-agent/type b/root/etc/e-smith/db/configuration/defaults/zabbix-agent/type new file mode 100644 index 0000000..24e1098 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/zabbix-agent/type @@ -0,0 +1 @@ +service diff --git a/root/etc/e-smith/templates/etc/crontab/zabbix_mail_stats b/root/etc/e-smith/templates/etc/crontab/zabbix_mail_stats new file mode 100644 index 0000000..b4ea242 --- /dev/null +++ b/root/etc/e-smith/templates/etc/crontab/zabbix_mail_stats @@ -0,0 +1,20 @@ +{ +if ((${'zabbix-agent'}{'status'} || 'disabled') eq 'enabled'){ + $OUT .=<<"HERE"; + +# Parse mail logs and write stats in zabbix tmp directory +*/10 * * * * root /var/lib/zabbix/bin/mail_in.sh +*/10 * * * * root /var/lib/zabbix/bin/mail_out.sh + +HERE + + if ((${'zabbix-agent'}{'StatusMail'} || 'disabled' ) eq 'enabled'){ + $OUT .=<<"HERE"; + +# Send a status mail +*/15 * * * * root /var/lib/zabbix/bin/mailstatus.pl + +HERE + } +} +} diff --git a/root/etc/e-smith/templates/etc/sudoers/00zabbixAgentAlias b/root/etc/e-smith/templates/etc/sudoers/00zabbixAgentAlias new file mode 100644 index 0000000..91f402b --- /dev/null +++ b/root/etc/e-smith/templates/etc/sudoers/00zabbixAgentAlias @@ -0,0 +1,11 @@ +{ +my $runasroot = '/usr/bin/mysqladmin status, /sbin/e-smith/db yum_updates show, /var/lib/zabbix/bin/sensors *, /var/lib/zabbix/bin/check_lvm *, /usr/sbin/smartctl -A /dev/*'; +if ( -x '/opt/MegaRAID/MegaCli/MegaCli' ){ + $runasroot .= ', /var/lib/zabbix/bin/megaraid-parser.pl'; +} +$runasroot .= "\n"; +$OUT .= 'Cmnd_Alias ZABBIX_AGENT_ROOT = '.$runasroot; + +} +Cmnd_Alias ZABBIX_AGENT_MYSQL = /usr/bin/du -s /var/lib/mysql + diff --git a/root/etc/e-smith/templates/etc/sudoers/30zabbixAgent b/root/etc/e-smith/templates/etc/sudoers/30zabbixAgent new file mode 100644 index 0000000..fb07870 --- /dev/null +++ b/root/etc/e-smith/templates/etc/sudoers/30zabbixAgent @@ -0,0 +1,2 @@ +zabbix ALL=(root) NOPASSWD: ZABBIX_AGENT_ROOT +zabbix ALL=(mysql) NOPASSWD: ZABBIX_AGENT_MYSQL diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agent.conf/00header b/root/etc/e-smith/templates/etc/zabbix/zabbix_agent.conf/00header new file mode 100644 index 0000000..da65913 --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agent.conf/00header @@ -0,0 +1,5 @@ +# This is config file for zabbix_agent +# To get more information about ZABBIX, +# go http://www.zabbix.com + + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agent.conf/10zabbixServers b/root/etc/e-smith/templates/etc/zabbix/zabbix_agent.conf/10zabbixServers new file mode 100644 index 0000000..3b06b59 --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agent.conf/10zabbixServers @@ -0,0 +1,6 @@ +# IP address of ZABBIX server +# Connections from other hosts will be denied + +Server={ (${'zabbix-agent'}{'Servers'} || '127.0.0.1'); } + + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agent.conf/20timeout b/root/etc/e-smith/templates/etc/zabbix/zabbix_agent.conf/20timeout new file mode 100644 index 0000000..caaf3df --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agent.conf/20timeout @@ -0,0 +1,5 @@ +# Spend no more than Timeout seconds on processing +# Must be between 1 and 30 + +Timeout=3 + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agent.conf/30monitor10mysql b/root/etc/e-smith/templates/etc/zabbix/zabbix_agent.conf/30monitor10mysql new file mode 100644 index 0000000..73d5d98 --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agent.conf/30monitor10mysql @@ -0,0 +1,14 @@ +####### USER-DEFINED MONITORED PARAMETERS ####### +# Format: UserParameter=, +# Note that shell command must not return empty string or EOL only +#UserParameter=system.test,who|wc -l +### Set of parameter for monitoring MySQL server (v3.23.42 and later) +### Change -u and add -p if required +#UserParameter=mysql.ping,mysqladmin -uroot ping|grep alive|wc -l +#UserParameter=mysql.uptime,mysqladmin -uroot status|cut -f2 -d":"|cut -f1 -d"T" +#UserParameter=mysql.threads,mysqladmin -uroot status|cut -f3 -d":"|cut -f1 -d"Q" +#UserParameter=mysql.questions,mysqladmin -uroot status|cut -f4 -d":"|cut -f1 -d"S" +#UserParameter=mysql.slowqueries,mysqladmin -uroot status|cut -f5 -d":"|cut -f1 -d"O" +#UserParameter=mysql.qps,mysqladmin -uroot status|cut -f9 -d":" +#UserParameter=mysql.version,mysql -V + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/00header b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/00header new file mode 100644 index 0000000..e083849 --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/00header @@ -0,0 +1,6 @@ +# This is config file for zabbix_agentd +# To get more information about ZABBIX, go http://www.zabbix.com + +############ GENERAL PARAMETERS ################# + + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/10zabbixServers b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/10zabbixServers new file mode 100644 index 0000000..f61cb61 --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/10zabbixServers @@ -0,0 +1,12 @@ +# 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={ (${'zabbix-agent'}{'Servers'} || '127.0.0.1'); } + +# Server port for sending active checks + +ServerPort={ (${'zabbix-agent'}{'ServerPort'} || '10051'); } + + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/15hostname b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/15hostname new file mode 100644 index 0000000..c9b06e2 --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/15hostname @@ -0,0 +1,6 @@ +{ + +my $host = (${'zabbix-agent'}{'Hostname'} || $SystemName.".".$DomainName); +$OUT = "Hostname=$host\n"; + +} diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/20listen b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/20listen new file mode 100644 index 0000000..5a3ce59 --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/20listen @@ -0,0 +1,12 @@ +# Listen port. Default is 10050 + +ListenPort={ (${'zabbix-agent'}{'TCPPort'} || '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= + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/30fork b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/30fork new file mode 100644 index 0000000..e27e849 --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/30fork @@ -0,0 +1,7 @@ +# Number of pre-forked instances of zabbix_agentd. +# Default value is 5 +# This parameter must be between 1 and 16 + +StartAgents=5 + + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/40freq b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/40freq new file mode 100644 index 0000000..9a391f5 --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/40freq @@ -0,0 +1,20 @@ +# How often refresh list of active checks. 2 minutes by default. + +#RefreshActiveChecks=120 + +# Buffers parameters + +# Do not keep data longer than +# N seconds in buffer. +# Number of seconds, 1-3600. + +BufferSend=30 + +# Maximum number of values +# in a buffer. The agent will +# send all collected data to +# ZABBIX Server or Proxy if +# the buffer is full. + +BufferSize=100 + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/50active_passive b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/50active_passive new file mode 100644 index 0000000..6bc1000 --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/50active_passive @@ -0,0 +1,8 @@ +# Disable active checks. The agent will work in passive mode listening server. + +DisableActive={ ((${'zabbix-agent'}{'active'} || 'enabled') eq 'disabled' ? '1':'0'); } + +# Disable passive checks. The agent wont listen TCP port +# Set this to 1 if you use only active checks +DisablePassive={ ((${'zabbix-agent'}{'passive'} || 'enabled') eq 'disabled' ? '1':'0'); } + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/60remoteCommands b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/60remoteCommands new file mode 100644 index 0000000..70b8e55 --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/60remoteCommands @@ -0,0 +1,5 @@ +# Enable remote commands for ZABBIX agent. By default remote commands disabled. + +EnableRemoteCommands={ (${'zabbix-agent'}{'RemoteCommands'} || 'disabled') eq 'enabled' ? '1':'0'; } + + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/70logs b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/70logs new file mode 100644 index 0000000..9683db7 --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/70logs @@ -0,0 +1,21 @@ +# 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/run/zabbix/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 + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/80timeout b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/80timeout new file mode 100644 index 0000000..3e3bbd1 --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/80timeout @@ -0,0 +1,5 @@ +# Spend no more than Timeout seconds on processing +# Must be between 1 and 30 + +Timeout={${'zabbix-agent'}{'TimeOut'} || '3'} + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_asterisk b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_asterisk new file mode 100644 index 0000000..272cdb9 --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_asterisk @@ -0,0 +1,28 @@ +{ + +if ( -x '/usr/sbin/asterisk' ){ + my $login = ""; + my $user = ${'zabbix-agent'}{'AsteriskManagerLogin'} || ''; + my $pass = ${'zabbix-agent'}{'AsteriskManagerPassword'} || ''; + if ($user ne ''){ + $login .= "--user=$user"; + } + if ($pass ne ''){ + $login .= " --secret=$pass"; + } + $OUT.=<<"HERE" +# Type: Agent or Agent (active) +# Key: asterisk[key] where key can be max_latency, sip_peers, channels, internal_calls, +# outgoing_calls, incoming_calls, external_calls, duration_internal or duration_external +# Type of information: Numeric (integer 64bit) +# Units: depends on the key +# Custom multiplier: Do not use +# Store Value: As is + +UserParameter=asterisk[*],/var/lib/zabbix/bin/check_asterisk $login --what=\$1 + +HERE +} + +} + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_certExpire b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_certExpire new file mode 100644 index 0000000..1d3aee1 --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_certExpire @@ -0,0 +1,13 @@ +# Certificate expiration + +# Description: Remaining days +# Type: Agent or Agent (active) +# Key: crt.expire[] +# Type of information: Numeric (integer 64bit) +# Units: days +# Use multiplier: No +# Update interval: 86400 +# Store Value: As is +# Show Value: As is + +UserParameter=crt.expire[*],/var/lib/zabbix/bin/cert_expire.pl -p $1 diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_cpuNum b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_cpuNum new file mode 100644 index 0000000..457b4fa --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_cpuNum @@ -0,0 +1,14 @@ +# Number of CPU + +# Description: Number of CPU +# Type: Agent or Agent (active) +# Key: cpu.number +# Type of information: Numeric (integer 64bit) +# Units: cpu +# Use multiplier: do not use +# Update interval: 86400 (once a day) +# Store Value: As is +# Show Value: As is + +UserParameter=cpu.number,cat /proc/cpuinfo | grep processor | wc -l + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_diskIO b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_diskIO new file mode 100644 index 0000000..d375682 --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_diskIO @@ -0,0 +1,42 @@ +# Disk I/O Monitoring + +# Description: Read operations on hdX +# X can be from 1 to 8 +# you'll have to create a custom template if +# you want to support more than 8 drives +# You can also monitor raid devices (/dev/md1 for example) + +# Type: Agent or Agent (active) +# Key: vfs.dev.read.hdX vfs.dev.write.hdX +# Type of information: Numeric (Float or integer 64bit) +# Units: bytes/sec +# Use multiplier: 512 +# Update interval: 60 (for example) +# Store Value: Delta (speed/sec) +# Show Value: As is + +# For these UserParameter to work, you need to configure the drives you want to monitor +# in the DB: +# db configuration setprop zabbix-agent HardDrives /dev/sda,/dev/sdb,/dev/sdc,/dev/sdd +# signal-event zabbix-agent-update + +{ + +my @hd = split( /[,;]/,( ${'zabbix-agent'}{'HardDrives'} || '' )); + +my $cnt = 1; +foreach my $drive (@hd){ + if ( -e $drive){ + $drive =~ s|/dev/||; + $OUT .= "Alias=vfs.dev.read.hd" . $cnt . ":vfs.dev.read[$drive,sectors]\n"; + $OUT .= "Alias=vfs.dev.write.hd" . $cnt . ":vfs.dev.write[$drive,sectors]\n"; + $cnt++; + } +} +for (;$cnt < 9; $cnt++){ + $OUT .= "UserParameter=vfs.dev.read.hd" . $cnt . ",echo '0'\n"; + $OUT .= "UserParameter=vfs.dev.write.hd" . $cnt . ",echo '0'\n"; +} + +} + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_extIP b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_extIP new file mode 100644 index 0000000..7bdd04b --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_extIP @@ -0,0 +1,9 @@ + +# Retrieve real external IP +# Description: Ext IP +# Type: Agent or Agent (active) +# Key: ip.external +# Type of information: Character +# Show Value: As is +UserParameter=ip.external,/usr/bin/curl --connect-timeout 5 -s -o - -k "http://www.wimip.fr/?t=" + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_lvm b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_lvm new file mode 100644 index 0000000..89bed21 --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_lvm @@ -0,0 +1,10 @@ + +# Type: Agent or Agent (active) +# Key: lvm[key] where key can be snapshot_max_allow, snapshots, lv or vg +# Type of information: Numeric (integer 64bit) or characters (for version) +# Units: depends on the key (snapshot_max_alloc is in %) +# Custom multiplier: Do not use +# Store Value: As is + +UserParameter=lvm[*],/usr/bin/sudo /var/lib/zabbix/bin/check_lvm $1 + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_mailIn b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_mailIn new file mode 100644 index 0000000..e56cb74 --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_mailIn @@ -0,0 +1,15 @@ +# Incomming mails statistics + +# Description: Incoming Mail +# Type: Agent or Agent (active) +# Key: mail.in[] (for example mail.in[dnsbl]) +# Type of information: Numeric (integer 64bit) +# Units: mails/h +# Use multiplier: Custom multiplier +# Custom multiplier: 6 +# Update interval: 600 +# Store Value: As is +# Show Value: As is + +UserParameter=mail.in[*],cat /var/lib/zabbix/tmp/mail.in.$1 + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_mailOut b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_mailOut new file mode 100644 index 0000000..feac236 --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_mailOut @@ -0,0 +1,16 @@ +# Outgoing mails statistics + +# Description: Incoming Mail +# Type: Agent or Agent (active) +# Key: mail.out.[] (for example mail.out[total]) +# Type of information: Numeric (integer 64bit) +# Units: mails/h +# Use multiplier: Custom multiplier +# Custom multiplier: 6 +# Update interval: 600 +# Store Value: As is +# Show Value: As is + +UserParameter=mail.out[*],cat /var/lib/zabbix/tmp/mail.out.$1 + + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_megaRaid b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_megaRaid new file mode 100644 index 0000000..e960dd2 --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_megaRaid @@ -0,0 +1,37 @@ + +{ + +my $options = ''; +my $spares = ${'zabbix-agent'}{'MegaRaidSpares'} || ''; +$options .= "-s $spares " if ($spares =~ /\d+/); +my $media_error = ${'zabbix-agent'}{'MegaRaidMediaError'} || ''; +$options .= "-m $media_error " if ($media_error =~ /\d+/); +my $other_error = ${'zabbix-agent'}{'MegaRaidOtherError'} || ''; +$options .= "-o $other_error " if ($other_error =~ /\d+/); +my $predictive_error = ${'zabbix-agent'}{'MegaRaidPredictiveError'} || ''; +$options .= "-p $predictive_error " if ($predictive_error =~ /\d+/); + +# As this check requires the MegaCli utility, first check if it's present: +if ( -x '/opt/MegaRAID/MegaCli/MegaCli' ){ + $OUT .=<<"HERE"; + +# Report status of every Raid Array using the MegaRaid controler (Requires the MegaCli utility) +# This controler is used for example on perc5/6(i) Raid card + +# Description: MegaRaid Status +# Type: Agent or Agent (active) +# Key: raid.mega.status +# Type of Information: Character +# Show Value: As is + +# The value reported is like: +# State: OK: 0:0:RAID-1:2 drives:68GB:Optimal 0:1:RAID-5:4 drives:837GB:Optimal Drives:7 +# + +# Tips: You can add a simple trigger on this check like: +# \{ hostname:raid.mega.status.str( OK ) \}=0 +UserParameter=raid.mega.status,/usr/bin/sudo /var/lib/zabbix/bin/megaraid-parser.pl $options + +HERE +} +} diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_memory b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_memory new file mode 100644 index 0000000..2a294dd --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_memory @@ -0,0 +1,24 @@ +# Amount of used memory (the agent lacks this stats) + +# Description: Used Memory +# Type: Agent or Agent (active) +# Key: vm.memory.size.used +# Type of information: Numeric (integer 64bit) +# Units: B +# Use multiplier: do not use +# Store Value: As is +# Show Value: As is +UserParameter=vm.memory.size.used,free -b | grep 'buffers/cache' | awk '\{print $3\}' + +# Amount of used memory in % (the agent lacks this stats) + +# Description: Used Memory in % +# Type: Agent or Agent (active) +# Key: vm.memory.size.pused +# Type of information: Numeric (integer 64bit) +# Units: % +# Use multiplier: do not use +# Store Value: As is +# Show Value: As is +UserParameter=vm.memory.size.pused,echo $(($(free -b | grep 'buffers/cache' | awk '\{print $3\}')*100/$(free -b | grep 'Mem' | awk '\{print $2\}'))) + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_mysql b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_mysql new file mode 100644 index 0000000..7a93bdc --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_mysql @@ -0,0 +1,16 @@ + +# Some stats about MySQL + +# Description: MySQL +# Type: Agent or Agent (active) +# Type of information: Numeric (float) +# Unit: (for example, qps) +# Use multiplier: do not use +# Store Value: As is +UserParameter=mysql.uptime,/var/lib/zabbix/bin/mysqladmin_status | cut -d" " -f2 +UserParameter=mysql.threads,/var/lib/zabbix/bin/mysqladmin_status | cut -d" " -f5 +UserParameter=mysql.questions,/var/lib/zabbix/bin/mysqladmin_status | cut -d" " -f8 +UserParameter=mysql.slowqueries,/var/lib/zabbix/bin/mysqladmin_status | cut -d" " -f12 +UserParameter=mysql.qps,/var/lib/zabbix/bin/mysqladmin_status | cut -d" " -f29 +UserParameter=mysql.size,/usr/bin/sudo -u mysql /usr/bin/du -s /var/lib/mysql | awk '\{print $1\}' + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_netStats b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_netStats new file mode 100644 index 0000000..a959195 --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_netStats @@ -0,0 +1,62 @@ +# Some networks statistics +# zabbix agent support natively interface stats, but, it's hard to create templates for a lot of +# SME Servers which can use different interface name (External can be eth0, eth1, ppp0 etc...) +# This way, net.if.in.internal, net.if.in.external, net.if.out.internal and net.if.out.external +# will always refers to the correct interface. + +{ +my $internal = $InternalInterface{'Name'} || 'eth0'; +my $external = $ExternalInterface{'Name'} || 'eth1'; + +# Do we use the bridge contrib ? +# If yes, we reports only the traffic on the real ethernet interface. +if ( (($bridge{'status'} || 'disabled') eq 'enabled') && (defined $bridge{'ethernetInterface'}) ){ + $internal = $bridge{'ethernetInterface'}; +} + +$OUT .=<<"HERE"; + +# Description: In Internal +# Type: Agent or Agent (active) +# Key: net.if.in.internal +# Type of information: Numeric (float) +# Units: b/s +# Custom multiplier: 8 (if you want the value in bits/s instead of Bytes/s) +# Store Value: Delta (speed per second) +UserParameter=net.if.in.internal,cat /proc/net/dev | grep $internal | cut -d":" -f2 | awk '{print \$1}' + +# Description: Out Internal +# Type: Agent or Agent (active) +# Key: net.if.out.internal +# Type of information: Numeric (float) +# Units: b/s +# Custom multiplier: 8 (if you want the value in bits/s instead of Bytes/s) +# Store Value: Delta (speed per second) +UserParameter=net.if.out.internal,cat /proc/net/dev | grep $internal | cut -d":" -f2 | awk '{print \$9}' + +HERE + +if (($SystemMode || 'serveronly') ne 'serveronly'){ + $OUT .=<<"HERE"; +# Description: In External +# Type: Agent or Agent (active) +# Key: net.if.in.external +# Type of information: Numeric (float) +# Units: b/s +# Custom multiplier: 8 (if you want the value in bits/s instead of Bytes/s) +# Store Value: Delta (speed per second) +UserParameter=net.if.in.external,cat /proc/net/dev | grep $external | cut -d":" -f2 | awk '{print \$1}' + +# Description: Out External +# Type: Agent or Agent (active) +# Key: net.if.out.external +# Type of information: Numeric (float) +# Units: b/s +# Custom multiplier: 8 (if you want the value in bits/s instead of Bytes/s) +# Store Value: Delta (speed per second) +UserParameter=net.if.out.external,cat /proc/net/dev | grep $external | cut -d":" -f2 | awk '{print \$9}' + +HERE +} +} + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_sensors b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_sensors new file mode 100644 index 0000000..2c1060e --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_sensors @@ -0,0 +1,11 @@ + +# Description: Temperature +# Type: Agent or Agent (active) +# Key: sensors[mb] (for example) +# Type of information: Numeric (float) +# Units: °C +# Custom multiplier: Do not use +# Store Value: As is + +UserParameter=sensors[*],/usr/bin/sudo /var/lib/zabbix/bin/sensors $1 + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_smart b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_smart new file mode 100644 index 0000000..a0e866d --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_smart @@ -0,0 +1,43 @@ +# Smart Monitoring + +# Description: Smart Value +# Key can be one of: Raw_Read_Error_Rate, Spin_Up_Time, Start_Stop_Count +# Reallocated_Sector_Ct, Seek_Error_Rate, Power_On_Hours, Spin_Retry_Count, +# Power_Cycle_Count, Temperature_Celsius, Hardware_ECC_Recovered, +# Current_Pending_Sector, Offline_Uncorrectable, UDMA_CRC_Error_Count, +# Multi_Zone_Error_Rate, TA_Increase_Count + +# Type: Agent or Agent (active) +# Key: system.smart.hdX[] (for example system.smart.hd1[Reallocated_Sector_Ct]) +# Type of information: Numeric (integer 64bit) +# Units: (none) +# Use multiplier: No +# Update interval: 120 (for example) +# Store Value: As is +# Show Value: As is + +# For Seek_Error_Rate, Raw_Read_Error_Rate, Hardware_ECC_Recovered you can store value as Delta +# in order to graph the error rate in a readable format + +# For these UserParameter to work, you need to configure the drives you want to monitor +# in the DB: +# db configuration setprop zabbix-agent SmartDrives /dev/sda,/dev/sdb,/dev/sdc,/dev/sdd +# signal-event zabbix-agent-update + +{ + +my @hd = split( /[,;]/,( ${'zabbix-agent'}{'SmartDrives'} || '' )); + +my $cnt = 1; +foreach my $drive (@hd){ + if ( -e $drive){ + $OUT .= "UserParameter=system.smartd.hd" . $cnt. "[*],/usr/bin/sudo /usr/sbin/smartctl -A $drive| grep \$1| tail -1| cut -c 88-|cut -f1 -d' '\n"; + $cnt++; + } +} +for (;$cnt < 9; $cnt++){ + $OUT .= "UserParameter=system.smartd.hd" . $cnt. "[*],echo '0'\n"; +} + +} + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_squid b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_squid new file mode 100644 index 0000000..0ca9f94 --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_squid @@ -0,0 +1,53 @@ +# Squid + +# Description: Squid Request Hit Ratio +# Type: Agent or Agent (active) +# Key: squid.request_hit_ratio +# Type of information: Numeric (float) +# Units: % +# Custom multiplier: Do not use +# Store Value: As is + +UserParameter=squid.request_hit_ratio,squidclient mgr:info|grep 'Request Hit Ratios:'|cut -d':' -f3|cut -d',' -f1|tr -d ' %' + +# Description: Squid Byte Hit Ratio +# Type: Agent or Agent (active) +# Key: squid.byte_hit_ratio +# Type of information: Numeric (float) +# Units: % +# Custom multiplier: Do not use +# Store Value: As is + +UserParameter=squid.byte_hit_ratio,squidclient mgr:info|grep 'Byte Hit Ratios:'|cut -d':' -f3|cut -d',' -f1|tr -d ' %' + +# Description: Squid Average HTTP request per minute +# Type: Agent or Agent (active) +# Key: squid.avg_http_req_per_min +# Type of information: Numeric (float) +# Units: Req/min +# Custom multiplier: Do not use +# Store Value: As is + +UserParameter=squid.avg_http_req_per_min,squidclient mgr:info|grep 'Average HTTP requests per minute since start:'|cut -d':' -f2| tr -d ' \t' + +# Description: Squid Disk Cache Size +# Type: Agent or Agent (active) +# Key: squid.cache_size_disk +# Type of information: Numeric (integer 64bits) +# Units: Bytes +# Custom multiplier: 1024 +# Store Value: As is + +UserParameter=squid.cache_size_disk,squidclient mgr:info|grep 'Storage Swap size:' | awk '\{print $4\}' + +# Description: Squid Memory Cache Size +# Type: Agent or Agent (active) +# Key: squid.cache_size_mem +# Type of information: Numeric (integer 64bits) +# Units: Bytes +# Custom multiplier: 1024 +# Store Value: As is + +UserParameter=squid.cache_size_mem,squidclient mgr:info|grep 'Storage Mem size:' | awk '\{print $4\}' + + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_swRaid b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_swRaid new file mode 100644 index 0000000..5322a3f --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_swRaid @@ -0,0 +1,16 @@ + +# Report status of every Raid Array (parsing /proc/mdtstat) + +# Description: Software Raid Status +# Type: Agent or Agent (active) +# Key: raid.sw.status +# Type of Information: Character +# Show Value: As is + +# The value reported is like: +# OK: md3:raid1:2 drives:931GB:Optimal md2:raid1:2 drives:931GB:Optimal md1:raid1:2 drives:101MB:Optimal + +# Tips: You can add a simple trigger on this check like: +# \{ hostname:raid.sw.status.str( OK ) \}=0 +UserParameter=raid.sw.status,/var/lib/zabbix/bin/mdstat-parser.pl + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_swap b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_swap new file mode 100644 index 0000000..00e457e --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_swap @@ -0,0 +1,12 @@ +# Amount of used swap in bytes + +# Description: Used swap space +# Type: Agent or Agent (active) +# Key: system.swap.size.used +# Type of information: Numeric (integer 64bit) +# Units: B +# Multiplier: do not use +# Store Value: As is +# Show Value: As is +UserParameter=system.swap.size.used,free -b | grep Swap | awk '\{print $3\}' + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_ups b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_ups new file mode 100644 index 0000000..df692fd --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_ups @@ -0,0 +1,34 @@ +# Monitor UPS status + +# Description: Nut UPS load +# Type: Agent or Agent (active) +# Key: ups.load +# Type of information: Numeric (float) +# Units: % +# Multiplier: Do not use +# Store Value: As is +UserParameter=ups.load[*],upsc $1@localhost ups.load + +# Description: Nut UPS Battery Charge +# Type: Agent or Agent (active) +# Key: ups.battery.charge +# Type of information: Numeric (float) +# Units: % +# Multiplier: Do not use +# Store Value: As is +UserParameter=ups.battery.charge[*],upsc $1@localhost battery.charge + +# Description: Nut UPS Status +# Type: Agent or Agent (active) +# Key: ups.status +# Type of information: Character +# Show Value: As is (you can also define a dictionnary OL=>On Line etc...) +UserParameter=ups.status[*],upsc $1@localhost ups.status + +# Description: Nut UPS Model +# Type: Agent or Agent (active) +# Key: ups.model +# Type of information: Text +UserParameter=ups.model[*],upsc $1@localhost ups.model + + diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_yumUpdates b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_yumUpdates new file mode 100644 index 0000000..671e71d --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_yumUpdates @@ -0,0 +1,11 @@ + +# Description: Number of updates available through yum +# Type: Agent or Agent (active) +# Key: updates.available +# Type of information: Numeric (integer 64bit) +# Units: packages +# Custom multiplier: Do not use +# Store Value: As is + +UserParameter=updates.available,/usr/bin/sudo /sbin/e-smith/db yum_updates show | grep package | wc -l + diff --git a/root/var/lib/zabbix/bin/cert_expire.pl b/root/var/lib/zabbix/bin/cert_expire.pl new file mode 100644 index 0000000..2a65a64 --- /dev/null +++ b/root/var/lib/zabbix/bin/cert_expire.pl @@ -0,0 +1,142 @@ +#!/usr/bin/perl -w +# Check peer certificate validity for Zabbix +# Require perl module : IO::Socket, Net::SSLeay, Date::Parse +# Require unix programs : openssl, echo, sendmail +# +# Based on sslexpire from Emmanuel Lacour +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2, or (at your option) any +# later version. +# +# This file is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied warranty +# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +# 02110-1301, USA. +# + + +use strict; +use IO::Socket; +use Net::SSLeay; +use Getopt::Long; +use Date::Parse; + +Net::SSLeay::SSLeay_add_ssl_algorithms(); +Net::SSLeay::randomize(); + +# Default values +my $opensslpath = "/usr/bin/openssl"; + +my $host = '127.0.0.1'; +my $port = '443'; + +my %opts; +GetOptions (\%opts, + 'host|h=s', + 'port|p=s', + 'help', +); + +if ($opts{'host'}) { + $host = $opts{'host'}; +} +if ($opts{'port'}){ + $port = $opts{'port'}; +} + +if ($opts{'help'}) { + &usage; +} + +# Print program usage +sub usage { + print "Usage: sslexpire [OPTION]... +-h, --host=HOST check this host +-p, --port=TCPPORT check this port on the previous host + --help print this help, then exit +"; + exit; +} + + +# This will return the expiration date +sub getExpire { + + my ($l_host,$l_port) = @_; + my ($l_expdate,$l_comment); + + # Connect to $l_host:$l_port + my $socket = IO::Socket::INET->new( + Proto => "tcp", + PeerAddr => $l_host, + PeerPort => $l_port + ); + # If we connected successfully + if ($socket) { + # Intiate ssl + my $l_ctx = Net::SSLeay::CTX_new(); + my $l_ssl = Net::SSLeay::new($l_ctx); + + Net::SSLeay::set_fd($l_ssl, fileno($socket)); + my $res = Net::SSLeay::connect($l_ssl); + + # Get peer certificate + my $l_x509 = Net::SSLeay::get_peer_certificate($l_ssl); + if ($l_x509) { + my $l_string = Net::SSLeay::PEM_get_string_X509($l_x509); + # Get the expiration date, using openssl + $l_expdate = `echo "$l_string" | $opensslpath x509 -enddate -noout 2>&1`; + $l_expdate =~ s/.*=//; + chomp($l_expdate); + } + else { + $l_expdate = 1; + } + + # Close and cleanup + Net::SSLeay::free($l_ssl); + Net::SSLeay::CTX_free($l_ctx); + close $socket; + } + else { + $l_expdate = 1; + } + return $l_expdate; +} + + +# Print remaining days before expiration +sub report { + # Convert date into epoch using date command + my ($l_expdate) = @_; + + if ($l_expdate ne "1") { + # The current date + my $l_today = time; + my $l_epochdate = str2time($l_expdate); + + # Calculate diff between expiration date and today + my $l_diff = ($l_epochdate - $l_today)/(3600*24); + + # Report if needed + printf "%.0f\n", $l_diff; + } + else { + print "Unable to read certificate!\n"; + exit (1); + } +} + +# Get expiration date +my $expdate = getExpire($host,$port); + +# Report +report("$expdate"); + diff --git a/root/var/lib/zabbix/bin/check_asterisk b/root/var/lib/zabbix/bin/check_asterisk new file mode 100644 index 0000000..644a9b9 --- /dev/null +++ b/root/var/lib/zabbix/bin/check_asterisk @@ -0,0 +1,210 @@ +#!/usr/bin/perl -w + +use Asterisk::AMI::Common; +use Getopt::Long; + +open STDERR, '>/dev/null'; + +# Set some default +my $host = '127.0.0.1'; +my $port = '5038'; +my $user = 'zabbixagent'; +my $secret = 'zabbixsecret'; +my $what = 'sip_peers'; + +GetOptions( + "host=s" => \$host, + "port=s" => \$port, + "user=s" => \$user, + "secret=s" => \$secret, + "what=s" => \$what +); + +our $ast = Asterisk::AMI::Common->new( + PeerAddr => $host, + PeerPort => $port, + Username => $user, + Secret => $secret + ); + +die "Unable to connect to asterisk manager" unless ($ast); + + +sub help{ + print<<"EOF"; + +usage: $0 --host=asterisk.domain.tld --port=5038 --user=manager --secret=azerty --what=sip_peers + +--what can take the following argument: + + * sip_peers: number of connected sip peers + * max_latency: highest latency of connected sip_peers + * channels: total number of active channels + * internal_calls: number of active internal calls + * outgoing_calls: number of active outgoing calls (external) + * incoming_calls: number of active incoming calls (external) + * external_calls: number of external calls (in + out) + * duration_internal: actual highest duration of internal calls + * duration_external: actual highest duration of external calls + +EOF + + +if ($what eq 'sip_peers'){ + print get_connected_peers_num('sip'); +} +elsif ($what eq 'max_latency'){ + print get_max_peer_latency(); +} +elsif($what eq 'channels'){ + print get_active_channels_num(); +} +elsif ($what eq 'internal_calls'){ + print get_internal_call_num(); +} +elsif ($what eq 'outgoing_calls'){ + print get_outgoing_call_num(); +} +elsif ($what eq 'incoming_calls'){ + print get_incoming_call_num(); +} +elsif ($what eq 'external_calls'){ + print get_outgoing_call_num() + get_incoming_call_num(); +} +elsif ($what eq 'duration_internal'){ + print get_max_duration_internal(); +} +elsif ($what eq 'duration_external'){ + print get_max_duration_external(); +} +else{ + help(); + $ast->disconnect(); + exit (1); +} + +$ast->disconnect(); +exit(0); + +# Return the number of connected peers for +# the specified protocol (only SIP supporteed for now) +sub get_connected_peers_num{ + my $proto = shift; + my $peers; + if ($proto eq 'sip'){ + $peers = get_sip_peers(); + } + else{ + return 'unsupported protocol'; + } + my $num = 0; + foreach my $peer (keys %{$peers}){ + my $status = $peers->{$peer}->{'Status'}; + $num++ if ($status =~ m/^OK/); + } + return $num; +} + +# Return the list of SIP peers (as a hashref) +sub get_sip_peers{ + return $ast->sip_peers(); +} + +# Return the highest latency of all the peers +sub get_max_peer_latency{ + my $peers = get_sip_peers(); + my $latency = 0; + foreach my $peer (keys %{$peers}){ + my $status = $peers->{$peer}->{'Status'}; + $status =~ /\((\d+)\sms\)/; + $latency = $1 if ($1 > $latency); + } + return $latency; +} + +# Return channels list as a hashref +sub get_channels(){ + return $ast->channels(); +} + +# Return the number of channels +sub get_active_channels_num{ + my $channels = get_channels(); + my $num = 0; + foreach my $chan (keys %{$channels}){ + $num++; + } + return $num; +} + +# Return the number of active channels +sub get_up_channels_num{ + my $channels = get_channels(); + my $num = 0; + foreach my $chan (keys %{$channels}){ + my $status = $channels->{$chan}->{'State'}; + $num++ if ($status eq 'Up'); + } + return $num; +} + +# Return the number of outgoing calls +sub get_outgoing_call_num{ + my $channels = get_channels(); + my $num = 0; + foreach my $chan (keys %{$channels}){ + my $context = $channels->{$chan}->{'Context'}; + my $status = $channels->{$chan}->{'State'}; + $num++ if ($context eq 'macro-dialout-trunk' and $status eq 'Up'); + } + return $num; +} + +# Return the number of incoming calls +sub get_incoming_call_num{ + my $channels = get_channels(); + my $num = 0; + foreach my $chan (keys %{$channels}){ + my $context = $channels->{$chan}->{'Context'}; + my $status = $channels->{$chan}->{'State'}; + $num++ if ($context =~ /^from\-(trunk|pstn|zaptel|dahdi)/ and $status eq 'Up'); + } + return $num; +} + +# Return the number of internal calls +sub get_internal_call_num{ + my $channels = get_channels(); + my $num = 0; + foreach my $chan (keys %{$channels}){ + my $context = $channels->{$chan}->{'Context'}; + my $status = $channels->{$chan}->{'State'}; + $num++ if (($context eq 'macro-dial' or $context eq 'from-internal') and $status eq 'Up'); + } + return $num +} + +# Return the max duration of current internal calls +sub get_max_duration_internal{ + my $channels = get_channels(); + my $max = 0; + foreach my $chan (keys %{$channels}){ + my $dur = $channels->{$chan}->{'Seconds'}; + my $context = $channels->{$chan}->{'Context'}; + $max = $dur if (($context eq 'macro-dial' or $context eq 'from-internal') and $dur > $max); + } + return $max +} + +# Return the max duration of current external calls (in or out) +sub get_max_duration_external{ + my $channels = get_channels(); + my $max = 0; + foreach my $chan (keys %{$channels}){ + my $dur = $channels->{$chan}->{'Seconds'}; + my $context = $channels->{$chan}->{'Context'}; + $max = $dur if (($context eq 'macro-dialout-trunk' or $context =~ /^from\-(trunk|pstn|zaptel|dahdi)/) and $dur > $max); + } + return $max +} + diff --git a/root/var/lib/zabbix/bin/check_lvm b/root/var/lib/zabbix/bin/check_lvm new file mode 100644 index 0000000..c3685ac --- /dev/null +++ b/root/var/lib/zabbix/bin/check_lvm @@ -0,0 +1,36 @@ +#!/bin/bash + +PATH=$PATH:/usr/sbin:/usr/local/sbin + +snapshot_max_alloc(){ + MAX_PERCENT=0 + + for PERCENT in $(lvdisplay | grep % | sed -e 's/ Allocated to snapshot //g' -e 's/%//g'); do + if [[ "$PERCENT" > "$MAX_PERCENT" ]]; then + MAX_PERCENT=$PERCENT + fi + done + + echo "$MAX_PERCENT" +} + +snapshots(){ + echo $(lvdisplay | grep % | wc -l) +} + +lv(){ + echo $(lvdisplay | grep 'LV Name' | wc -l) +} + +vg(){ + echo $(vgdisplay | grep 'VG Name' | wc -l) +} + +case $1 in + snapshot_max_alloc|snapshots|lv|vg) + $1 + ;; + *) + echo 'ZBX_NOTSUPPORTED' +esac + diff --git a/root/var/lib/zabbix/bin/logtail.pl b/root/var/lib/zabbix/bin/logtail.pl new file mode 100644 index 0000000..e44d15d --- /dev/null +++ b/root/var/lib/zabbix/bin/logtail.pl @@ -0,0 +1,95 @@ +#!/usr/bin/perl + +# Copyright (C) 2009 Daniel Berteaud +# Copyright (C) 2003 Jonathan Middleton + +# This file is part of Logcheck. + +# Modifications for integration with smeserver-zabbix-agent + +# Logcheck is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# Logcheck is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with Foobar; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +my ($logfile, $offsetfile) = @ARGV; +if (! -f $logfile) { + print "File $logfile cannot be read.\n"; + exit 66; +} +unless ($offsetfile) { + # offsetfile not given, use .offset/$logfile in the same directory + $offsetfile = $logfile . '.offset'; +} + +unless (open(LOGFILE, $logfile)) { + print "File $logfile cannot be read.\n"; + exit 66; +} + +my ($inode, $offset) = (0, 0); + +if (open(OFFSET, $offsetfile)) { + $_ = ; + unless (! defined $_) { + chomp $_; + $inode = $_; + $_ = ; + unless (! defined $_) { + chomp $_; + $offset = $_; + } + } +} + +my ($ino, $size); +unless ((undef,$ino,undef,undef,undef,undef,undef,$size) = stat $logfile) { + print "Cannot get $logfile file size.\n", $logfile; + exit 65; +} + +if ($inode == $ino) { + exit 0 if $offset == $size; # short cut + if ($offset > $size) { + $offset = 0; + #print "***************\n"; + #print "*** WARNING ***: Log file $logfile is smaller than last time checked!\n"; + #print "*************** This could indicate tampering.\n"; + } +} +if ($inode != $ino || $offset > $size) { + $offset = 0; +} + +seek(LOGFILE, $offset, 0); + +while () { + print $_; +} + +$size = tell LOGFILE; +close LOGFILE; + +unless (open(OFFSET, ">$offsetfile")) { + print "File $offsetfile cannot be created. Check your permissions.\n"; + exit 73; +} +unless (chmod 0600, $offsetfile) { + print "Cannot set permissions on file $offsetfile\n"; + exit 65; +} +print OFFSET "$ino\n$size\n"; +close OFFSET; + +exit 0; + diff --git a/root/var/lib/zabbix/bin/mail_in.sh b/root/var/lib/zabbix/bin/mail_in.sh new file mode 100644 index 0000000..6db29ef --- /dev/null +++ b/root/var/lib/zabbix/bin/mail_in.sh @@ -0,0 +1,15 @@ +#!/bin/bash +BINDIR='/var/lib/zabbix/bin' +LOGTAIL=$BINDIR'/logtail.pl' +PARSER=$BINDIR'/parse_mail_in.pl' +LOGFILE='/var/log/qpsmtpd/current' +TMPDIR='/var/lib/zabbix/tmp/' + + +for WHAT in dnsbl rhsbl clamav check_earlytalker check_basicheaders \ + check_goodrcptto check_spamhelo total_denied spam_denied \ + other_denied spam_queued queued total; do + $LOGTAIL $LOGFILE $TMPDIR/mail.in.$WHAT.offset | $PARSER $WHAT > $TMPDIR/mail.in.$WHAT +done + + diff --git a/root/var/lib/zabbix/bin/mail_out.sh b/root/var/lib/zabbix/bin/mail_out.sh new file mode 100644 index 0000000..e89bc24 --- /dev/null +++ b/root/var/lib/zabbix/bin/mail_out.sh @@ -0,0 +1,11 @@ +#!/bin/bash +BINDIR='/var/lib/zabbix/bin' +LOGTAIL=$BINDIR'/logtail.pl' +PARSER=$BINDIR'/parse_mail_out.pl' +LOGFILE='/var/log/qmail/current' +TMPDIR='/var/lib/zabbix/tmp/' + +for WHAT in failure deferral success total; do + $LOGTAIL $LOGFILE $TMPDIR/mail.out.$WHAT.offset | $PARSER $WHAT > $TMPDIR/mail.out.$WHAT +done + diff --git a/root/var/lib/zabbix/bin/mailstatus.pl b/root/var/lib/zabbix/bin/mailstatus.pl new file mode 100644 index 0000000..2429c20 --- /dev/null +++ b/root/var/lib/zabbix/bin/mailstatus.pl @@ -0,0 +1,23 @@ +#!/usr/bin/perl -w + +use Mail::Send; +use esmith::ConfigDB; + +my $c = esmith::ConfigDB->open_ro(); +my $domain = $c->get('DomainName')->value(); +my $host = $c->get('SystemName')->value(); +my $z = $c->get('zabbix-agent'); +my $dest = $z->prop('StatusRecipient') || 'admin@' . $domain; + +my $mail = new Mail::Send; +$mail->to("$dest"); +$mail->set("From","zabbix-agent"); +$mail->subject("[STATUS] $host.$domain"); +my $body = $mail->open; +print $body localtime(time)."\n", + "\n#>tail /var/log/messages :\n", + `/usr/bin/tail /var/log/messages`, + "\n#>netstat --numeric-hosts -tpu :\n", + `/bin/netstat --numeric-hosts -tpu`; +$body->close; + diff --git a/root/var/lib/zabbix/bin/mdstat-parser.pl b/root/var/lib/zabbix/bin/mdstat-parser.pl new file mode 100644 index 0000000..250ad02 --- /dev/null +++ b/root/var/lib/zabbix/bin/mdstat-parser.pl @@ -0,0 +1,137 @@ +#!/usr/bin/env perl + +# Get status of Linux software RAID for SNMP / Nagios +# Author: Michal Ludvig +# http://www.logix.cz/michal/devel/nagios + +# Slightly modified by Daniel B. for integration on SME Server / Zabbix +# 24 Apr 2009 + +# +# Simple parser for /proc/mdstat that outputs status of all +# or some RAID devices. Possible results are OK and CRITICAL. +# It could eventually be extended to output WARNING result in +# case the array is being rebuilt or if there are still some +# spares remaining, but for now leave it as it is. +# +# To run the script remotely via SNMP daemon (net-snmp) add the +# following line to /etc/snmpd.conf: +# +# extend raid-md0 /root/parse-mdstat.pl --device=md0 +# +# The script result will be available e.g. with command: +# +# snmpwalk -v2c -c public localhost .1.3.6.1.4.1.8072.1.3.2 + +use strict; +use Getopt::Long; + +# Sample /proc/mdstat output: +# +# Personalities : [raid1] [raid5] +# md0 : active (read-only) raid1 sdc1[1] +# 2096384 blocks [2/1] [_U] +# +# md1 : active raid5 sdb3[2] sdb4[3] sdb2[4](F) sdb1[0] sdb5[5](S) +# 995712 blocks level 5, 64k chunk, algorithm 2 [3/2] [U_U] +# [=================>...] recovery = 86.0% (429796/497856) finish=0.0min speed=23877K/sec +# +# unused devices: + +my $file = "/proc/mdstat"; +my $device = "all"; + +# Get command line options. +GetOptions ('file=s' => \$file, + 'device=s' => \$device, + 'help' => sub { &usage() } ); + +## Strip leading "/dev/" from --device in case it has been given +$device =~ s/^\/dev\///; + +## Return codes for Nagios +my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + +## This is a global return value - set to the worst result we get overall +my $retval = 0; + +my (%active_devs, %failed_devs, %spare_devs, %devs_total, %level, %size, %status); +my @raids; +my $result = 'OK'; + +open FILE, "< $file" or die "Can't open $file : $!"; +while () { + next if ! /^(md\d+)+\s*:/; + next if $device ne "all" and $device ne $1; + my $dev = $1; + push @raids, $dev; + + my @array = split(/ /); + for $_ (@array) { + $level{$dev} = $1 if /^(raid\d+)$/; + next if ! /(\w+)\[\d+\](\(.\))*/; + if ($2 eq "(F)") { + $failed_devs{$dev} .= "$1,"; + } + elsif ($2 eq "(S)") { + $spare_devs{$dev} .= "$1,"; + } + else { + $active_devs{$dev} .= "$1,"; + } + } + if (! defined($active_devs{$dev})) { $active_devs{$dev} = "none"; } + else { $active_devs{$dev} =~ s/,$//; } + if (! defined($spare_devs{$dev})) { $spare_devs{$dev} = "none"; } + else { $spare_devs{$dev} =~ s/,$//; } + if (! defined($failed_devs{$dev})) { $failed_devs{$dev} = "none"; } + else { $failed_devs{$dev} =~ s/,$//; } + + $_ = ; + /(\d+)\ blocks\ \[(\d+)\/(\d+)\]\s+\[(.*)\]$/; + $size{$dev} = int($1/1024); + if ($size{$dev} > 1024){ + $size{$dev} = int($size{$dev}/1024)."GB"; + } + else{ + $size{$dev} .= "MB"; + } + $devs_total{$dev} = $2; + my $devs_up = $3; + my $stat = $4; + if ($devs_total{$dev} > $devs_up or $failed_devs{$dev} ne "none") { + $status{$dev} = "Degraded"; + $result = "CRITICAL"; + $retval = $ERRORS{"CRITICAL"}; + } + else{ + $status{$dev} = "Optimal"; + } + +} +print "$result: "; +foreach my $raid (@raids){ + print "$raid:$level{$raid}:$devs_total{$raid} drives:$size{$raid}:$status{$raid} "; +} +print "\n"; +close FILE; +exit $retval; + +# ===== +sub usage() +{ + printf(" +Check status of Linux SW RAID + +Author: Michal Ludvig (c) 2006 + http://www.logix.cz/michal/devel/nagios + +Usage: mdstat-parser.pl [options] + + --file= Name of file to parse. Default is /proc/mdstat + --device= Name of MD device, e.g. md0. Default is \"all\" + +"); + exit(1); +} + diff --git a/root/var/lib/zabbix/bin/megaraid-parser.pl b/root/var/lib/zabbix/bin/megaraid-parser.pl new file mode 100644 index 0000000..c6b5ba7 --- /dev/null +++ b/root/var/lib/zabbix/bin/megaraid-parser.pl @@ -0,0 +1,226 @@ +#!/usr/bin/perl -w + +# check_megaraid_sas Nagios plugin +# Copyright (C) 2007 Jonathan Delgado, delgado@molbio.mgh.harvard.edu +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# +# Nagios plugin to monitor the status of volumes attached to a LSI Megaraid SAS +# controller, such as the Dell PERC5/i and PERC5/e. If you have any hotspares +# attached to the controller, you can specify the number you should expect to +# find with the '-s' flag. +# +# The paths for the Nagios plugins lib and MegaCli may need to me changed. +# +# $Author: delgado $ +# $Revision: #3 $ $Date: 2007/06/07 $ + +# Slightly modified by Daniel B. for SME Server integration with zabbix +# 23 Apr 2009 + +use strict; +use Getopt::Std; + +our($opt_h, $opt_s, $opt_o, $opt_m, $opt_p); + + +getopts('hs:o:p:m:'); + +if ( $opt_h ) { + print "Usage: $0 [-s number] [-m number] [-o number]\n"; + print " -s is how many hotspares are attached to the controller\n"; + print " -m is the number of media errors to ignore\n"; + print " -p is the predictive error count to ignore\n"; + print " -o is the number of other disk errors to ignore\n"; + exit; +} + + +my $megacli = '/opt/MegaRAID/MegaCli/MegaCli'; + +## Return codes for Nagios +my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + +my ($adapters); +my $hotspares = 0; +my $hotsparecount = 0; +my $pdbad = 0; +my $pdcount = 0; +my $mediaerrors = 0; +my $mediaallow = 0; +my $prederrors = 0; +my $predallow = 0; +my $othererrors = 0; +my $otherallow = 0; +my $result = ''; +my $status = 'OK'; + +sub max_state ($$) { + my ($current, $compare) = @_; + + if (($compare eq 'CRITICAL') || ($current eq 'CRITICAL')) { + return 'CRITICAL'; + } elsif ($compare eq 'OK') { + return $current; + } elsif ($compare eq 'WARNING') { + return 'WARNING'; + } elsif (($compare eq 'UNKNOWN') && ($current eq 'OK')) { + return 'UNKNOWN'; + } else { + return $current; + } +} + + +if ( $opt_s ) { + $hotspares = $opt_s; +} +if ( $opt_m ) { + $mediaallow = $opt_m; +} +if ( $opt_p ) { + $predallow = $opt_p; +} +if ( $opt_o ) { + $otherallow = $opt_o; +} + +# Get the number of RAID controllers we have +open (ADPCOUNT, "$megacli -adpCount -NoLog |") + || die "error: Could not execute MegaCli -adpCount"; + +while () { + if ( m/Controller Count:\s*(\d+)/ ) { + $adapters = $1; + last; + } +} +close ADPCOUNT; + +ADAPTER: for ( my $adp = 0; $adp < $adapters; $adp++ ) { + # Get the number of logical drives on this adapter + open (LDGETNUM, "$megacli -LdGetNum -a$adp -NoLog |") + || die "error: Could not execute $megacli -LdGetNum -a$adp"; + + my ($ldnum); + while () { + if ( m/Number of Virtual drives configured on adapter \d:\s*(\d+)/i ) { + $ldnum = $1; + last; + } + } + close LDGETNUM; + + LDISK: for ( my $ld = 0; $ld < $ldnum; $ld++ ) { + # Get info on this particular logical drive + open (LDINFO, "$megacli -LdInfo -L$ld -a$adp -NoLog |") + || die "error: Could not execute $megacli -LdInfo -L$ld -a$adp -NoLog"; + + my ($size, $unit, $raidlevel, $ldpdcount, $spandepth, $state); + while () { + if ( m/Size:\s*((\d+)(MB|GB|TB))/ ) { + $size = $2; + $unit = $3; + # Adjust MB to GB if that's what we got + if ( $unit eq 'MB' ) { + $size = sprintf( "%.0f", ($size / 1024) ); + $unit= 'GB'; + } + } elsif ( m/State:\s*(\w+)/ ) { + $state = $1; + if ( $state ne 'Optimal' ) { + $status = 'CRITICAL'; + } + } elsif ( m/Number Of Drives( per span)?:\s*(\d+)/ ) { + $ldpdcount = $2; + } elsif ( m/Span Depth:\s*(\d+)/ ) { + $spandepth = $1; + $ldpdcount = $ldpdcount * $spandepth; + } elsif ( m/RAID Level: Primary-(\d)/ ) { + $raidlevel = $1; + } + } + close LDINFO; + + $result .= "$adp:$ld:RAID-$raidlevel:$ldpdcount drives:$size$unit:$state "; + + } #LDISK + close LDINFO; + + # Get info on physical disks for this adapter + open (PDLIST, "$megacli -PdList -a$adp -NoLog |") + || die "error: Could not execute $megacli -PdList -a$adp -NoLog"; + + my ($slotnumber,$fwstate); + PDISKS: while () { + if ( m/Slot Number:\s*(\d+)/ ) { + $slotnumber = $1; + # Don't care about backplane error counts + next if ( $slotnumber == 255 ); + $pdcount++; + } elsif ( m/(\w+) Error Count:\s*(\d+)/ ) { + if ( $1 eq 'Media') { + $mediaerrors += $2; + } else { + $othererrors += $2; + } + } elsif ( m/Predictive Failure Count:\s*(\d+)/ ) { + $prederrors += $1; + } elsif ( m/Firmware state:\s*(\w+)/ ) { + $fwstate = $1; + if ( $fwstate eq 'Hotspare' ) { + $hotsparecount++; + } elsif ( $fwstate eq 'Online' ) { + # Do nothing + } elsif ( $slotnumber != 255 ) { + $pdbad++; + $status = 'CRITICAL'; + } + } + } #PDISKS + close PDLIST; +} + +$result .= "Drives:$pdcount "; + +# Any bad disks? +if ( $pdbad ) { + $result .= "$pdbad Bad Drives "; +} + +my $errorcount = $mediaerrors + $prederrors + $othererrors; +# Were there any errors? +if ( $errorcount ) { + $result .= "($errorcount Errors) "; + if ( ( $mediaerrors > $mediaallow ) || + ( $prederrors > $predallow ) || + ( $othererrors > $otherallow ) ) { + $status = max_state($status, 'WARNING'); + } +} + +# Do we have as many hotspares as expected (if any) +if ( $hotspares ) { + if ( $hotsparecount < $hotspares ) { + $status = max_state($status, 'WARNING'); + $result .= "Hotspare(s):$hotsparecount (of $hotspares)"; + } else { + $result .= "Hotspare(s):$hotsparecount"; + } +} + +print STDOUT "$status: $result\n"; +exit $ERRORS{$status}; diff --git a/root/var/lib/zabbix/bin/mysqladmin_status b/root/var/lib/zabbix/bin/mysqladmin_status new file mode 100644 index 0000000..3ef9dab --- /dev/null +++ b/root/var/lib/zabbix/bin/mysqladmin_status @@ -0,0 +1,5 @@ +#!/bin/sh +HOME=/root + +exec /usr/bin/sudo /usr/bin/mysqladmin status + diff --git a/root/var/lib/zabbix/bin/parse_mail_in.pl b/root/var/lib/zabbix/bin/parse_mail_in.pl new file mode 100644 index 0000000..8815c46 --- /dev/null +++ b/root/var/lib/zabbix/bin/parse_mail_in.pl @@ -0,0 +1,103 @@ +#!/usr/bin/perl -w + +# Copyright (C) 2009 Daniel Berteaud + +# This file is part of smeserver-zabbix-agent package. + +# This script is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This script is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with Foobar; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +my $what = $ARGV[0] || ''; + +# On initialise nos compteurs a 0 +my @denied = qw(dnsbl rhsbl clamav check_earlytalker check_basicheaders check_goodrcptto check_spamhelo); +my @others = qw(total_denied spam_denied other_denied spam_queued queued total); +my %cnt; +foreach (@denied,@others){ + $cnt{$_} = 0; +} + +while () { + my $line = $_; + + # on limites aux lignes concernant logterse + # @400000004994ad092afa867c 18386 logging::logterse plugin: etc... + next unless $line =~ m/^\@[0-9a-f]{24} \d+ logging::logterse plugin/; + + # D'abord on traite tout ceux qui contiennent 'msg denied before queued' + if ($line =~ m/msg denied before queued/){ + $cnt{total_denied}++; + foreach (@denied){ + if ($line =~ m/$_/){ + $cnt{$_}++; + } + } + next; + } + + # Les messages refuses par spamassassin + elsif ($line =~ m/spam score exceeded threshold/){ + $cnt{spam_denied}++; + next; + } + + # Spam mis en queue + elsif ($line =~ m/queued.*Yes/){ + $cnt{spam_queued}++; + next; + } + + # Enfin, les bon mails + elsif ($line =~ m/queued.*No/){ + $cnt{queued}++; + next; + } +} + +# Caclul des totaux: +$cnt{other_denied} = $cnt{total_denied}; +foreach (@denied){ + $cnt{total} = $cnt{total} + $cnt{$_}; + $cnt{other_denied} = $cnt{other_denied} - $cnt{$_}; +} +foreach (@others){ + $cnt{total} = $cnt{total} + $cnt{$_} if ($_ !~ /total/); +} + +# Si l'argument est "print" on affiche toutes les stats +if ($what eq "print"){ + + foreach (@denied,@others){ + print "$_: $cnt{$_}\n"; + } +} + +# Si l'argument correspond a un compteur definit +# On affiche uniquemment cette valeur +elsif (defined $cnt{$what}){ + print "$cnt{$what}\n"; +} + +# Sinon, on quitte avec une erreur +else{ + print "supported items are: "; + foreach (@denied, @others){ + print "$_ "; + } + print "\n"; + exit 1; +} +exit 0; + diff --git a/root/var/lib/zabbix/bin/parse_mail_out.pl b/root/var/lib/zabbix/bin/parse_mail_out.pl new file mode 100644 index 0000000..58de9ff --- /dev/null +++ b/root/var/lib/zabbix/bin/parse_mail_out.pl @@ -0,0 +1,70 @@ +#!/usr/bin/perl -w + +# Copyright (C) 2009 Daniel Berteaud + +# This file is part of smeserver-zabbix-agent package. + +# This script is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This script is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with Foobar; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +my $what = $ARGV[0] || ''; + +# On initialise nos compteurs a 0 +my @results = qw(failure deferral success total); +my %cnt; +foreach (@results){ + $cnt{$_} = 0; +} + +while () { + my $line = $_; + + # on limites aux lignes concernant l'envoie + # @400000004994ad092afa867c delivery 96906: success etc... + next unless $line =~ m/^\@[0-9a-f]{24} delivery \d+: (success|failure|deferral).*(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|CNAME_lookup_failed_temporarily)/; + my $result = $1; + $cnt{$result}++; +} + +# Caclul des totaux: +foreach (@results){ + $cnt{total} = $cnt{total} + $cnt{$_} if $_ !~ /total/; +} + +# Si l'argument est "print" on affiche toutes les stats +if ($what eq "print"){ + + foreach (@results){ + print "$_: $cnt{$_}\n"; + } +} + +# Si l'argument correspond a un compteur definit +# On affiche uniquemment cette valeur +elsif (defined $cnt{$what}){ + print "$cnt{$what}\n"; +} + +# Sinon, on quitte avec une erreur +else{ + print "supported items are: "; + foreach (@results){ + print "$_ "; + } + print "\n"; + exit 1; +} +exit 0; + diff --git a/root/var/lib/zabbix/bin/sensors b/root/var/lib/zabbix/bin/sensors new file mode 100644 index 0000000..f7e1171 --- /dev/null +++ b/root/var/lib/zabbix/bin/sensors @@ -0,0 +1,57 @@ +#!/bin/bash + +KEY=$1 + +case $KEY in + cpu0) + # Here are some examples on how to retrieve temperatures + # of your system: + # + # If your motherboard support IPMI and you have the ipmitool package + # You can use this: + # Of course, you'll have to adapt command as each controler may report different sensors name + + # /usr/bin/ipmitool sdr | grep 'P1 Therm Margin' | cut -d'|' -f 2 | awk '{print $1'} + + # Else, if your motherboard support lm_sensor, you can use something + # like this: + # /usr/bin/sensors | grep temp1 | cut -d':' -f 2 | awk '{print $1'} | sed -e "s/+//g" -e "s/.C//g" + + # You can also try to get your CPU temperature with acpi: + # cat /proc/acpi/thermal_zone/THRM/temperature | awk '{print $2}' + + # It's important that your commands return only numerical values + + # The default for now is to use IPMI + /usr/bin/ipmitool sdr type Temperature | grep 'P1 Therm Margin' | cut -d'|' -f 2 | awk '{print $1'} + + ;; + cpu1) + # This will be the same as the above, but for the second CPU + + /usr/bin/ipmitool sdr type Temperature | grep 'P2 Therm Margin' | cut -d'|' -f 2 | awk '{print $1'} + + ;; + mb) + # AFAIK, motherboard temperature can be retrieved only with lm_sensor or IPMI + + /usr/bin/ipmitool sdr type Temperature | grep 'Baseboard' | cut -d'|' -f 2 | awk '{print $1'} + + ;; + ambiant) + # Some IPMI controler also report the ambiant temperature + /usr/bin/ipmitool sdr type Temperature | grep Ambient | cut -d'|' -f 2 | awk '{print $1'} + + ;; + hd*|sd*) + # Here, we want a harddrive temperature, so we'll use smartctl + # We could also use hddtemp but it doesn't seems to work for a lot of drive, where smartctl do + /usr/sbin/smartctl -a /dev/$KEY | grep Temperature_Celsius | awk '{print $10}' + + ;; + *) + # Else, we tell the server the item is not supported + echo 'ZBX_NOTSUPPORTED' + ;; +esac + diff --git a/smeserver-zabbix-agent.spec b/smeserver-zabbix-agent.spec new file mode 100644 index 0000000..dc4e523 --- /dev/null +++ b/smeserver-zabbix-agent.spec @@ -0,0 +1,403 @@ +# $Id: smeserver-zabbix-agent.spec,v 1.34 2012/06/07 16:26:43 vip-ire Exp $ +# Authority: vip-ire +# Name: Daniel Berteaud + +%define name smeserver-zabbix-agent +%define version 0.1 +%define release 52 +Summary: sme server integration of zabbix agent +Name: %{name} +Version: %{version} +Release: %{release}%{?dist} +License: GNU GPL version 2 +URL: http://www.zabbix.com/ +Group: SMEserver/addon +Source: %{name}-%{version}.tar.gz +Patch0: smeserver-zabbix-agent-0.1-hostname.patch +Patch1: smeserver-zabbix-agent-0.1-template_rename.patch +Patch2: smeserver-zabbix-agent-0.1-userparam_ext_ip.patch +Patch3: smeserver-zabbix-agent-0.1-userparam_ups.patch +Patch4: smeserver-zabbix-agent-0.1-userparam_mysql.patch +Patch5: smeserver-zabbix-agent-0.1-userparam_usedMem.patch +Patch6: smeserver-zabbix-agent-0.1-userparam_usedMem_brackets.patch +Patch7: smeserver-zabbix-agent-0.1-userparam_usedMem_key.patch +Patch8: smeserver-zabbix-agent-0.1-userparam_usedMem_Used.patch +Patch9: smeserver-zabbix-agent-0.1-userparam_usedMem_Used2.patch +Patch10: smeserver-zabbix-agent-0.1-userparam_MemStats.patch +Patch11: smeserver-zabbix-agent-0.1-userparam_MemStatsTypo.patch +Patch12: smeserver-zabbix-agent-0.1-userparam_Swap.patch +Patch13: smeserver-zabbix-agent-0.1-userparam_Swap_key.patch +Patch14: smeserver-zabbix-agent-0.1-userparam_removeUselessMemStats.patch +Patch15: smeserver-zabbix-agent-0.1-userparam_pusedMem.patch +Patch16: smeserver-zabbix-agent-0.1-userparam_upsCharge.patch +Patch17: smeserver-zabbix-agent-0.1-disable_passive_mode.patch +Patch18: smeserver-zabbix-agent-0.1-mail_in_stats.patch +Patch19: smeserver-zabbix-agent-0.1-event_zabbix_agent_update.patch +Patch20: smeserver-zabbix-agent-0.1-mail_in_stats_other_denied.patch +Patch21: smeserver-zabbix-agent-0.1-fix_expand_sudoers.patch +Patch22: smeserver-zabbix-agent-0.1-mail_out_stats.patch +Patch23: smeserver-zabbix-agent-0.1-mail_out_stats_typo.patch +Patch24: smeserver-zabbix-agent-0.1-mail_out_stats_ignore_local.patch +Patch25: smeserver-zabbix-agent-0.1-net_stats.patch +Patch26: smeserver-zabbix-agent-0.1-userparam_mysql_size.patch +Patch27: smeserver-zabbix-agent-0.1-adjust_masq.patch +Patch28: smeserver-zabbix-agent-0.1-timeout_comment.patch +Patch29: smeserver-zabbix-agent-0.1-buffers.patch +Patch30: smeserver-zabbix-agent-0.1-sudoers_mysql.patch +Patch31: smeserver-zabbix-agent-0.1-mysql_size_fixe.patch +Patch32: smeserver-zabbix-agent-0.1-userparam_swRaid_status.patch +Patch33: smeserver-zabbix-agent-0.1-userparam_comment.patch +Patch34: smeserver-zabbix-agent-0.1-userparam_megaraid.patch +Patch35: smeserver-zabbix-agent-0.1-userparam_yum_updates.patch +Patch36: smeserver-zabbix-agent-0.1-userparam_sensors.patch +Patch37: smeserver-zabbix-agent-0.1-sensors_fixes.patch +Patch38: smeserver-zabbix-agent-0.1-megaraid_parser.patch +Patch39: smeserver-zabbix-agent-0.1-mail_stats_via_cron.patch +Patch40: smeserver-zabbix-agent-0.1-mdstat_one_line.patch +Patch41: smeserver-zabbix-agent-0.1-megaraid_parser_fix.patch +Patch42: smeserver-zabbix-agent-0.1-cpu_num.patch +Patch43: smeserver-zabbix-agent-0.1-megaraid_fix_raid10.patch +Patch44: smeserver-zabbix-agent-0.1-userparam_smart.patch +Patch45: smeserver-zabbix-agent-0.1-smart_missing_return.patch +Patch46: smeserver-zabbix-agent-0.1-report_0_for_non_existing_drives.patch +Patch47: smeserver-zabbix-agent-0.1-run_megaraid_parser_as_root.patch +Patch48: smeserver-zabbix-agent-0.1-run_megaraid_parser_as_root2.patch +Patch49: smeserver-zabbix-agent-0.1-several_ups.patch +Patch50: smeserver-zabbix-agent-0.1-megaraid_options.patch +Patch51: smeserver-zabbix-agent-0.1-new_qpsmtpd.patch +Patch52: smeserver-zabbix-agent-0.1-megaraid_options_from_db.patch +Patch53: smeserver-zabbix-agent-0.1-disable_megaraid_log.patch +Patch54: smeserver-zabbix-agent-0.1-critical_vs_warning.patch +Patch55: smeserver-zabbix-agent-0.1-userparam_squid.patch +Patch56: smeserver-zabbix-agent-0.1-hostname_from_db.patch +Patch57: smeserver-zabbix-agent-0.1-userparam_diskio.patch +Patch58: smeserver-zabbix-agent-0.1-userparam_asterisk.patch +Patch59: smeserver-zabbix-agent-0.1-userparam_lvm.patch +Patch60: smeserver-zabbix-agent-0.1-add_usr_sbin_in_path.patch +Patch61: smeserver-zabbix-agent-0.1-statusmail.patch +Patch62: smeserver-zabbix-agent-0.1-configure_timeout.patch +Patch63: smeserver-zabbix-agent-0.1-better_asterisk_monitoring.patch +Patch64: smeserver-zabbix-agent-0.1-fix_closing_bracket.patch +Patch65: smeserver-zabbix-agent-0.1-check_crt_expiration.patch + +BuildArchitectures: noarch +BuildRequires: e-smith-devtools +BuildRoot: /var/tmp/%{name}-%{version} +Requires: e-smith-release >= 7.0 +Requires: zabbix-agent +Requires: smeserver-remoteuseraccess +Requires: perl(IO::Socket) +Requires: perl(Net::SSLeay) +Requires: perl(Date::Parse) +AutoReqProv: no + +%description +smserver integration of zabbix agent. +Zabbix is an entreprise-class open source distributed monitoring +solution + +%changelog +* Thu Jun 7 2012 Daniel B. - 0.1-52.sme +- Add missing perl module in dependency + +* Thu Jun 7 2012 Daniel B. - 0.1-51.sme +- Add certificate expiration script + +* Fri Oct 28 2011 Daniel B. - 0.1-50.sme +- Fix a closing bracket in templates + +* Wed Oct 26 2011 Daniel B. - 0.1-49.sme +- Add better asterisk monitoring capabilities + +* Fri Jul 08 2011 Daniel B. - 0.1-48.sme +- Configure timeout from the DB (prop TimeOut) + +* Wed May 04 2011 Daniel B. 0.1-47 +- Send status mail with some logs and active connexions (StatusMail prop) + +* Thu Sep 02 2010 Daniel B. 0.1-46 +- Add /usr/sbin in path for check_lvm and check_asterisk + +* Thu Sep 02 2010 Daniel B. 0.1-45 +- Add basic asterisk monitoring support +- Add basic LVM monitoring support + +* Wed Aug 04 2010 Daniel B. 0.1-44 +- Support up to 8 disks for I/O monitoring. Report valid 0 value + for non existing ones to prevent errors in server's log + +* Wed Jun 23 2010 Daniel B. 0.1-43 +- Possibility to set Hostname from the DB [SME: 6083] + +* Mon May 03 2010 Daniel B. 0.1-42 +- disable MegaCli log (which can break monitoring if log file reaches 2GB) +- report CRITICAL if both CRITICAL and WARNING are found +- add Squid UserParameters (hit ratio, cache size, req per minute) + +* Wed Mar 17 2010 Daniel B. 0.1-41 +- read megaraid options from the DB (number of spares, number of + error to ignore) + +* Fri Mar 12 2010 Daniel B. 0.1-40 +- update regex for incomming mail stats for newer qpsmtpd + +* Wed Feb 17 2010 Daniel B. 0.1-39 +- update megaraid-parser.pl script with options to ignore some errors + +* Mon Jan 4 2010 Daniel B. 0.1-38 +- Change UPS UserParameters to use wildcard, so you can monitor several UPS + easily (require changes in the templates on the server side) + +* Sun Dec 6 2009 Daniel B. 0.1-37 +- Call megaraid-parser.pl scripts with sudo in zabbix_agentd.conf + +* Wed Dec 2 2009 Daniel B. 0.1-36 +- Run megaraid-parser.pl as root (with sudo) instead of granting + zabbix user unrestricted access to MegaCli + +* Fri Sep 25 2009 Daniel B. 0.1-35 +- Support up to 8 disks for smart monitoring. Report valid 0 value + for non existing ones to prevent errors in server's log + +* Tue Sep 01 2009 Daniel B. 0.1-34 +- Add missing return after smart parameters (if several disks are monitored) + +* Mon Aug 31 2009 Daniel B. 0.1-33 +- Add system.smart UserParameter (monitor smart values for configured hard drives) + +* Wed Jul 08 2009 Daniel B. 0.1-32 +- Fix megaraid-parser script to support RAID-10 arrays + +* Mon Jun 08 2009 Daniel B. 0.1-31 +- Add cpu.number UserParameter (return the number of CPU on the host) + +* Wed May 06 2009 Daniel B. 0.1-30 +- Create missing tmp directory + +* Mon Apr 26 2009 Daniel B. 0.1-29 +- megaraid-parser.pl is now compatible with newer versions + of MegaCli +- Fix permission on megaraid-parser.pl script + +* Thu Apr 23 2009 Daniel B. 0.1-28 +- improvements in sensors script +- Add megaraid-parser.pl script to get more accurate MegaRaid + conrolers informations +- use a cronjob to parse mail logs so multiple zabbix server + can be used. Also, it won't repport false value if your host + has been unreachable for some time +- change output of mdstat-parser.pl to report everything in one + line (looks like megaraid-parser) + +* Mon Apr 20 2009 Daniel B. 0.1-27 +- Add updates.available to retrieve the number of updates available + with yum +- Added sensors[*] key to retrieve sensors informations. The value are retrieved + with the script /var/lib/zabbix/bin/sensors which can be customized. + +* Fri Mar 27 2009 Daniel B. 0.1-26 +- Add raid.mega.status UserParameters to monitor status of MegaRaid based + raid array + +* Tue Mar 24 2009 Daniel B. 0.1-25 +- Add comments for each UserParameter for configuration on the server side + (Type of information, unit, etc...) + +* Tue Mar 24 2009 Daniel B. 0.1-24 +- Add raid.sw.status userparameter to report software raid array status +- Remove tabs from spec +- Permission cleanup on scripts + +* Wed Mar 18 2009 Daniel B. 0.1-23 +- Correct mysql.size parameter (sudo -u mysql) + +* Mon Mar 09 2009 Daniel B. 0.1-22 +- Fix typo in sudoers template (ZABBIX_AGENT_MYSQL) + +* Mon Mar 02 2009 Daniel B. 0.1-21 +- Add smeserver-remoteuseraccess as a dependencie (sudoer templates issue) + +* Mon Mar 02 2009 Daniel B. 0.1-20 +- Adjust masq service on zabbix-agent-update event +- Add description of Timout directive +- Add BufferSend and BufferSize directive to optimize + agent <-> server communication + +* Sun Mar 01 2009 Daniel B. 0.1-19 +- Add size of mysql data (mysql.size) + +* Fri Feb 20 2009 Daniel B. 0.1-18 +- Add stats for InternalInterface and ExternalInterface + +* Tue Feb 17 2009 Daniel B. 0.1-17 +- Ignore local delivery from outgoing mail stats + +* Tue Feb 17 2009 Daniel B. 0.1-16 +- Fix a typo in mail.out.failure UserParameters + +* Tue Feb 17 2009 Daniel B. 0.1-15 +- Add UserParameters for outhoing mails statistics + +* Tue Feb 17 2009 Daniel B. 0.1-14 +- add missing other_denied UserParameters for mailStats +- Fix expand-template for /etc/sudoers during zabbix-agent-update event + +* Tue Feb 17 2009 Daniel B. 0.1-13 +- Add incoming mails statistics +- Rename signal-event to zabbix-agent-update (to prevent a conflict on + sudoers files which needs to be expanded for server and agent) + +* Wed Feb 11 2009 Daniel B. 0.1-12 +- Remove Useless buffers and cache mem +- Add vm.memory.size.pused (used memory in %) +- Add ups.battery.charge for ups +- Added "passive" db parameter +- default access is private + +* Tue Feb 10 2009 Daniel B. 0.1-11 +- Fix permissions on mysqladmin_status script + +* Tue Feb 10 2009 Daniel B. 0.1-10 +- Change used swap key + +* Tue Feb 10 2009 Daniel B. 0.1-9 +- Added userparameters for used swap space used in bytes + +* Tue Feb 10 2009 Daniel B. 0.1-8 +- Correct a type in memory statistics (for cached memory) + +* Tue Feb 10 2009 Daniel B. 0.1-7 +- Report also free, buffers and cached mem so stats are more accurate + +* Tue Feb 10 2009 Daniel B. 0.1-6 +- substract cache/buffer from used mem + +* Tue Feb 10 2009 Daniel B. 0.1-5 +- Change key name for used memory +- Report Used mem instead of total + +* Tue Feb 10 2009 Daniel B. 0.1-4 +- Escape brackets in template + +* Tue Feb 10 2009 Daniel B. 0.1-3 +- Add UserParameters to repport amount of used memory + +* Mon Feb 9 2009 Daniel B. 0.1-2 +- Add UserParameters to monitor real external IP, UPS status, + mysql stats + +* Fri Feb 6 2009 Daniel B. 0.1-1 +- add Hostname directive in zabbix_agentd.conf + +* Mon Feb 04 2009 Daniel B. 0.1-0 +- initial release + +%prep +%setup +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 +%patch16 -p1 +%patch17 -p1 +%patch18 -p1 +%patch19 -p1 +%patch20 -p1 +%patch21 -p1 +%patch22 -p1 +%patch23 -p1 +%patch24 -p1 +%patch25 -p1 +%patch26 -p1 +%patch27 -p1 +%patch28 -p1 +%patch29 -p1 +%patch30 -p1 +%patch31 -p1 +%patch32 -p1 +%patch33 -p1 +%patch34 -p1 +%patch35 -p1 +%patch36 -p1 +%patch37 -p1 +%patch38 -p1 +%patch39 -p1 +%patch40 -p1 +%patch41 -p1 +%patch42 -p1 +%patch43 -p1 +%patch44 -p1 +%patch45 -p1 +%patch46 -p1 +%patch47 -p1 +%patch48 -p1 +%patch49 -p1 +%patch50 -p1 +%patch51 -p1 +%patch52 -p1 +%patch53 -p1 +%patch54 -p1 +%patch55 -p1 +%patch56 -p1 +%patch57 -p1 +%patch58 -p1 +%patch59 -p1 +%patch60 -p1 +%patch61 -p1 +%patch62 -p1 +%patch63 -p1 +%patch64 -p1 +%patch65 -p1 + +%build +%{__mkdir_p} root/var/lib/zabbix/tmp +perl ./createlinks + +%install +rm -rf $RPM_BUILD_ROOT +(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT) +rm -f %{name}-%{version}-filelist +/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \ + --file /var/lib/zabbix/bin/mysqladmin_status 'attr(0750,root,zabbix)' \ + --file /var/lib/zabbix/bin/logtail.pl 'attr(0755,root,root)' \ + --file /var/lib/zabbix/bin/mail_in.sh 'attr(0755,root,root)' \ + --file /var/lib/zabbix/bin/mail_out.sh 'attr(0755,root,root)' \ + --file /var/lib/zabbix/bin/mdstat-parser.pl 'attr(0755,root,root)' \ + --file /var/lib/zabbix/bin/megaraid-parser.pl 'attr(0755,root,root)' \ + --file /var/lib/zabbix/bin/parse_mail_in.pl 'attr(0755,root,root)' \ + --file /var/lib/zabbix/bin/parse_mail_out.pl 'attr(0755,root,root)' \ + --file /var/lib/zabbix/bin/sensors 'attr(0750,root,zabbix) %config(noreplace)' \ + --file /var/lib/zabbix/bin/check_asterisk 'attr(0750,root,zabbix)' \ + --file /var/lib/zabbix/bin/check_lvm 'attr(0755,root,root)' \ + --file /var/lib/zabbix/bin/mailstatus.pl 'attr(0755,root,root)' \ + --file /var/lib/zabbix/bin/cert_expire.pl 'attr(0755,root,root)' \ + --dir /var/lib/zabbix/tmp 'attr(0750,zabbix,zabbix)' \ + > %{name}-%{version}-filelist + +%files -f %{name}-%{version}-filelist +%defattr(-,root,root) + +%clean +rm -rf $RPM_BUILD_ROOT + + +%postun +#uninstall +if [ $1 = 0 ] ; then + /sbin/e-smith/db configuration setprop zabbix-agent status disabled + /etc/init.d/zabbix-agent stop +fi + +true