Initial commit

This commit is contained in:
Eric Renfro 2013-06-28 12:42:51 -04:00
commit 724e0fdfc3
22 changed files with 25045 additions and 0 deletions

52
runtrap Executable file
View File

@ -0,0 +1,52 @@
#!/bin/bash
lockfile="/tmp/zabbix.trap.lock"
tempfile=$(mktemp /tmp/zabbix.trap.tmp.XXXXXXXXXX)
trapdir="$(dirname $(readlink -f $0))/trap.d"
errors=0
if [[ -r "${lockfile}" ]]; then
if [[ $(pgrep -f $(readlink -f $0) | wc -l) -gt 0 ]]; then
runs=$(head -n1 ${lockfile})
if [[ $runs -ge 3 ]]; then
echo "need to kill prior poll"
for s in ${trapdir}/*
do
echo "Kill: $s "
pkill -9 -f $s
done
rm -f /tmp/zabbix.trap.lock
rm -f /tmp/zabbix.trap.tmp.*
pkill -9 -f $(readlink -f $0)
else
#let "runs++"
echo "$[ ++runs ]" > ${lockfile}
exit 0
fi
fi
fi
echo 1 > ${lockfile}
for s in ${trapdir}/*
do
$s > ${tempfile} 2> /dev/null
if [ $? -ne 0 ]; then
errors=1
fi
done
cat ${tempfile}
rm -f ${tempfile}
echo
echo "Errors: $errors"
exit 0
zsend=$(zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -i ${tempfile})
if [ $? -ne 0 ]; then
echo "2"
else
echo "${errors}"
fi
rm -f ${tempfile}

263
scripts/apache.trap.py Executable file
View File

@ -0,0 +1,263 @@
#!/usr/bin/python2
""" Fetch Apache stats via mod_status and send to Zabbix
By Paulson McIntyre
Patches by:
Zach Bailey <znbailey@gmail.com>
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 3 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, see <http://www.gnu.org/licenses/>.
"""
import urllib
from optparse import OptionParser
import os
from tempfile import mkstemp
import StringIO
import csv
import socket
class ErrorSendingValues(RuntimeError):
""" An error occured while sending the values to the Zabbix
server using zabbix_sender.
"""
def fetchURL(url, user = None, passwd = None):
""" Return the data from a URL """
if user and passwd:
parts = url.split('://')
url = parts[0] + "://" + user + ":" + passwd + "@" + parts[1]
conn = urllib.urlopen(url)
try:
data = conn.read()
finally:
conn.close()
return data
def sendValues(filepath, zabbixserver = "localhost", zabbixport = 10051, senderloc = "zabbix_sender"):
r = os.system("%s --zabbix-server '%s' --port '%s' -i '%s' -vv" % (senderloc, zabbixserver, zabbixport, filepath))
if r != 0:
raise ErrorSendingValues, "An error occured sending the values to the server"
def clean(string, chars):
for i in chars:
string = string.replace(i, '')
return string
def parse(data):
""" Parse the CSV file into a dict of data
"""
mapping = {
"_":"Waiting For Connection",
"S":"Starting Up",
"R":"Reading Request",
"W":"Sending Reply",
"K":"KeepAlive",
"D":"DNS Lookup",
"C":"Closing Connection",
"L":"Logging",
"G":"Gracefully Finishing",
"I":"Idle Cleanup Of Worker",
".":"Open slot with no current process",
}
mappingFloat = [
"CPULoad",
"ReqPerSec",
"BytesPerReq",
"BytesPerSec",
]
# Clean out certian chars
replace = '() '
csvobj = csv.reader(StringIO.StringIO(data), delimiter = ":", skipinitialspace = True)
ret = {}
for (key, val) in csvobj:
if key == 'Scoreboard':
sb = {
"Waiting For Connection":0,
"Starting Up":0,
"Reading Request":0,
"Sending Reply":0,
"KeepAlive":0,
"DNS Lookup":0,
"Closing Connection":0,
"Logging":0,
"Gracefully Finishing":0,
"Idle Cleanup Of Worker":0,
"Open slot with no current process":0,
}
for i in val:
sb[mapping[i]] += 1
ret[key] = sb
else:
ret[key] = val
ret2 = {}
for (key, val) in ret.items():
if key == "Scoreboard":
for (key, val) in val.items():
ret2[clean(key, replace)] = val
if key in mappingFloat:
ret2[clean(key, replace)] = float(val)
else:
ret2[clean(key, replace)] = val
return ret2
if __name__ == "__main__":
parser = OptionParser(
usage = "%prog [-z <Zabbix hostname or IP>] [-o <Apache hostname or IP>]",
version = "%prog $Revision$",
prog = "ApacheStatsForZabbix",
description = """This program gathers data from Apache's
built-in status page and sends it to
Zabbix. The data is sent via zabbix_sender.
Author: Paulson McIntyre (GpMidi)
License: GPLv2
""",
)
parser.add_option(
"-l",
"--url",
action = "store",
type = "string",
dest = "url",
default = None,
help = "Override the automatically generated URL with one of your own",
)
parser.add_option(
"-o",
"--host",
action = "store",
type = "string",
dest = "host",
default = "localhost",
help = "Host to connect to. [default: %default]",
)
parser.add_option(
"-p",
"--port",
action = "store",
type = "int",
dest = "port",
default = 80,
help = "Port to connect on. [default: %default]",
)
parser.add_option(
"-r",
"--proto",
action = "store",
type = "string",
dest = "proto",
default = "http",
help = "Protocol to connect on. Can be http or https. [default: %default]",
)
parser.add_option(
"-z",
"--zabixserver",
action = "store",
type = "string",
dest = "zabbixserver",
default = None,
help = "Zabbix Server to send metrics to. [default: Disabled]",
)
parser.add_option(
"-u",
"--user",
action = "store",
type = "string",
dest = "user",
default = None,
help = "HTTP authentication user to use when connection. [default: None]",
)
parser.add_option(
"-a",
"--passwd",
action = "store",
type = "string",
dest = "passwd",
default = None,
help = "HTTP authentication password to use when connecting. [default: None]",
)
parser.add_option(
"-s",
"--sender",
action = "store",
type = "string",
dest = "senderloc",
default = "/usr/bin/zabbix_sender",
help = "Location to the zabbix_sender executable. [default: %default]",
)
parser.add_option(
"-q",
"--zabbixport",
action = "store",
type = "int",
dest = "zabbixport",
default = 10051,
help = "Zabbix port to connect to. [default: %default]",
)
parser.add_option(
"-c",
"--zabbixsource",
action = "store",
type = "string",
dest = "zabbixsource",
default = socket.gethostname(),
help = "Zabbix host to use when sending values. [default: %default]",
)
(opts, args) = parser.parse_args()
if opts.url and (opts.port != 80 or opts.proto != "http"):
parser.error("Can't specify -u with -p or -r")
if not opts.url:
opts.url = "%s://%s:%s/server-status?auto" % (opts.proto, opts.host, opts.port)
data = fetchURL(opts.url, user = opts.user, passwd = opts.passwd)
try:
if opts.zabbixserver is not None:
(tempfiled, tempfilepath) = mkstemp()
tempfile = open(tempfilepath, 'wb')
except:
parser.error("Error creating temporary file")
try:
data = parse(data = data)
except csv.Error:
parser.error("Error parsing returned data")
try:
for key, val in data.items():
if opts.zabbixserver is not None:
tempfile.write("%s apache[%s] %s\n" % (opts.zabbixsource, key, val))
else:
print "%s apache[%s] %s"%(opts.zabbixsource, key, val)
if opts.zabbixserver is not None:
tempfile.close()
except IndexError:
parser.error("No data")
except "bogus":
parser.error("Error creating the file to send")
try:
if opts.zabbixserver is not None:
sendValues(filepath = tempfilepath, zabbixserver = opts.zabbixserver, zabbixport = opts.zabbixport, senderloc = opts.senderloc)
except ErrorSendingValues:
parser.error("An error occurred while sending values to the Zabbix server")
finally:
if opts.zabbixserver is not None:
try:
tempfile.close()
except:
pass
os.remove(tempfilepath)

4
scripts/delay.trap Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
sleep 3600

565
scripts/domain-check Executable file
View File

@ -0,0 +1,565 @@
#!/bin/bash
#
# Source: http://www.cyberciti.biz/files/scripts/domain-check-2.txt
# Program: Domain Expiration Check <domain-check>
#
# Author: Matty < matty91 at gmail dot com >
#
# Current Version: 1.95
#
# Revision History:
# Version 1.96
# Rename variables so system variables aren't potentially changed. -- Eric Renfro <psi-jack@linux-help.org>
# Code optimization and per-whois delay capability is possible. -- Eric Renfro <psi-jack@linux-help.org>
# Output table is now fully string size padded for results. -- Eric Renfro <psi-jack@linux-help.org>
# Version 1.95
# Added support for .ie and .us domain names
# Cleaned up some areas where awk and cut were being called
# directly rather than from the variables they were asigned to. -- Chris Jones <chris@sysadminchris.com>
# Version 1.9
# Bug fix and enhancement for .uk and .co.uk -- Vivek Gite <vivek@nixcraft.com>
#
# Version 1.8
# Bug fix added $mailContact -- Vivek Gite <vivek@nixcraft.com>
#
# Version 1.7
# Added support for .jp domain names -- Vivek Gite <vivek@nixcraft.com>
#
# Version 1.6
# Added support for .uk domain names; fixed a bug detecting tldtype -- Vivek Gite <vivek@nixcraft.com>
#
# Version 1.5
# Added support for .org, .in, .biz and .info domain names -- Vivek Gite <vivek@nixcraft.com>
#
# Version 1.4
# Updated the documentation.
#
# Version 1.3
# Gracefully Handle the case where the expiration data is unavailable
#
# Version 1.2
# Added "-s" option to allow arbitrary registrars
#
# Version 1.1
# Fixed issue with 'e' getopt string -- Pedro Alves
#
# Version 1.0
# Initial Release
#
# Last Updated: 07-Aug-2012
#
# Purpose:
# domain-check checks to see if a domain has expired. domain-check
# can be run in interactive and batch mode, and provides faciltities
# to alarm if a domain is about to expire.
#
# License:
# 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.
#
# Notes:
# Since each registrar provides expiration data in a unique format (if
# they provide it at all), domain-check is currently only able to
# processess expiration information for a subset of the available
# registrars.
#
# Requirements:
# Requires whois
#
# Installation:
# Copy the shell script to a suitable location
#
# Tested platforms:
# -- Solaris 9 using /bin/bash
# -- Solaris 10 using /bin/bash
# -- OS X 10.4.2 using /bin/sh
# -- OpenBSD using /bin/sh
# -- FreeBSD using /bin/sh
# -- Redhat advanced server 3.0MU3 using /bin/sh
#
# Usage:
# Refer to the usage() sub-routine, or invoke domain-check
# with the "-h" option.
#
# Example:
#
# The first example will print the expiration date and registrar for prefetch.net:
#
# $ domain-check.sh -d prefetch.net
#
# Domain Registrar Status Expires Days Left
# ----------------------------------- ----------------- -------- ----------- ---------
# prefetch.net INTERCOSMOS MEDIA Valid 13-feb-2006 64
#
# The second example prints the expiration date and registrar for the domains
# listed in the file "domains":
#
# $ domain-check.sh -f domains
#
# Domain Registrar Status Expires Days Left
# ----------------------------------- ----------------- -------- ----------- ---------
# sun.com NETWORK SOLUTIONS Valid 20-mar-2010 1560
# google.com EMARKMONITOR INC. Valid 14-sep-2011 2103
# ack.com NETWORK SOLUTIONS Valid 09-may-2008 880
# prefetch.net INTERCOSMOS MEDIA Valid 13-feb-2006 64
# spotch.com GANDI Valid 03-dec-2006 357
#
# The third example will e-mail the address admin@prefetch.net with the domains that
# will expire in 60-days or less:
#
# $ domain-check -a -f domains -q -x 60 -e admin@prefetch.net
#
PATH=/bin:/usr/bin:/usr/local/bin:/usr/local/ssl/bin:/usr/sfw/bin ; export PATH
# Who to page when an expired domain is detected (cmdline: -e)
admin="sysadmin@mydomain.com"
# Hostname to report to Zabbix Servers (cmdline: -i)
hostname="-"
# Number of days in the warning threshhold (cmdline: -x)
warnDays=30
# If quiet is set to TRUE, don't print anything on the console (cmdline: -q)
quiet=false
# Human readable output default to off for Zabbix server processing (cmdline: -r)
human=false
# Don't send emails by default (cmdline: -a)
alarm=false
# JSON Discovery mode off by default (cmdline: -j)
json=false
# Whois server to use (cmdline: -s)
whoisServer="whois.internic.org"
# Location of system binaries
awk="/usr/bin/awk"
whois="/usr/bin/whois"
date="/bin/date"
cut="/usr/bin/cut"
mailContact="/bin/mail"
# Track tld types for query limiting:
declare -A domainPoll
#############################################################################
# Purpose: Convert a date from month-DAY-YEAR to Julian format
# Acknowledgements: Code was adapted from examples in the book
# "Shell Scripting Recipes: A Problem-Solution Approach"
# ( ISBN 1590594711 )
# Arguments:
# $1 -> Month (e.g., 06)
# $2 -> Day (e.g., 08)
# $3 -> Year (e.g., 2006)
#############################################################################
date2julian()
{
if [[ "${1} != "" && "${2} != "" && "${3}" != "" ]]
then
## Since leap years add aday at the end of February,
## calculations are done from 1 March 0000 (a fictional year)
d2j_tmpmonth=$((12 * ${3} + ${1} - 3))
## If it is not yet March, the year is changed to the previous year
d2j_tmpyear=$(( ${d2j_tmpmonth} / 12))
## The number of days from 1 March 0000 is calculated
## and the number of days from 1 Jan. 4713BC is added
echo $(( (734 * ${d2j_tmpmonth} + 15) / 24 - 2 * ${d2j_tmpyear} + ${d2j_tmpyear}/4
- ${d2j_tmpyear}/100 + ${d2j_tmpyear}/400 + $2 + 1721119 ))
else
echo 0
fi
}
#############################################################################
# Purpose: Convert a string month into an integer representation
# Arguments:
# $1 -> Month name (e.g., Sep)
#############################################################################
getmonth()
{
case ${1,,} in
jan) echo 1 ;;
feb) echo 2 ;;
mar) echo 3 ;;
apr) echo 4 ;;
may) echo 5 ;;
jun) echo 6 ;;
jul) echo 7 ;;
aug) echo 8 ;;
sep) echo 9 ;;
oct) echo 10 ;;
nov) echo 11 ;;
dec) echo 12 ;;
*) echo 0 ;;
esac
}
#############################################################################
# Purpose: Calculate the number of seconds between two dates
# Arguments:
# $1 -> Date #1
# $2 -> Date #2
#############################################################################
date_diff()
{
if [[ "${1}" != "" && "${2}" != "" ]]
then
echo $(expr ${2} - ${1})
else
echo 0
fi
}
##################################################################
# Purpose: Access whois data to grab the registrar and expiration date
# Arguments:
# $1 -> Domain to check
##################################################################
check_domain_status()
{
local registrar=""
# Avoid whois LIMIT EXCEEDED - slowdown our whois client by adding 3 sec
#sleep 3
# Save the domain since set will trip up the ordering
domain=${1}
tldType="$(echo ${domain} | ${cut} -d '.' -f3 | tr '[A-Z]' '[a-z]')"
if [[ "${tldType}" = "" ]];
then
tldType="$(echo ${domain} | ${cut} -d '.' -f2 | tr '[A-Z]' '[a-z]')"
fi
# Invoke whois to find the domain registrar and expiration date
#whoisVal=$(${whois} -h ${whoisServer} "=${1}")
# Let whois select server
# The whois Expiration data should resemble the following: "Expiration Date: 09-may-2008"
case $tldType in
"org") [[ -n ${domainPoll[$tldType]} ]] && sleep 15
whoisVal=$(${whois} -h "whois.pir.org" "${1}")
registrar=$(echo "$whoisVal" | grep "Sponsoring Registrar:" | cut -d':' -f2)
domainDate=$(echo "${whoisVal}" | ${awk} '/Expiration Date:/ { print $2 }' | ${cut} -d':' -f2)
;;
"in") whoisVal=$(${whois} -h "whois.registry.in" "${1}")
registrar=$(echo "$whoisVal" | grep "Sponsoring Registrar:" | cut -d':' -f2)
domainDate=$(echo "${whoisVal}" | ${awk} '/Expiration Date:/ { print $2 }' | ${cut} -d':' -f2)
;;
"uk") whoisVal=$(${whois} -h "whois.nic.uk" "${1}")
registrar=$(echo "$whoisVal" | grep "Sponsoring Registrar:" | cut -d':' -f2)
domainDate=$(echo "${whoisVal}" | ${awk} '/Renewal date:/ || /Expiry date:/ { print $3 }')
;;
"biz") whoisVal=$(${whois} -h "whois.neulevel.biz" "${1}")
registrar=$(echo "$whoisVal" | grep "Sponsoring Registrar:" | cut -d':' -f2)
domainDate=$(echo "${whoisVal}" | ${awk} '/Domain Expiration Date:/ { print $6"-"$5"-"$9 }')
;;
"info") whoisVal=$(${whois} -h "whois.afilias.info" "${1}")
registrar=$(echo "$whoisVal" | grep "Sponsoring Registrar:" | cut -d':' -f2)
domainDate=$(echo "${whoisVal}" | ${awk} '/Expiration Date:/ { print $2 }' | ${cut} -d':' -f2)
;;
"us") whoisVal=$(${whois} -h "whois.nic.us" "${1}")
registrar=$(echo "$whoisVal" | grep "Sponsoring Registrar:" | cut -d':' -f2)
domainDate=$(echo "${whoisVal}" | ${awk} '/Domain Expiration Date:/ { print $6"-"$5"-"$9 }')
;;
"com" | "net" | "edu")
whoisVal=$(${whois} -h "whois.internic.org" "${1}")
registrar=$(echo "$whoisVal" | grep "Registrar:" | sed -e 's/^[ \t]*//g' -e 's/[ \t]*$//g' | cut -d':' -f2 | sed -e 's/^[ \t]*//g')
domainDate=$(echo "${whoisVal}" | ${awk} '/Expiration/ { print $NF }')
#echo "Registrar = $registrar"
#exit 0
;;
"ie") whoisVal=$(${whois} -h "whois.domainregistry.ie" "${1}")
registrar=$(echo "$whoisVal" | grep "Sponsoring Registrar:" | cut -d':' -f2)
tdomdate=$(echo "${whoisVal}" | ${awk} '/renewal/ { print $2 }')
tyear=$(echo ${tdomdate} | ${cut} -d'-' -f3)
tmon=$(echo ${tdomdate} | ${cut} -d'-' -f2)
case ${tmon} in
"January") tmonth=jan ;;
"February") tmonth=feb ;;
"March") tmonth=mar ;;
"April") tmonth=apr ;;
"May") tmonth=may ;;
"June") tmonth=jun ;;
"July") tmonth=jul ;;
"August") tmonth=aug ;;
"September") tmonth=sep ;;
"October") tmonth=oct ;;
"November") tmonth=nov ;;
"December") tmonth=dec ;;
*) tmonth=0 ;;
esac
tday=$(echo ${tdomdate} | ${cut} -d'-' -f1)
domainDate=$(echo $tday-$tmonth-$tyear)
;;
"jp") whoisVal=$(${whois} -h "whois.jprs.jp" "${1}")
registrar=$(echo "$whoisVal" | grep "Sponsoring Registrar:" | cut -d':' -f2)
tdomdate=$(echo "${whoisVal}" | ${awk} '/Expires on/ { print $3 }')
tyear=$(echo ${tdomdate} | ${cut} -d'/' -f1)
tmon=$(echo ${tdomdate} | ${cut} -d'/' -f2)
case ${tmon} in
1|01) tmonth=jan ;;
2|02) tmonth=feb ;;
3|03) tmonth=mar ;;
4|04) tmonth=apr ;;
5|05) tmonth=may ;;
6|06) tmonth=jun ;;
7|07) tmonth=jul ;;
8|08) tmonth=aug ;;
9|09) tmonth=sep ;;
10) tmonth=oct ;;
11) tmonth=nov ;;
12) tmonth=dec ;;
*) tmonth=0 ;;
esac
tday=$(echo ${tdomdate} | ${cut} -d'/' -f3)
domainDate=$(echo $tday-$tmonth-$tyear)
;;
"cz") whoisVal=$(${whois} -h "${whoisServer}" "${1}")
registrar=$(echo "$whoisVal" | grep "Sponsoring Registrar:" | cut -d':' -f2)
tdomdate=$(echo "${whoisVal}" | awk '/expire:/ { print $2 }')
tyear=$(echo ${tdomdate} | cut -d'.' -f3)
tmon=$(echo ${tdomdate} | cut -d'.' -f2)
tday=$(echo ${tdomdate} | cut -d'.' -f1)
case ${tmon} in
1|01) tmonth=jan ;;
2|02) tmonth=feb ;;
3|03) tmonth=mar ;;
4|04) tmonth=apr ;;
5|05) tmonth=may ;;
6|06) tmonth=jun ;;
7|07) tmonth=jul ;;
8|08) tmonth=aug ;;
9|09) tmonth=sep ;;
10) tmonth=oct ;;
11) tmonth=nov ;;
12) tmonth=dec ;;
*) tmonth=0 ;;
esac
domainDate=$(echo $tday-$tmonth-$tyear)
;;
*) whoisVal=$(${whois} -h "${whoisServer}" "${1}")
registrar=$(echo "$whoisVal" | grep "Sponsoring Registrar:" | cut -d':' -f2)
domainDate=$(echo "${whoisVal}" | ${awk} '/Expiration/ { print $NF }')
;;
esac
if [[ -z ${domainPoll[$tldType]} ]]; then
domainPoll[$tldType]=1
else
let domainPoll[$tldType]++
fi
# If the Registrar is NULL, then we didn't get any data
#if [[ "${registrar}" = "" ]]
#then
# prints "$domain" "Unknown" "Unknown" "Unknown" "Unknown"
# return
#fi
#echo $domainDate # debug
# Whois data should be in the following format: "13-feb-2006"
IFS="-"
set -- ${domainDate}
month=$(getmonth ${2})
IFS=""
# Convert the date to seconds, and get the diff between NOW and the expiration date
domainJulian=$(date2julian ${month} ${1#0} ${3})
domainDiff=$(date_diff ${nowJulian} ${domainJulian})
if ! $human
then
echo "$hostname domain.daysleft.${domain} ${domainDiff}"
fi
if [[ ${domainDiff} -lt 0 ]]
then
if $alarm
then
echo "The domain ${domain} has expired!" \
| ${mailContact} -s "Domain ${domain} has expired!" ${admin}
fi
prints ${domain} "Expired" "${domainDate}" "${domainDiff}" ${registrar}
elif [[ ${domainDiff} -lt ${warnDays} ]]
then
if $alarm
then
echo "The domain ${domain} will expire on ${domainDate}" \
| ${mailContact} -s "Domain ${domain} will expire in ${warnDays}-days or less" ${admin}
fi
prints ${domain} "Expiring" "${domainDate}" "${registrar}"
else
prints ${domain} "Valid" "${domainDate}" "${domainDiff}" "${registrar}"
fi
}
####################################################
# Purpose: Print a heading with the relevant columns
# Arguments:
# None
####################################################
print_heading()
{
if $human
then
if ! $quiet
then
printf "\n%-35s %-17s %-8s %-11s %-5s\n" "Domain" "Registrar" "Status" "Expires" "Days Left"
echo "----------------------------------- ----------------- -------- ----------- ---------"
fi
fi
}
#####################################################################
# Purpose: Print a line with the expiraton interval
# Arguments:
# $1 -> Domain
# $2 -> Status of domain (e.g., expired or valid)
# $3 -> Date when domain will expire
# $4 -> Days left until the domain will expire
# $5 -> Domain registrar
#####################################################################
prints()
{
if $human
then
if ! $quiet
then
minDate=$(echo $3 | ${awk} '{ print $1, $2, $4 }')
printf "%-35s %-17s %-8s %-11s %-5s\n" "${1:0:35}" "${5:0:17}" "${2:0:8}" "${minDate:0:11}" "${4:0:5}"
fi
fi
}
##########################################
# Purpose: Describe how the script works
# Arguments:
# None
##########################################
usage()
{
#app="$(basename $0)"
echo "Usage:" >&2
echo "Zabbix Agent Mode:" >&2
echo " [-s whois_host] [-i hostname] <-d domain | -f file>" >&2
echo "Human Readable Mode:" >&2
echo " -r [-q][-a] [-e email] [-x days] [-s host] <-d domain|-f file>" >&2
echo "JSON Mode:" >&2
echo " -j -f domainfile" >&2
echo "" >&2
echo " -a : Send a warning message through email " >&2
echo " -d domain : Domain to analyze (interactive mode)" >&2
echo " -e email address : Email address to send expiration notices" >&2
echo " -f domain file : File with a list of domains" >&2
echo " -h : Print this screen" >&2
echo " -i hostname : Hostname for Zabbix Server" >&2
echo " -j : Discovery JSON Object for Zabbix auto-discovery, (needs -f)" >&2
echo " -r : Human Readable" >&2
echo " -s whois server : Whois sever to query for information" >&2
echo " -q : Don't print anything on the console" >&2
echo " -x days : Domain expiration interval (eg. if domain_ date < days)" >&2
echo "" >&2
}
### Evaluate the options passed on the command line
while getopts ae:f:i:jrhd:s:qx: option
do
case "${option}"
in
a) alarm=true;;
e) admin=${OPTARG};;
d) domain=${OPTARG};;
f) serverFile=$OPTARG;;
i) hostname=$OPTARG;;
j) json=true;;
r) human=true;;
s) whoisServer=$OPTARG;;
q) quiet=true;;
x) warnDays=$OPTARG;;
\?) usage
exit 1;;
esac
done
### Check to see if the whois binary exists
if [[ ! -f ${whois} ]]
then
echo "ERROR: The whois binary does not exist in ${whois}." >&2
echo " FIX: Please modify the \$whois variable in the program header." >&2
exit 1
fi
### Check to make sure a date utility is available
if [[ ! -f ${date} ]]
then
echo "ERROR: The date binary does not exist in ${date}." >&2
echo " FIX: Please modify the \$date variable in the program header." >&2
exit 1
fi
### Baseline the dates so we have something to compare to
month=$(${date} "+%m")
DAY=$(${date} "+%d")
YEAR=$(${date} "+%Y")
nowJulian=$(date2julian ${month#0} ${DAY#0} ${YEAR})
### If a HOST and PORT were passed on the cmdline, use those values
if $json
then
if [[ -f "${serverFile}" ]]
then
echo "{"
echo " \"data\":["
echo
while read domain
do
echo " { \"{#DOMAIN}\":\"${domain}\" },"
done < ${serverFile}
echo
echo " ]"
echo "}"
else
usage
exit 1
fi
else
if [[ "${domain}" != "" ]]
then
print_heading
check_domain_status "${domain}"
### If a file and a "-a" are passed on the command line, check all
### of the domains in the file to see if they are about to expire
elif [[ -f "${serverFile}" ]]
then
print_heading
while read domain
do
#sleep 30
check_domain_status "${domain}"
done < ${serverFile}
### There was an error, so print a detailed usage message and exit
else
usage
exit 1
fi
# Add an extra newline
if $human
then
echo
fi
fi
### Exit with a success indicator
exit 0
# vim: et ts=4 sw=4

20
scripts/memcached.trap.php Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/php
<?php
#$zabbix_sender = "/usr/bin/zabbix_sender";
#$zabbix_server = "172.19.1.21";
#$zabbix_port = 10051;
#$agent_hostname = gethostname();
$agent_hostname = "-";
$memcache_server = $argv[1];
$memcache_port = $argv[2];
#$memcache_server = "172.19.1.21";
#$memcache_port = 11211;
$m=new Memcache;
$m->connect($memcache_server,$memcache_port);
$s=$m->getstats();
foreach($s as $key=>$value) {
echo "$agent_hostname memcache.$key $value\n";
#exec("$zabbix_sender $zabbix_server $zabbix_port $memcache_server memcache.$key $value");
}
?>

933
scripts/mysql.trap.php Executable file
View File

@ -0,0 +1,933 @@
#!/usr/bin/php
<?php
/**
Changelog:
Version 0.4: Added round() to Joins_without_indexes_per_day to remove exponents for large query sets.
Version 0.3: 11:57 AM 10/13/2008
- Correct where Percent_innodb_cache_hit_rate and/or Percent_innodb_cache_write_waits_required could have been 0
Version 0.2: 10:43 AM 10/13/2008
- Corrected error where replication not enabled stopped the monitoring completely (If you had your warning on strict, the server could see things like: Notice: Undefined variable: Slave_IO_Running)
- Ditto for Last_Errno, Last_Error
*/
#error_reporting(E_ALL|E_STRICT);
error_reporting(E_ERROR | E_PARSE);
define('DEBUG',false);
define('SLOWINNODB',1); // If you set this to 1, then the script is very careful about status variables to avoid http://bugs.mysql.com/bug.php?id=36600
#define('SYSTEM','mysql'.(DEBUG ? "-debug" : ""));
define('SYSTEM','mysql');
define('LOG',"/tmp/zabbix_".SYSTEM.".log");
define('DAT',"/tmp/zabbix_".SYSTEM.".dat");
define('UTIME',"/tmp/.zabbix_".SYSTEM.".utime");
define('DTIME',"/tmp/.zabbix_".SYSTEM.".dtime");
#zabbix_config();
date_default_timezone_set('America/New_York');
if ( empty($argv[1]) ) {
echo "Usage:\n";
echo "$argv[0] live|daily\n";
exit(1);
}
$type = $argv[1];
#$user = $argv[2];
#$pass = $argv[3];
#$host = gethostname();
$host = "-";
require_once(__FILE__ . ".conf");
$cred = "-u$user -p$pass";
$tosendDaily = array();
// Get server information for zabbix_sender
#$config = file_get_contents("/etc/zabbix/zabbix_agentd.conf");
#preg_match("/\n[\s]*Hostname[\s]*=[\s]*(.+)[\s]*\n/i", $config, $parts);
#preg_match("/^[\s]*Hostname[\s]*=[\s]*(.+)[\s]*$/im", $config, $parts);
#$host = "\"" . trim($parts[1]) . "\"";
#echo "$host\n\n";
#var_dump($parts);
#exit(0);
#preg_match("/Server\s*=\s*(.*)/i",$config,$parts);
#$server = $parts[1];
$physical_memory = (int)`free -b | grep Mem | awk '{print \$2}'`;
$swap_memory = (int)`free -b | grep Swap | awk '{print \$2}'`;
if ( DEBUG ) {
#echo sprintf("Physical Memory: %s, Swap: %s\n",byte_size($physical_memory),byte_size($swap_memory));
file_put_contents('php://stderr', sprintf("Physical Memory: %s, Swap: %s\n",byte_size($physical_memory),byte_size($swap_memory)));
}
// Is this a 64bit machine?
#$bit64 = ereg("/64/",`uname -m`);
if ( PHP_INT_SIZE == 8 ) $bit64 = true;
else $bit64 = false;
// Gather localhost aliases
$valids = array("localhost","127.0.0.1", "%");
$hosts = `grep 127.0.0.1 /etc/hosts`;
$lines = explode("\n",$hosts);
foreach ( $lines as $line )
{
$parts = preg_split("/[ \t,]+/",$line);
for ( $i=1; $i<count($parts); $i++ )
if ( $parts[$i] > "" )
$valids[] = $parts[$i];
}
// Connect to the MySQL server
$connection = mysqli_connect("localhost",$user,$pass);
if ( mysqli_connect_errno($connection) ) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
exit(2);
} else {
mysqli_select_db($connection, "mysql");
}
// Get the version number
$parts = explode(" ",`mysql --version`);
$Version = substr($parts[5],0,strlen($parts[4])-1);
// Get server variables
$engines = array('have_myisam'=>'YES','have_memory'=>'YES'); // these are auto enabled. no config necessary
$result = mysqli_query($connection, "show global variables;");
if ( $result )
while ($row = mysqli_fetch_assoc($result)) {
$var = $row["Variable_name"];
$val = $row["Value"];
$$var = $val;
if ( substr($var,0,5) == "have_" && $val == "YES" ) {
$engines[$var] = $val;
}
}
if ( SLOWINNODB ) {
// Global status variables we use:
$statusVars = array("Aborted_clients", "Aborted_connects", "Binlog_cache_disk_use", "Binlog_cache_use", "Bytes_received", "Bytes_sent", "Com_alter_db", "Com_alter_table", "Com_create_db", "Com_create_function", "Com_create_index", "Com_create_table", "Com_delete", "Com_drop_db", "Com_drop_function", "Com_drop_index", "Com_drop_table", "Com_drop_user", "Com_grant", "Com_insert", "Com_replace", "Com_revoke", "Com_revoke_all", "Com_select", "Com_update", "Connections", "Created_tmp_disk_tables", "Created_tmp_tables", "Handler_read_first", "Handler_read_key", "Handler_read_next", "Handler_read_prev", "Handler_read_rnd", "Handler_read_rnd_next", "Innodb_buffer_pool_read_requests", "Innodb_buffer_pool_reads", "Innodb_buffer_pool_wait_free", "Innodb_buffer_pool_write_requests", "Innodb_log_waits", "Innodb_log_writes", "Key_blocks_unused", "Key_read_requests", "Key_reads", "Key_write_requests", "Key_writes", "Max_used_connections", "Open_files", "Open_tables", "Opened_tables", "Qcache_free_blocks", "Qcache_free_memory", "Qcache_hits", "Qcache_inserts", "Qcache_lowmem_prunes", "Qcache_not_cached", "Qcache_queries_in_cache", "Qcache_total_blocks", "Questions", "Select_full_join", "Select_range", "Select_range_check", "Select_scan", "Slave_running", "Slow_launch_threads", "Slow_queries", "Sort_merge_passes", "Sort_range", "Sort_rows", "Sort_scan", "Table_locks_immediate", "Table_locks_waited", "Threads_cached", "Threads_connected", "Threads_created", "Threads_running", "Uptime");
foreach ( $statusVars as $var ) {
$result = mysqli_query($connection, "show global status like '$var';");
if ( $result )
while ($row = mysqli_fetch_assoc($result)) {
$var = $row["Variable_name"];
$val = $row["Value"];
$$var = $val;
}
}
} else {
$result = mysqli_query($connection, "show global status;");
if ( $result )
while ($row = mysqli_fetch_assoc($result)) {
$var = $row["Variable_name"];
$$var = $row["Value"];
}
}
// Replication master status
$result = mysqli_query($connection, "show master status;");
if ( $result )
while ($row = mysqli_fetch_assoc($result)) {
foreach ( $row as $key => $var ) {
$key = "Master_Status_$key";
$$key = $var;
}
}
$result = mysqli_query($connection, "show slave status;");
if ( $result )
while ($row = mysqli_fetch_assoc($result)) {
foreach ( $row as $key => $var )
$$key = $var;
}
// Didn't error above, so Available
$Available = 1;
if ( $type == "daily" ) {
if ( file_exists(DTIME) ) {
$Diff = (time() - filectime(DTIME))/60/60/24;
if ( $Diff < 1 ) {
if ( DEBUG ) {
#echo "Skipping daily gathering\n";
file_put_contents('php://stderr', "Skipping daily gathering\n");
}
#echo 1;
exit(0);
}
unlink(DTIME);
}
file_put_contents(DTIME,"Ran at ".date("Y-m-d H:i")."\n");
// These are dangerous privileges
$privs = array(
"Insert_priv"=>"Insert_priv_count",
"Update_priv"=>"Update_priv_count",
"Delete_priv"=>"Delete_priv_count",
"Drop_priv"=>"Drop_priv_count",
"Shutdown_priv"=>"Shut_down_priv_count",
"Process_priv"=>"Process_priv_count",
"File_priv"=>"File_priv_count",
"Grant_priv"=>"Grant_priv_count",
"Alter_priv"=>"Alter_priv_count",
"Super_priv"=>"Super_priv_count",
"Lock_tables_priv"=>"Lock_tables_priv_count",
);
foreach ( $privs as $key => $var )
$$var = 0;
// Now, load users and let's see what's there
$result = mysqli_query($connection, "select * from user");
$Root_accounts_count = $Accounts_without_password = $Accounts_with_broad_host_specifier = $Anonymous_accounts_count = 0;
while ($row = mysqli_fetch_assoc($result)) {
if ( $row['Host'] == "" || $row['Host']=='%' )
$Accounts_with_broad_host_specifier++;
if ( $row["User"] == "root" )
{
$Root_accounts_count++;
$invalid = false;
if ( $row["Host"] == "" || $row["Host"]=="%" || !in_array($row["Host"],$valids) )
$Is_root_remote_login_enabled = 1;
if ( $row["Password"] == "" )
$Is_root_without_password = 1;
}
if ( $row['Password'] == "" )
$Accounts_without_password++;
if ( $row['User'] == "" )
$Anonymous_accounts_count++;
foreach ( $privs as $key => $var )
if ( $row[$key] == "Y" )
$$var++;
}
// How many fragmented tables to we have?
$result = mysqli_query($connection, "SELECT COUNT(TABLE_NAME) as Frag FROM information_schema.TABLES WHERE TABLE_SCHEMA NOT IN ('information_schema','mysql') AND Data_free > 10000");
$Fragmented_table_count = 0;
while ($row = mysqli_fetch_assoc($result)) {
$Fragmented_table_count = $row["Frag"];
}
// Get the engines in use
$result = mysqli_query($connection, "SELECT DISTINCT ENGINE FROM information_schema.TABLES");
if ( $result )
while ($row = mysqli_fetch_assoc($result)) {
foreach ( $row as $key => $var ) {
$key = "have_".strtolower($var);
if ( array_key_exists( $key,$engines ) )
$engines[$key] = "USED";
}
}
$innodb_only_install = ( $engines['have_myisam'] == "YES" && $engines['have_innodb'] == "USED" ) ? 1 : 0;
$myisam_only_install = ( $engines['have_myisam'] == "USED" && $engines['have_innodb'] == "YES" ) ? 1 : 0;
$Suggested_table_cache = max(256,$max_connections*2);
$Maximum_memory_possible = ($innodb_buffer_pool_size + $key_buffer_size + $max_connections * ($sort_buffer_size + $read_buffer_size + $binlog_cache_size) + $max_connections * mb(2));
$Available_memory = $physical_memory * 9 / 10;
$Available_memory -= $max_connections * kb(256);
$Suggested_query_cache_size = ($Available_memory / 10 < mb(8) ? mb(8) : $Available_memory / 10);
$Available_memory -= $Suggested_query_cache_size;
$bm = $Available_memory * 7 / 10;
$tbm = $Available_memory * 3 / 10;
$mpt = $tbm * 10 / $max_connections;
$bm -= $Suggested_table_cache * kb(8);
$btb = $mpt*10;
$Suggested_tmp_table_size = max(mb(16),$btb);
$tc = max($max_connections/2, 16);
$Suggested_thread_cache_size = min($tc,64);
$msbs = max($btb,mb(8));
$Suggested_myisam_sort_buffer_size = min($msbs,$physical_memory*2/10);
$mb = $bm * ($innodb_only_install ? 0.05 : ($myisam_only_install ? 1 : 0.5));
$Suggested_key_buffer_size = max($mb/2, mb(8));
$Suggested_read_buffer_size = min($physical_memory/100,$mpt*20/100,kb(64));
$Suggested_read_rnd_buffer_size = min($physical_memory*4/100,$mpt*40/100,kb(256));
$Suggested_sort_buffer_size = min($physical_memory*2/100,$mpt*30/100,kb(256));
if ( $myisam_only_install ) {
$Suggested_innodb_additional_mem_pool_size =
$Suggested_innodb_log_buffer_size =
$Suggested_innodb_buffer_pool_size =
$Suggested_innodb_log_file_size = 0;
} else {
$ib = $bm * (1 - ($innodb_only_install ? 0.05 : ($myisam_only_install ? 1 : 0.5)));
$Suggested_innodb_additional_mem_pool_size = max(mb(2),$ib*2/100);
$ib -= $Suggested_innodb_additional_mem_pool_size;
$Suggested_innodb_log_buffer_size = min(max(mb(1),$ib/100),mb(16));
$ib -= $Suggested_innodb_log_buffer_size;
$Suggested_innodb_buffer_pool_size = $ibps = max($ib, mb(8));
$ib -= $Suggested_innodb_buffer_pool_size;
$Suggested_innodb_log_file_size = min($ibps*2/10, gb(1));
}
$innodb_only_install = ( $engines['have_myisam'] == "YES" && $engines['have_innodb'] == "USED" ) ? 1 : 0;
$myisam_only_install = ( $engines['have_myisam'] == "USED" && $engines['have_innodb'] == "YES" ) ? 1 : 0;
if ( $innodb_only_install ) {
if ( DEBUG ) {
#echo "InnoDB only -- suggesting heavy settings for InnoDB\n";
file_put_contents('php://stderr', "InnoDB only -- suggesting heavy settings for InnoDB\n");
}
$innodb_suggested_buffer_size = round(0.75 * $physical_memory);
$myisam_suggested_key_buffer_size = 0;
} elseif ( $myisam_only_install ) {
if ( DEBUG ) {
#echo "MyISAM only -- suggesting heavy settings for MyISAM\n";
file_put_contents('php://stderr', "MyISAM only -- suggesting heavy settings for MyISAM\n");
}
$innodb_suggested_buffer_size = 0;
$myisam_suggested_key_buffer_size = round(0.40 * $physical_memory);
} else { // ok, we're a mixed install
// These are SWAG's. Need better calculations....
if ( DEBUG ) {
#echo "Mixed install. Balancing settings\n";
file_put_contents('php://stderr', "Mixed install. Balancing settings\n");
}
$innodb_suggested_buffer_size = round(0.50 * $physical_memory);
$myisam_suggested_key_buffer_size = round(0.25 * $physical_memory);
}
$innodb_buffer_size_low = !close($innodb_buffer_pool_size,$innodb_suggested_buffer_size);
$myisam_key_buffer_size_low = !close($key_buffer_size,$myisam_suggested_key_buffer_size);
$tosendDaily = array(
'Architecture_handles_all_memory' => ($physical_memory <= 2147483648 || $bit64 ? 1 : 0),
'Maximum_memory_total' => $Maximum_memory_possible,
'Maximum_memory_over_physical' => $Maximum_memory_possible > $physical_memory ? 1 :0,
'Maximum_memory_exceeds_32bit_capabilities' => !$bit64 ? $Maximum_memory_possible > gb(2) : 0,
// Suggested configuration settings
'Suggested_table_cache' => byte_size($Suggested_table_cache),
'Change_table_cache' => !close($Suggested_table_cache,$table_cache),
'table_cache' => $table_cache,
'Suggested_query_cache_size' => byte_size($Suggested_query_cache_size),
'Change_query_cache_size' => !close($Suggested_query_cache_size,$query_cache_size),
'query_cache_size' => $query_cache_size,
'Suggested_tmp_table_size' => byte_size($Suggested_tmp_table_size),
'Change_tmp_table_size' => !close($Suggested_tmp_table_size,$tmp_table_size),
'tmp_table_size' => $tmp_table_size,
'Suggested_myisam_sort_buffer_size' => byte_size($Suggested_myisam_sort_buffer_size),
'Change_myisam_sort_buffer_size' => !close($Suggested_myisam_sort_buffer_size,$myisam_sort_buffer_size),
'myisam_sort_buffer_size' => $myisam_sort_buffer_size,
'Suggested_key_buffer_size' => byte_size($Suggested_key_buffer_size),
'Change_key_buffer_size' => !close($Suggested_key_buffer_size,$key_buffer_size),
'key_buffer_size' => $key_buffer_size,
'Suggested_read_buffer_size' => byte_size($Suggested_read_buffer_size),
'Change_read_buffer_size' => !close($Suggested_read_buffer_size,$read_buffer_size),
'read_buffer_size' => $read_buffer_size,
'Suggested_read_rnd_buffer_size' => byte_size($Suggested_read_rnd_buffer_size),
'Change_read_rnd_buffer_size' => !close($Suggested_read_rnd_buffer_size,$read_rnd_buffer_size),
'read_rnd_buffer_size' => $read_rnd_buffer_size,
'Suggested_sort_buffer_size' => byte_size($Suggested_sort_buffer_size),
'Change_sort_buffer_size' => !close($Suggested_sort_buffer_size,$sort_buffer_size),
'sort_buffer_size' => $sort_buffer_size,
'Suggested_innodb_additional_mem_pool_size' => byte_size($Suggested_innodb_additional_mem_pool_size),
'Change_innodb_additional_mem_pool_size' => !close($Suggested_innodb_additional_mem_pool_size,$innodb_additional_mem_pool_size),
'innodb_additional_mem_pool_size' => $innodb_additional_mem_pool_size,
'Suggested_innodb_log_buffer_size' => byte_size($Suggested_innodb_log_buffer_size),
'Change_innodb_log_buffer_size' => !close($Suggested_innodb_log_buffer_size,$innodb_log_buffer_size),
'innodb_log_buffer_size' => $innodb_log_buffer_size,
'Suggested_innodb_buffer_pool_size' => byte_size($Suggested_innodb_buffer_pool_size),
'Change_innodb_buffer_pool_size' => !close($Suggested_innodb_buffer_pool_size,$innodb_buffer_pool_size),
'innodb_buffer_pool_size' => $innodb_buffer_pool_size,
'Suggested_innodb_log_file_size' => byte_size($Suggested_innodb_log_file_size),
'Change_innodb_log_file_size' => !close($Suggested_innodb_log_file_size,$innodb_log_file_size),
'innodb_log_file_size' => $innodb_log_file_size,
// Remove these!
#'myisam_suggested_key_buffer_size' => $myisam_suggested_key_buffer_size,
#'innodb_suggested_buffer_size' => $innodb_suggested_buffer_size,
#'innodb_buffer_size_low' => $innodb_buffer_size_low,
#'myisam_key_buffer_size_low' => $myisam_key_buffer_size_low,
// Setup/Security parameters
'Accounts_with_broad_host_specifier' => $Accounts_with_broad_host_specifier,
'Accounts_without_password' => $Accounts_without_password,
'Anonymous_accounts_count' => $Anonymous_accounts_count,
'Alter_priv_count' => $Alter_priv_count,
'Delete_priv_count' => $Delete_priv_count,
'Drop_priv_count' => $Drop_priv_count,
'File_priv_count' => $File_priv_count,
'Grant_priv_count' => $Grant_priv_count,
'Insert_priv_count' => $Insert_priv_count,
'Lock_tables_priv_count' => $Lock_tables_priv_count,
'Process_priv_count' => $Process_priv_count,
'Shut_down_priv_count' => $Shut_down_priv_count,
'Super_priv_count' => $Super_priv_count,
'Update_priv_count' => $Update_priv_count,
'Is_root_remote_login_enabled' => $Is_root_remote_login_enabled,
'Is_root_without_password' => $Is_root_without_password,
'Root_accounts_count' => $Root_accounts_count,
'have_symlink' => $have_symlink,
'old_passwords' => $old_passwords,
'secure_auth' => $secure_auth,
'skip_show_database' => $skip_show_database,
'myisam_recover_options' => $myisam_recover_options == "OFF" ? 0 : 1,
'wait_timeout' => $wait_timeout,
'slow_launch_time' => $slow_launch_time,
'local_infile' => $local_infile,
'log_bin' => $log_bin,
'log_queries_not_using_indexes' => $log_queries_not_using_indexes,
'log_slow_queries' => $log_slow_queries,
'long_query_time' => $long_query_time,
'Version' => $Version,
'binlog_cache_size' => $binlog_cache_size,
'sync_binlog' => $sync_binlog,
'have_query_cache' => $have_query_cache,
'query_cache_limit' => $query_cache_limit,
'query_cache_min_res_unit' => $query_cache_min_res_unit,
'query_cache_type' => $query_cache_type,
'query_prealloc_size' => $query_prealloc_size,
'join_buffer_size' => $join_buffer_size,
'key_cache_block_size' => $key_cache_block_size,
'max_heap_table_size' => $max_heap_table_size,
'sql_mode' => $sql_mode,
'max_connections' => $max_connections,
'thread_cache_size' => $thread_cache_size,
'innodb_flush_log_at_trx_commit' => $innodb_flush_log_at_trx_commit,
'innodb_log_files_in_group' => $innodb_log_files_in_group,
'expire_logs_days' => $expire_logs_days,
// Types of queries and usage
'Com_alter_db' => $Com_alter_db,
'Com_alter_table' => $Com_alter_table,
'Com_create_db' => $Com_create_db,
'Com_create_function' => $Com_create_function,
'Com_create_index' => $Com_create_index,
'Com_create_table' => $Com_create_table,
'Com_drop_db' => $Com_drop_db,
'Com_drop_function' => $Com_drop_function,
'Com_drop_index' => $Com_drop_index,
'Com_drop_table' => $Com_drop_table,
'Com_drop_user' => $Com_drop_user,
'Com_grant' => $Com_grant,
'Excessive_revokes' => $Com_revoke + $Com_revoke_all,
'Percent_writes_vs_total' => percent( ($Com_insert + $Com_replace + $Com_update + $Com_delete) / $Questions ),
'Percent_inserts_vs_total' => percent( ($Com_insert + $Com_replace) / $Questions ),
'Percent_selects_vs_total' => percent( ($Com_select + $Qcache_hits) / $Questions ),
'Percent_deletes_vs_total' => percent( $Com_delete / $Questions ),
'Percent_updates_vs_total' => percent( $Com_update / $Questions ),
'Recent_schema_changes' => $Com_create_db > 0 || $Com_alter_db > 0 || $Com_drop_db > 0 || $Com_create_function > 0 || $Com_drop_function > 0 || $Com_create_index > 0 || $Com_drop_index > 0 || $Com_alter_table > 0 || $Com_create_table > 0 || $Com_drop_table > 0 || $Com_drop_user > 0,
'Fragmented_table_count' => $Fragmented_table_count,
);
}
elseif ( (int)$Uptime < 3600 ) { // wait 1h before sending data after a restart
#echo 1;
exit(0);
}
// Make a pretty uptime string
$seconds = $Uptime % 60;
$minutes = floor(($Uptime % 3600) / 60);
$hours = floor(($Uptime % 86400) / (3600));
$days = floor($Uptime / (86400));
if ($days > 0) {
$Uptimestring = "${days}d ${hours}h ${minutes}m ${seconds}s";
} elseif ($hours > 0) {
$Uptimestring = "${hours}h ${minutes}m ${seconds}s";
} elseif ($minutes > 0) {
$Uptimestring = "${minutes}m ${seconds}s";
} else {
$Uptimestring = "${seconds}s";
}
if ( $days == 0 ) $days = 100000000; // force percentage to be low on calculation
if ( !isset($Innodb_buffer_pool_read_requests) || $Innodb_buffer_pool_read_requests == 0 )
$Percent_innodb_cache_hit_rate = 0;
else
$Percent_innodb_cache_hit_rate = pct2hi( 1 - ($Innodb_buffer_pool_reads / $Innodb_buffer_pool_read_requests) );
if ( !isset($Innodb_buffer_pool_write_requests) || $Innodb_buffer_pool_write_requests == 0 )
$Percent_innodb_cache_write_waits_required = 0;
else
$Percent_innodb_cache_write_waits_required = percent( $Innodb_buffer_pool_wait_free / $Innodb_buffer_pool_write_requests );
$tosendLive = array(
'Available' => $Available,
'Uptime' => $Uptimestring,
'Last_Errno' => isset($Last_Errno) ? $Last_Errno : 0,
'Last_Error' => isset($Last_Error) ? $Last_Error : "",
// Binlog parameters
'Binlog_cache_disk_use' => $Binlog_cache_disk_use,
'Binlog_cache_use' => $Binlog_cache_use,
// Performance/Usage/Queries
'Questions' => $Questions,
'Queries_per_sec' => elapsed((float)$Questions),
'Bytes_received' => $Bytes_received,
'Bytes_sent' => $Bytes_sent,
'Select_full_join' => $Select_full_join,
'Select_scan' => $Select_scan,
'Slow_queries' => $Slow_queries,
'Qcache_free_blocks' => $Qcache_free_blocks,
'Qcache_free_memory' => $Qcache_free_memory,
'Qcache_hits' => $Qcache_hits,
'Qcache_inserts' => $Qcache_inserts,
'Qcache_lowmem_prunes' => $Qcache_lowmem_prunes,
'Qcache_lowmem_prunes_per_day' => $Qcache_lowmem_prunes/$days,
'Qcache_not_cached' => $Qcache_not_cached,
'Qcache_queries_in_cache' => $Qcache_queries_in_cache,
'Qcache_total_blocks' => $Qcache_total_blocks,
'Average_rows_per_query' => ($Handler_read_first + $Handler_read_key + $Handler_read_next + $Handler_read_prev + $Handler_read_rnd + $Handler_read_rnd_next + $Sort_rows)/$Questions,
'Total_rows_returned' => $Handler_read_first + $Handler_read_key + $Handler_read_next + $Handler_read_prev + $Handler_read_rnd + $Handler_read_rnd_next + $Sort_rows,
'Indexed_rows_returned' => $Handler_read_first + $Handler_read_key + $Handler_read_next + $Handler_read_prev,
'Sort_merge_passes' => $Sort_merge_passes,
'Sort_range' => $Sort_range,
'Sort_scan' => $Sort_scan,
'Total_sort' => $Sort_range+$Sort_scan,
'Joins_without_indexes' => $Select_range_check + $Select_full_join,
'Joins_without_indexes_per_day' => round(($Select_range_check + $Select_full_join)/$days,0),
'Percent_full_table_scans' => percent( ($Handler_read_rnd_next + $Handler_read_rnd) / ($Handler_read_rnd_next + $Handler_read_rnd + $Handler_read_first + $Handler_read_next + $Handler_read_key + $Handler_read_prev) ),
'Percent_query_cache_fragmentation' => percent( $Qcache_free_blocks / $Qcache_total_blocks ),
'Percent_query_cache_hit_rate' => percent( $Qcache_hits / ($Qcache_inserts + $Qcache_hits) ),
'Percent_query_cache_pruned_from_inserts' => percent( $Qcache_lowmem_prunes / $Qcache_inserts ),
'Percent_myisam_key_cache_in_use' => percent( (1 - ($Key_blocks_unused / ($key_buffer_size / $key_cache_block_size))) ),
'Percent_myisam_key_cache_hit_rate' => pct2hi( (1 - ($Key_reads / $Key_read_requests)) ),
'Percent_myisam_key_cache_write_ratio' => percent( $Key_writes / $Key_write_requests ),
'Number_myisam_key_blocks' => $key_buffer_size / $key_cache_block_size,
'Used_myisam_key_cache_blocks' => ($key_buffer_size / $key_cache_block_size) - $Key_blocks_unused,
'Key_read_requests' => $Key_read_requests,
'Key_reads' => $Key_reads,
'Key_write_requests' => $Key_write_requests,
'Key_writes' => $Key_writes,
// Tables and Temp Tables stats
'Open_tables' => $Open_tables,
'Opened_tables' => $Opened_tables,
'Table_locks_immediate' => $Table_locks_immediate,
'Table_locks_waited' => $Table_locks_waited,
'Created_tmp_disk_tables' => $Created_tmp_disk_tables,
'Created_tmp_tables' => $Created_tmp_tables,
'Percent_table_cache_hit_rate' => $Opened_tables > 0 ? pct2hi($Open_tables/$Opened_tables) : 100,
'Percent_table_lock_contention' => ($Table_locks_waited + $Table_locks_immediate) > 0 ? percent( $Table_locks_waited / ($Table_locks_waited + $Table_locks_immediate)) : 0,
'Percent_tmp_tables_on_disk' => ($Created_tmp_disk_tables + $Created_tmp_tables) > 0 ? percent( $Created_tmp_disk_tables / ($Created_tmp_disk_tables + $Created_tmp_tables)) : 0,
'Percent_transactions_saved_tmp_file' => ($Binlog_cache_use == 0 ? 0 : percent( $Binlog_cache_disk_use / $Binlog_cache_use) ),
'Percent_tmp_sort_tables' => ($Sort_range+$Sort_scan > 0 ? percent( $Sort_merge_passes/($Sort_range+$Sort_scan)) : 0 ),
'Percent_files_open' => $open_files_limit > 0 ? percent( $Open_files/$open_files_limit) : 0,
// Clients, Threads, and Connections
'Aborted_clients' => $Aborted_clients,
'Aborted_connects' => $Aborted_connects,
'Connections' => $Connections,
'Successful_connects' => $Connections - $Aborted_connects,
'Max_used_connections' => $Max_used_connections,
'Slow_launch_threads' => $Slow_launch_threads,
'Threads_cached' => $Threads_cached,
'Threads_connected' => $Threads_connected,
'Threads_created' => $Threads_created,
'Threads_created_rate' => $Threads_created,
'Threads_running' => $Threads_running,
'Percent_thread_cache_hit_rate' => pct2hi( (1-$Threads_created/$Connections) ),
'Percent_connections_used' => percent( $Threads_connected / $max_connections ),
'Percent_aborted_connections' => percent( $Aborted_connects / $Connections ),
'Percent_maximum_connections_ever' => percent( $Max_used_connections / $max_connections ),
// Innodb stats
'Percent_innodb_log_size_vs_buffer_pool' => percent( ($innodb_log_files_in_group * $innodb_log_file_size) / $innodb_buffer_pool_size ),
'Percent_innodb_log_write_waits_required' => percent( $Innodb_log_waits / $Innodb_log_writes ),
'Percent_innodb_cache_hit_rate' => $Percent_innodb_cache_hit_rate,
'Percent_innodb_cache_write_waits_required' => $Percent_innodb_cache_write_waits_required,
'Innodb_log_file_size_total' => $innodb_log_files_in_group * $innodb_log_file_size,
);
// Sometimes, replication isn't reported if not enabled. Test first before adding
if ( isset($Master_Status_File) )
{
$tosendLive = array_merge($tosendLive,array(
// Replication information
'Master_Status_Position' => $Master_Status_Position,
'Master_Status_File' => $Master_Status_File,
'Master_Status_Binlog_Do_DB' => $Master_Status_Binlog_Do_DB,
'Master_Status_Binlog_Ignore_DB' => $Master_Status_Binlog_Ignore_DB,
));
}
if ( isset($Relay_Log_File) )
{
$tosendLive = array_merge($tosendLive,array(
'Master_Host' => $Master_Host,
'Master_Log_File' => $Master_Log_File,
'Master_Port' => $Master_Port,
'Master_User' => $Master_User,
'Read_Master_Log_Pos' => $Read_Master_Log_Pos,
'Relay_Log_File' => $Relay_Log_File,
'Relay_Log_Pos' => $Relay_Log_Pos,
'Relay_Log_Space' => $Relay_Log_Space,
'Relay_Master_Log_File' => $Relay_Master_Log_File,
'Exec_Master_Log_Pos' => $Exec_Master_Log_Pos,
'Slave_IO_Running' => $Slave_IO_Running,
'Slave_IO_State' => $Slave_IO_State,
'Slave_SQL_Running' => $Slave_SQL_Running,
'Slave_running' => $Slave_IO_Running="Yes" && $Slave_SQL_Running="Yes" ? 1 : 0,
'Seconds_Behind_Master' => $Seconds_Behind_Master,
));
}
$tosend = $type == "daily" ? $tosendDaily : $tosendLive;
foreach ( $tosend as $key => $var )
zabbix_post($key,$var);
//system("zabbix_sender -z $server -i ".DAT." >> ".LOG);
#echo 1;
exit(0);
function close($a,$b) {
if ( $a == 0 && $b > 1 ) return 0;
if ( $b == 0 && $a > 1 ) return 0;
$delta = abs($b-$a)*100/$a;
return $delta < 90;
}
function kb($a) { return $a*1024; }
function mb($a) { return $a*1024*1024; }
function gb($a) { return $a*1024*1024*1024; }
function byte_size($size)
{
$filesizename = array("", "K", "M", "G", "T", "P", "E", "Z", "Y");
return $size ? round($size/pow(1024, ($i = floor(log($size, 1024)))), 0) . $filesizename[$i] : '0';
}
function pct2hi($a) {
global $Uptime;
return $Uptime < 86400 ? 100 : percent($a);
}
function percent($a) {
return round(100*$a);
}
function zabbix_config() {
global $server,$host;
if ( file_exists(DAT) ) unlink(DAT);
if ( file_exists(LOG) ) unlink(LOG);
// Get server information for zabbix_sender
$config = file_get_contents("/etc/zabbix/zabbix_agentd.conf");
preg_match("/Hostname\s*=\s*(.*)/i",$config,$parts);
$host = $parts[1];
preg_match("/Server\s*=\s*(.*)/i",$config,$parts);
$server = $parts[1];
}
function zabbix_post($var,$val) {
global $server,$host;
switch ( strtolower($val) ) {
case "yes":
case "on":
$val = 1;
break;
case "no":
case "":
case "off":
$val = 0;
break;
}
if ( !is_numeric($val) && $val != "1" )
#if ( is_string($val) )
$val = '"'.$val.'"';
echo "$host ".SYSTEM.".$var $val\n";
#file_put_contents(DAT,"$server $host 10051 ".SYSTEM.".$var $val\n",FILE_APPEND);
#$cmd = "zabbix_sender -z $server -p 10051 -s $host -k ".SYSTEM.".$var -o $val";
#if ( DEBUG )
# echo "$cmd\n";
#else
# echo "$cmd\n";
# #system("$cmd 2>&1 >> ".LOG);
}
function elapsed($val) {
$now = microtime(true);
if ( !file_exists(UTIME) ) // first time
file_put_contents(UTIME,serialize(array( "value" => $val, "start" => $now )));
$data = unserialize(file_get_contents(UTIME));
file_put_contents(UTIME,serialize(array( "value" => $val, "start" => $now )));
$seconds = $now-$data["start"];
$elapsed = (float)($val - $data["value"])/( !$seconds || $seconds==0 ? 1 : $seconds);
return $elapsed < 0 ? 0 : $elapsed;
}
/** All STATUS variables:
Aborted_clients
Aborted_connects
Binlog_cache_disk_use
Binlog_cache_use
Bytes_received
Bytes_sent
Com_admin_commands
Com_alter_db
Com_alter_table
Com_analyze
Com_backup_table
Com_begin
Com_change_db
Com_change_master
Com_check
Com_checksum
Com_commit
Com_create_db
Com_create_function
Com_create_index
Com_create_table
Com_create_user
Com_dealloc_sql
Com_delete
Com_delete_multi
Com_do
Com_drop_db
Com_drop_function
Com_drop_index
Com_drop_table
Com_drop_user
Com_execute_sql
Com_flush
Com_grant
Com_ha_close
Com_ha_open
Com_help
Com_insert
Com_insert_select
Com_kill
Com_load
Com_load_master_data
Com_load_master_table
Com_lock_tables
Com_optimize
Com_preload_keys
Com_prepare_sql
Com_purge
Com_purge_before_date
Com_rename_table
Com_repair
Com_replace
Com_replace_select
Com_reset
Com_restore_table
Com_revoke
Com_revoke_all
Com_rollback
Com_savepoint
Com_select
Com_set_option
Com_show_binlog_events
Com_show_binlogs
Com_show_charsets
Com_show_collations
Com_show_column_types
Com_show_create_db
Com_show_create_table
Com_show_databases
Com_show_errors
Com_show_fields
Com_show_grants
Com_show_innodb_status
Com_show_keys
Com_show_logs
Com_show_master_status
Com_show_ndb_status
Com_show_new_master
Com_show_open_tables
Com_show_privileges
Com_show_processlist
Com_show_slave_hosts
Com_show_slave_status
Com_show_status
Com_show_storage_engines
Com_show_tables
Com_show_triggers
Com_show_variables
Com_show_warnings
Com_slave_start
Com_slave_stop
Com_stmt_close
Com_stmt_execute
Com_stmt_fetch
Com_stmt_prepare
Com_stmt_reset
Com_stmt_send_long_data
Com_truncate
Com_unlock_tables
Com_update
Com_update_multi
Com_xa_commit
Com_xa_end
Com_xa_prepare
Com_xa_recover
Com_xa_rollback
Com_xa_start
Compression
Connections
Created_tmp_disk_tables
Created_tmp_files
Created_tmp_tables
Delayed_errors
Delayed_insert_threads
Delayed_writes
Flush_commands
Handler_commit
Handler_delete
Handler_discover
Handler_prepare
Handler_read_first
Handler_read_key
Handler_read_next
Handler_read_prev
Handler_read_rnd
Handler_read_rnd_next
Handler_rollback
Handler_savepoint
Handler_savepoint_rollback
Handler_update
Handler_write
Innodb_buffer_pool_pages_data
Innodb_buffer_pool_pages_dirty
Innodb_buffer_pool_pages_flushed
Innodb_buffer_pool_pages_free
Innodb_buffer_pool_pages_misc
Innodb_buffer_pool_pages_total
Innodb_buffer_pool_read_ahead_rnd
Innodb_buffer_pool_read_ahead_seq
Innodb_buffer_pool_read_requests
Innodb_buffer_pool_reads
Innodb_buffer_pool_wait_free
Innodb_buffer_pool_write_requests
Innodb_data_fsyncs
Innodb_data_pending_fsyncs
Innodb_data_pending_reads
Innodb_data_pending_writes
Innodb_data_read
Innodb_data_reads
Innodb_data_writes
Innodb_data_written
Innodb_dblwr_pages_written
Innodb_dblwr_writes
Innodb_log_waits
Innodb_log_write_requests
Innodb_log_writes
Innodb_os_log_fsyncs
Innodb_os_log_pending_fsyncs
Innodb_os_log_pending_writes
Innodb_os_log_written
Innodb_page_size
Innodb_pages_created
Innodb_pages_read
Innodb_pages_written
Innodb_row_lock_current_waits
Innodb_row_lock_time
Innodb_row_lock_time_avg
Innodb_row_lock_time_max
Innodb_row_lock_waits
Innodb_rows_deleted
Innodb_rows_inserted
Innodb_rows_read
Innodb_rows_updated
Key_blocks_not_flushed
Key_blocks_unused
Key_blocks_used
Key_read_requests
Key_reads
Key_write_requests
Key_writes
Last_query_cost
Max_used_connections
Ndb_cluster_node_id
Ndb_config_from_host
Ndb_config_from_port
Ndb_number_of_data_nodes
Not_flushed_delayed_rows
Open_files
Open_streams
Open_tables
Opened_tables
Prepared_stmt_count
Qcache_free_blocks
Qcache_free_memory
Qcache_hits
Qcache_inserts
Qcache_lowmem_prunes
Qcache_not_cached
Qcache_queries_in_cache
Qcache_total_blocks
Questions
Rpl_status
Select_full_join
Select_full_range_join
Select_range
Select_range_check
Select_scan
Slave_open_temp_tables
Slave_retried_transactions
Slave_running
Slow_launch_threads
Slow_queries
Sort_merge_passes
Sort_range
Sort_rows
Sort_scan
Ssl_accept_renegotiates
Ssl_accepts
Ssl_callback_cache_hits
Ssl_cipher
Ssl_cipher_list
Ssl_client_connects
Ssl_connect_renegotiates
Ssl_ctx_verify_depth
Ssl_ctx_verify_mode
Ssl_default_timeout
Ssl_finished_accepts
Ssl_finished_connects
Ssl_session_cache_hits
Ssl_session_cache_misses
Ssl_session_cache_mode
Ssl_session_cache_overflows
Ssl_session_cache_size
Ssl_session_cache_timeouts
Ssl_sessions_reused
Ssl_used_session_cache_entries
Ssl_verify_depth
Ssl_verify_mode
Ssl_version
Table_locks_immediate
Table_locks_waited
Tc_log_max_pages_used
Tc_log_page_size
Tc_log_page_waits
Threads_cached
Threads_connected
Threads_created
Threads_running
Uptime
*/

View File

@ -0,0 +1,14 @@
<?php
# MySQL Credentials:
$user = "svc-zbxmon";
$pass = "Cei1do4eiqua";
#$host = "localhost";
#echo "Loaded config\n";
#echo "\n";
#var_dump($argv);
#exit(1);

128
scripts/zapache.trap Executable file
View File

@ -0,0 +1,128 @@
#! /bin/bash
#
# Name: zapache
#
# Checks Apache activity.
#
# Author: Alejandro Michavila
# Modified for Scoreboard Values: Murat Koc, murat@profelis.com.tr
# Modified for using also as external script: Murat Koc, murat@profelis.com.tr
# Modified for outputting usage or ZBX_NOTSUPPORTED: Alejandro Michavila
#
# Version: 1.4
#
zapachever="1.4"
rval=0
items[1]=TotalAccesses
items[2]=TotalKBytes
items[3]=Uptime
items[4]=ReqPerSec
items[5]=BytesPerSec
items[6]=BytesPerReq
items[7]=BusyWorkers
items[8]=IdleWorkers
items[9]=WaitingForConnection
items[10]=StartingUp
items[11]=ReadingRequest
items[12]=SendingReply
items[13]=KeepAlive
items[14]=DNSLookup
items[15]=ClosingConnection
items[16]=Logging
items[17]=GracefullyFinishing
items[18]=IdleCleanupOfWorker
items[19]=OpenSlotWithNoCurrentProcess
function getval()
{
case $1 in
'TotalAccesses')
echo "$VAR"|grep "Total Accesses:"|awk '{print $3}'
return $?;;
'TotalKBytes')
echo "$VAR"|grep "Total kBytes:"|awk '{print $3}'
return $?;;
'Uptime')
echo "$VAR"|grep "Uptime:"|awk '{print $2}'
return $?;;
'ReqPerSec')
echo "$VAR"|grep "ReqPerSec:"|awk '{print $2}'
return $?;;
'BytesPerSec')
echo "$VAR"|grep "BytesPerSec:"|awk '{print $2}'
return $?;;
'BytesPerReq')
echo "$VAR"|grep "BytesPerReq:"|awk '{print $2}'
return $?;;
'BusyWorkers')
echo "$VAR"|grep "BusyWorkers:"|awk '{print $2}'
return $?;;
'IdleWorkers')
echo "$VAR"|grep "IdleWorkers:"|awk '{print $2}'
return $?;;
'WaitingForConnection')
echo "$VAR"|grep "Scoreboard:"| awk '{print $2}'| awk 'BEGIN { FS = "_" } ; { print NF-1 }'
return $?;;
'StartingUp')
echo "$VAR"|grep "Scoreboard:"| awk '{print $2}'| awk 'BEGIN { FS = "S" } ; { print NF-1 }'
return $?;;
'ReadingRequest')
echo "$VAR"|grep "Scoreboard:"| awk '{print $2}'| awk 'BEGIN { FS = "R" } ; { print NF-1 }'
return $?;;
'SendingReply')
echo "$VAR"|grep "Scoreboard:"| awk '{print $2}'| awk 'BEGIN { FS = "W" } ; { print NF-1 }'
return $?;;
'KeepAlive')
echo "$VAR"|grep "Scoreboard:"| awk '{print $2}'| awk 'BEGIN { FS = "K" } ; { print NF-1 }'
return $?;;
'DNSLookup')
echo "$VAR"|grep "Scoreboard:"| awk '{print $2}'| awk 'BEGIN { FS = "D" } ; { print NF-1 }'
return $?;;
'ClosingConnection')
echo "$VAR"|grep "Scoreboard:"| awk '{print $2}'| awk 'BEGIN { FS = "C" } ; { print NF-1 }'
return $?;;
'Logging')
echo "$VAR"|grep "Scoreboard:"| awk '{print $2}'| awk 'BEGIN { FS = "L" } ; { print NF-1 }'
return $?;;
'GracefullyFinishing')
echo "$VAR"|grep "Scoreboard:"| awk '{print $2}'| awk 'BEGIN { FS = "G" } ; { print NF-1 }'
return $?;;
'IdleCleanupOfWorker')
echo "$VAR"|grep "Scoreboard:"| awk '{print $2}'| awk 'BEGIN { FS = "I" } ; { print NF-1 }'
return $?;;
'OpenSlotWithNoCurrentProcess')
echo "$VAR"|grep "Scoreboard:"| awk '{print $2}'| awk 'BEGIN { FS = "." } ; { print NF-1 }'
return $?;;
esac
}
########
# Main #
########
if [[ $# == 1 ]];then
#Trap remote
VAR=$(wget --quiet -O - http://$1/server-status?auto)
else
#Trap localhost
VAR=$(wget --quiet -O - http://localhost/server-status?auto)
fi
if [[ -z $VAR ]]; then
exit 1
fi
for itm in "${items[@]}"
do
val=$(getval $itm)
if [ $? -ne 0 ]; then
echo "- apache.${itm} ZBX_NOTSUPPORTED"
else
echo "- apache.${itm} ${val}"
fi
done
#
# end zapache

1010
templates/Apache.xml Normal file

File diff suppressed because it is too large Load Diff

88
templates/Cron.xml Normal file
View File

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>2.0</version>
<date>2013-06-18T21:30:40Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
<template>
<template>Template Cron</template>
<name>Template Cron</name>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<applications>
<application>
<name>Cron</name>
</application>
</applications>
<items>
<item>
<name>Cron Processes</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>proc.num[{$CROND}]</key>
<delay>120</delay>
<history>7</history>
<trends>90</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Cron</name>
</application>
</applications>
<valuemap/>
</item>
</items>
<discovery_rules/>
<macros>
<macro>
<macro>{$CROND}</macro>
<value>cron</value>
</macro>
</macros>
<templates/>
<screens/>
</template>
</templates>
<triggers>
<trigger>
<expression>{Template Cron:proc.num[{$CROND}].avg(600)}&lt;1</expression>
<name>Cron is not running on {HOST.NAME}</name>
<url/>
<status>0</status>
<priority>4</priority>
<description/>
<type>0</type>
<dependencies/>
</trigger>
</triggers>
</zabbix_export>

498
templates/Gearman.xml Normal file
View File

@ -0,0 +1,498 @@
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>2.0</version>
<date>2013-06-18T21:30:59Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
<template>
<template>Template Gearman</template>
<name>Template Gearman</name>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<applications>
<application>
<name>Gearman</name>
</application>
<application>
<name>Gearman Queue</name>
</application>
<application>
<name>Gearman Worker</name>
</application>
<application>
<name>SupervisorD</name>
</application>
</applications>
<items>
<item>
<name>GearmanD Servers Running</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>gearman.proc.running</key>
<delay>0</delay>
<history>7</history>
<trends>90</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Gearman</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>GearmanD Servers Total</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>gearman.proc.total</key>
<delay>0</delay>
<history>7</history>
<trends>90</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Gearman</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>SupervisorD Running on {HOST.NAME}</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>proc.num[python,,,supervisord]</key>
<delay>30</delay>
<history>7</history>
<trends>90</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>SupervisorD</name>
</application>
</applications>
<valuemap/>
</item>
</items>
<discovery_rules>
<discovery_rule>
<name>Queue Discovery</name>
<type>0</type>
<snmp_community/>
<snmp_oid/>
<key>gearman.discovery</key>
<delay>60</delay>
<status>0</status>
<allowed_hosts/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<delay_flex/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<filter>{#GNAME}:</filter>
<lifetime>30</lifetime>
<description/>
<item_prototypes>
<item_prototype>
<name>Gearman Queue {#GQUEUE}:{#GNAME}</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>gearman[{#GQUEUE},{#GNAME},queue]</key>
<delay>0</delay>
<history>7</history>
<trends>90</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Gearman Queue</name>
</application>
</applications>
<valuemap/>
</item_prototype>
<item_prototype>
<name>Gearman Running {#GQUEUE}:{#GNAME}</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>gearman[{#GQUEUE},{#GNAME},running]</key>
<delay>0</delay>
<history>7</history>
<trends>90</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Gearman Queue</name>
</application>
</applications>
<valuemap/>
</item_prototype>
<item_prototype>
<name>Gearman Workers {#GQUEUE}:{#GNAME}</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>gearman[{#GQUEUE},{#GNAME},workers]</key>
<delay>0</delay>
<history>7</history>
<trends>90</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Gearman Queue</name>
</application>
</applications>
<valuemap/>
</item_prototype>
</item_prototypes>
<trigger_prototypes/>
<graph_prototypes>
<graph_prototype>
<name>Function {#GQUEUE}:{#GNAME} Graph</name>
<width>900</width>
<height>200</height>
<yaxismin>0.0000</yaxismin>
<yaxismax>100.0000</yaxismax>
<show_work_period>1</show_work_period>
<show_triggers>1</show_triggers>
<type>0</type>
<show_legend>1</show_legend>
<show_3d>0</show_3d>
<percent_left>0.0000</percent_left>
<percent_right>0.0000</percent_right>
<ymin_type_1>0</ymin_type_1>
<ymax_type_1>0</ymax_type_1>
<ymin_item_1>0</ymin_item_1>
<ymax_item_1>0</ymax_item_1>
<graph_items>
<graph_item>
<sortorder>0</sortorder>
<drawtype>0</drawtype>
<color>C80000</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template Gearman</host>
<key>gearman[{#GQUEUE},{#GNAME},queue]</key>
</item>
</graph_item>
<graph_item>
<sortorder>2</sortorder>
<drawtype>0</drawtype>
<color>0000C8</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template Gearman</host>
<key>gearman[{#GQUEUE},{#GNAME},workers]</key>
</item>
</graph_item>
<graph_item>
<sortorder>1</sortorder>
<drawtype>0</drawtype>
<color>00C800</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template Gearman</host>
<key>gearman[{#GQUEUE},{#GNAME},running]</key>
</item>
</graph_item>
</graph_items>
</graph_prototype>
</graph_prototypes>
</discovery_rule>
<discovery_rule>
<name>Worker Discovery</name>
<type>0</type>
<snmp_community/>
<snmp_oid/>
<key>workers.discovery</key>
<delay>60</delay>
<status>0</status>
<allowed_hosts/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<delay_flex/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<filter>{#WNAME}:</filter>
<lifetime>30</lifetime>
<description/>
<item_prototypes>
<item_prototype>
<name>Workers Running for {#WQUEUE} for {#WNAME}</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>worker[{#WQUEUE},{#WNAME}]</key>
<delay>0</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Gearman Worker</name>
</application>
</applications>
<valuemap/>
</item_prototype>
</item_prototypes>
<trigger_prototypes/>
<graph_prototypes>
<graph_prototype>
<name>Workers {#WQUEUE} for {#WNAME} Graph</name>
<width>900</width>
<height>200</height>
<yaxismin>0.0000</yaxismin>
<yaxismax>100.0000</yaxismax>
<show_work_period>1</show_work_period>
<show_triggers>1</show_triggers>
<type>0</type>
<show_legend>1</show_legend>
<show_3d>0</show_3d>
<percent_left>0.0000</percent_left>
<percent_right>0.0000</percent_right>
<ymin_type_1>0</ymin_type_1>
<ymax_type_1>0</ymax_type_1>
<ymin_item_1>0</ymin_item_1>
<ymax_item_1>0</ymax_item_1>
<graph_items>
<graph_item>
<sortorder>0</sortorder>
<drawtype>0</drawtype>
<color>C80000</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template Gearman</host>
<key>worker[{#WQUEUE},{#WNAME}]</key>
</item>
</graph_item>
</graph_items>
</graph_prototype>
</graph_prototypes>
</discovery_rule>
</discovery_rules>
<macros>
<macro>
<macro>{$GEARMAN_PROCS}</macro>
<value>1</value>
</macro>
<macro>
<macro>{$GEARMAN_USER}</macro>
<value>gearman</value>
</macro>
</macros>
<templates/>
<screens/>
</template>
</templates>
<triggers>
<trigger>
<expression>{Template Gearman:gearman.proc.running.avg(120)}&lt;{Template Gearman:gearman.proc.total.last(0)}</expression>
<name>GearmanD process(s) on {HOST.NAME} are down</name>
<url/>
<status>0</status>
<priority>4</priority>
<description>There are 1 or more Gearman Server processes not running on {HOST.NAME}. The result of this could cause MemberFuse instances to fail to work because they depend on connectivity to the Gearman Servers.&#13;
&#13;
Manual recovery involves logging into the expected server and insuring that all gearmand processes are running as expected.</description>
<type>0</type>
<dependencies/>
</trigger>
<trigger>
<expression>{Template Gearman:proc.num[python,,,supervisord].avg(120)}&lt;1</expression>
<name>SupervisorD not running on {HOST.NAME}</name>
<url/>
<status>0</status>
<priority>3</priority>
<description/>
<type>0</type>
<dependencies/>
</trigger>
</triggers>
</zabbix_export>

1245
templates/Memcached.xml Normal file

File diff suppressed because it is too large Load Diff

188
templates/MySQL-Master.xml Normal file
View File

@ -0,0 +1,188 @@
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>2.0</version>
<date>2013-06-18T21:31:27Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
<template>
<template>Template MySQL Master Server</template>
<name>Template MySQL Master Server</name>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<applications>
<application>
<name>MySQL Master</name>
</application>
</applications>
<items>
<item>
<name>MySQL Master: binlog file</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>mysql.Master_Status_File</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>1</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>MySQL Master</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>MySQL Master: binlog position</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>mysql.Master_Status_Position</key>
<delay>0</delay>
<history>7</history>
<trends>90</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>MySQL Master</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>MySQL Master: DBs ignored in the by the master</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>mysql.Master_Status_Binlog_Ignore_DB</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>1</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>MySQL Master</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>MySQL Master: DBs used in the binlog by the master</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>mysql.Master_Status_Binlog_Do_DB</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>1</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>MySQL Master</name>
</application>
</applications>
<valuemap/>
</item>
</items>
<discovery_rules/>
<macros/>
<templates/>
<screens/>
</template>
</templates>
</zabbix_export>

7926
templates/MySQL-Server.xml Normal file

File diff suppressed because it is too large Load Diff

708
templates/MySQL-Slave.xml Normal file
View File

@ -0,0 +1,708 @@
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>2.0</version>
<date>2013-06-18T21:29:06Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
<template>
<template>Template MySQL Slave Server</template>
<name>Template MySQL Slave Server</name>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<applications>
<application>
<name>MySQL Slave</name>
</application>
</applications>
<items>
<item>
<name>MySQL Slave: Current master host</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>mysql.Master_Host</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>1</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>MySQL Slave</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>MySQL Slave: Log Position in master log of I/O thread</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>mysql.Read_Master_Log_Pos</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>MySQL Slave</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>MySQL Slave: Master log file the I/O thread is reading</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>mysql.Master_Log_File</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>1</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>MySQL Slave</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>MySQL Slave: Name of master binary log file for the SQL thread</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>mysql.Relay_Master_Log_File</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>1</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>MySQL Slave</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>MySQL Slave: Name of relay log file for SQL thread</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>mysql.Relay_Log_File</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>1</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>MySQL Slave</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>MySQL Slave: Number of seconds behind master for replication</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>mysql.Seconds_Behind_Master</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>MySQL Slave</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>MySQL Slave: Position of SQL thread in master's log</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>mysql.Exec_Master_Log_Pos</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>MySQL Slave</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>MySQL Slave: Position of SQL thread in relay log</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>mysql.Relay_Log_Pos</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>MySQL Slave</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>MySQL Slave: SQL and I/O threads running</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>mysql.Slave_running</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>MySQL Slave</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>MySQL Slave: State field of SHOW PROCESSLIST for slave I/O thread</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>mysql.Slave_IO_State</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>1</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>MySQL Slave</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>MySQL Slave: The current master port</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>mysql.Master_Port</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>MySQL Slave</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>MySQL Slave: Threads being created faster than can be cached</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>mysql.Threads_created_outrunning_cache</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>MySQL Slave</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>MySQL Slave: Total combined size of relay logs</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>mysql.Relay_Log_Space</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units>B</units>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>MySQL Slave</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>MySQL Slave: User used to connect to the master</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>mysql.Master_User</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>1</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>MySQL Slave</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>MySQL Slave: Whether I/O thread has connected to the master</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>mysql.Slave_IO_Running</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>MySQL Slave</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>MySQL Slave: Whether the SQL thread is started</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>mysql.Slave_SQL_Running</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>MySQL Slave</name>
</application>
</applications>
<valuemap/>
</item>
</items>
<discovery_rules/>
<macros/>
<templates/>
<screens/>
</template>
</templates>
<triggers>
<trigger>
<expression>{Template MySQL Slave Server:mysql.Slave_IO_Running.last(0)}=0</expression>
<name>Replication I/O slave not running</name>
<url/>
<status>0</status>
<priority>5</priority>
<description>Replication I/O slave has stopped. Check why slave cannot contact the host.</description>
<type>0</type>
<dependencies/>
</trigger>
<trigger>
<expression>{Template MySQL Slave Server:mysql.Seconds_Behind_Master.last(0)}&gt;600</expression>
<name>Replication slave is too far behind master</name>
<url/>
<status>0</status>
<priority>4</priority>
<description>The slave is getting too far behind the master (now at {ITEM.LASTVALUE} secs). Data on the slave is losing it's real-time value.</description>
<type>0</type>
<dependencies/>
</trigger>
<trigger>
<expression>{Template MySQL Slave Server:mysql.Seconds_Behind_Master.last(0)}&gt;450</expression>
<name>Replication slave is too far behind master</name>
<url/>
<status>0</status>
<priority>2</priority>
<description>The slave is getting too far behind the master (now at {ITEM.LASTVALUE} secs). Data on the slave is losing it's real-time value.</description>
<type>0</type>
<dependencies/>
</trigger>
<trigger>
<expression>{Template MySQL Slave Server:mysql.Slave_running.last(0)}=0</expression>
<name>Replication slave not running</name>
<url/>
<status>0</status>
<priority>5</priority>
<description>Replication slave has stopped</description>
<type>0</type>
<dependencies/>
</trigger>
<trigger>
<expression>{Template MySQL Slave Server:mysql.Slave_SQL_Running.last(0)}=0</expression>
<name>Replication SQL slave not running</name>
<url/>
<status>0</status>
<priority>5</priority>
<description>Replication SQL slave has stopped. Check the binary logs to find the statement that stopped replication.</description>
<type>0</type>
<dependencies/>
</trigger>
</triggers>
</zabbix_export>

2435
templates/OS_Linux.xml Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

183
templates/Zabbix-Agent.xml Normal file
View File

@ -0,0 +1,183 @@
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>2.0</version>
<date>2013-06-18T21:47:18Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
<template>
<template>Template App Zabbix Agent</template>
<name>Template App Zabbix Agent</name>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<applications>
<application>
<name>Zabbix agent</name>
</application>
</applications>
<items>
<item>
<name>Agent ping</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>agent.ping</key>
<delay>60</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description>The agent always returns 1 for this item. It could be used in combination with nodata() for availability check.</description>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Zabbix agent</name>
</application>
</applications>
<valuemap>
<name>Zabbix agent ping status</name>
</valuemap>
</item>
<item>
<name>Host name of zabbix_agentd running</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>agent.hostname</key>
<delay>3600</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>1</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Zabbix agent</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>Version of zabbix_agent(d) running</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>agent.version</key>
<delay>3600</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>1</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Zabbix agent</name>
</application>
</applications>
<valuemap/>
</item>
</items>
<discovery_rules/>
<macros/>
<templates/>
<screens/>
</template>
</templates>
<triggers>
<trigger>
<expression>{Template App Zabbix Agent:agent.hostname.diff(0)}&gt;0</expression>
<name>Host name of zabbix_agentd was changed on {HOST.NAME}</name>
<url/>
<status>0</status>
<priority>1</priority>
<description/>
<type>0</type>
<dependencies/>
</trigger>
<trigger>
<expression>{Template App Zabbix Agent:agent.version.diff(0)}&gt;0</expression>
<name>Version of zabbix_agent(d) was changed on {HOST.NAME}</name>
<url/>
<status>0</status>
<priority>1</priority>
<description/>
<type>0</type>
<dependencies/>
</trigger>
<trigger>
<expression>{Template App Zabbix Agent:agent.ping.nodata(5m)}=1</expression>
<name>Zabbix agent on {HOST.NAME} is unreachable for 5 minutes</name>
<url/>
<status>0</status>
<priority>4</priority>
<description/>
<type>0</type>
<dependencies/>
</trigger>
</triggers>
</zabbix_export>

1758
templates/Zabbix-Server.xml Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.