add all the collectd basics.
This commit is contained in:
parent
9cacbc4594
commit
55b54a537b
16 changed files with 224 additions and 0 deletions
5
files/collectd/README
Normal file
5
files/collectd/README
Normal file
|
@ -0,0 +1,5 @@
|
|||
collectd takes conf files in /etc/collect.d/somefile.conf
|
||||
|
||||
and if you add a type you will need to add it to a types.db for that file
|
||||
|
||||
see any of the examples
|
6
files/collectd/apache.conf
Normal file
6
files/collectd/apache.conf
Normal file
|
@ -0,0 +1,6 @@
|
|||
LoadPlugin apache
|
||||
|
||||
<Plugin apache>
|
||||
URL "http://localhost/apache-status?auto"
|
||||
</Plugin>
|
||||
|
21
files/collectd/bind.conf
Normal file
21
files/collectd/bind.conf
Normal file
|
@ -0,0 +1,21 @@
|
|||
LoadPlugin bind
|
||||
|
||||
<Plugin bind>
|
||||
URL "http://localhost:8053/"
|
||||
OpCodes true
|
||||
QTypes true
|
||||
|
||||
ServerStats true
|
||||
ZoneMaintStats true
|
||||
ResolverStats false
|
||||
MemoryStats true
|
||||
|
||||
<View "DEFAULT">
|
||||
QTypes true
|
||||
ResolverStats true
|
||||
CacheRRSets true
|
||||
|
||||
Zone "127.in-addr.arpa/IN"
|
||||
</View>
|
||||
</Plugin>
|
||||
|
25
files/collectd/collectd_haproxy.sh
Normal file
25
files/collectd/collectd_haproxy.sh
Normal file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
sock='/var/run/haproxy-stat'
|
||||
host="$(hostname -s)"
|
||||
pause=10
|
||||
|
||||
while getopts "h:p:s:" c; do
|
||||
case $c in
|
||||
h) host=$OPTARG;;
|
||||
p) pause=$OPTARG;;
|
||||
s) sock=$OPTARG;;
|
||||
*) echo "Usage: $0 [-h <hostname>] [-p <seconds>] [-s <sockfile>]";;
|
||||
esac
|
||||
done
|
||||
|
||||
while [ $? -eq 0 ]; do
|
||||
time="$(date +%s)"
|
||||
echo 'show stat' | socat - UNIX-CLIENT:$sock \
|
||||
|while IFS=',' read pxname svname qcur qmax scur smax slim stot bin bout dreq dresp ereq econ eresp wretr wredis status weight act bck chkfail chdown lastchg downtime qlimit pid iid sid throttle lbtot tracked type; do
|
||||
[ "$svname" != 'BACKEND' ] && continue
|
||||
echo "PUTVAL $host/haproxy/haproxy_backend-$pxname $time:$stot:$econ:$eresp"
|
||||
done
|
||||
sleep $pause
|
||||
done
|
||||
|
26
files/collectd/collectd_mailq.sh
Executable file
26
files/collectd/collectd_mailq.sh
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
host=$(hostname -s)
|
||||
pause=10
|
||||
|
||||
while getopts "h:p:s:" opt; do
|
||||
case "$opt" in
|
||||
h)
|
||||
host=$OPTARG
|
||||
;;
|
||||
p)
|
||||
pause=$OPTARG
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 [-h <hostname>] [-p <seconds>]" >&2;
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
while [ $? -eq 0 ]; do
|
||||
ts=$(date +%s)
|
||||
queue_size=$(mailq | awk 'END { print (/Mail queue is empty/ ? 0 : $5) }')
|
||||
echo "PUTVAL \"$host/mail_queue/email_count\" $ts:$queue_size";
|
||||
sleep $pause
|
||||
done
|
46
files/collectd/collected.conf.j2
Normal file
46
files/collectd/collected.conf.j2
Normal file
|
@ -0,0 +1,46 @@
|
|||
#
|
||||
# Config file for collectd(1).
|
||||
# Please read collectd.conf(5) for a list of options.
|
||||
# http://collectd.org/
|
||||
#
|
||||
|
||||
Hostname "{{ inventory_hostname }}"
|
||||
FQDNLookup true
|
||||
#BaseDir "/usr/var/lib/collectd"
|
||||
#PIDFile "/usr/var/run/collectd.pid"
|
||||
#PluginDir "/usr/lib/collectd"
|
||||
#TypesDB "/usr/lib/collectd/types.db"
|
||||
#Interval 10
|
||||
#ReadThreads 5
|
||||
|
||||
LoadPlugin syslog
|
||||
|
||||
<Plugin syslog>
|
||||
LogLevel err
|
||||
</Plugin>
|
||||
|
||||
LoadPlugin cpu
|
||||
LoadPlugin df
|
||||
LoadPlugin disk
|
||||
LoadPlugin exec
|
||||
LoadPlugin interface
|
||||
LoadPlugin load
|
||||
LoadPlugin memory
|
||||
LoadPlugin processes
|
||||
LoadPlugin swap
|
||||
LoadPlugin tail
|
||||
LoadPlugin users
|
||||
LoadPlugin vmem
|
||||
|
||||
<Plugin disk>
|
||||
Disk "/^[hs]d[a-f]?$/"
|
||||
Disk "/^xvd[a-f]?$/"
|
||||
Disk "/dev/xvdb1"
|
||||
IgnoreSelected false
|
||||
</Plugin>
|
||||
|
||||
<Plugin hddtemp>
|
||||
TranslateDevicename false
|
||||
</Plugin>
|
||||
|
||||
Include "/etc/collectd.d"
|
2
files/collectd/fedmsg-types.db
Normal file
2
files/collectd/fedmsg-types.db
Normal file
|
@ -0,0 +1,2 @@
|
|||
fedmsg_wallboard count:GAUGE:0:U
|
||||
|
6
files/collectd/fedmsg.conf
Normal file
6
files/collectd/fedmsg.conf
Normal file
|
@ -0,0 +1,6 @@
|
|||
LoadPlugin exec
|
||||
TypesDB "/usr/share/collectd/fedmsg-types.db"
|
||||
|
||||
<Plugin exec>
|
||||
Exec "fedmsg" "/usr/bin/fedmsg-collectd" "--collectd-interval" "10"
|
||||
</Plugin>
|
2
files/collectd/haproxy-types.db
Normal file
2
files/collectd/haproxy-types.db
Normal file
|
@ -0,0 +1,2 @@
|
|||
haproxy_backend stot:COUNTER:0:U econ:COUNTER:0:U eresp:COUNTER:0:U
|
||||
|
3
files/collectd/haproxy.conf
Normal file
3
files/collectd/haproxy.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
<Plugin exec>
|
||||
Exec "haproxy" "/usr/local/bin/collectd_haproxy.sh" "-h" "haproxy" "-s" "/var/run/haproxy-stat" "-p" "10"
|
||||
</Plugin>
|
3
files/collectd/mailq.conf
Normal file
3
files/collectd/mailq.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
<Plugin exec>
|
||||
Exec "nobody" "/usr/local/bin/collectd_mailq.sh"
|
||||
</Plugin>
|
5
files/collectd/network-client.conf
Normal file
5
files/collectd/network-client.conf
Normal file
|
@ -0,0 +1,5 @@
|
|||
LoadPlugin network
|
||||
|
||||
<Plugin "network">
|
||||
Server "log02"
|
||||
</Plugin>
|
1
files/collectd/nfs.conf
Normal file
1
files/collectd/nfs.conf
Normal file
|
@ -0,0 +1 @@
|
|||
LoadPlugin nfs
|
2
files/collectd/pgconns-types.db
Normal file
2
files/collectd/pgconns-types.db
Normal file
|
@ -0,0 +1,2 @@
|
|||
pg_conns value:GAUGE:0:U
|
||||
|
8
files/collectd/rrdtool.conf
Normal file
8
files/collectd/rrdtool.conf
Normal file
|
@ -0,0 +1,8 @@
|
|||
LoadPlugin rrdtool
|
||||
|
||||
<Plugin rrdtool>
|
||||
CacheTimeout 160
|
||||
CacheFlush 1200
|
||||
WritesPerSecond 50
|
||||
</Plugin>
|
||||
|
63
tasks/collectd/client.yml
Normal file
63
tasks/collectd/client.yml
Normal file
|
@ -0,0 +1,63 @@
|
|||
---
|
||||
# collectd client setup
|
||||
|
||||
# install pkg
|
||||
- name: install collectd
|
||||
yum: name=collectd state=installed
|
||||
|
||||
# enable collectd
|
||||
- name: enable collectd svc
|
||||
service: state=running enabled=true name=collectd
|
||||
|
||||
# install collected.conf
|
||||
- name: /etc/collectd.conf
|
||||
template: src=$files/collectd/collectd.conf dest=/etc/collectd.conf state=present
|
||||
notify:
|
||||
- restart collectd
|
||||
|
||||
# install collectd-network config
|
||||
- name: /etc/collectd.d/nework.conf
|
||||
copy: src=$files/collectd/network-client.conf dest=/etc/collectd/network.conf state=present
|
||||
notify:
|
||||
- restart collectd
|
||||
|
||||
# apache - localhost only - pretty much any apache server
|
||||
- name: install collectd-apache
|
||||
yum: state=installed name=collectd-apache
|
||||
notify:
|
||||
- restart collectd
|
||||
when_set: $collectd_apache
|
||||
|
||||
- name: /etc/collectd/apache.conf
|
||||
copy: src=$files/collectd/apache.conf dest=/etc/collectd/apache.conf state=present
|
||||
notify:
|
||||
- restart collectd
|
||||
when_set: $collectd_apache
|
||||
|
||||
|
||||
# each of the below should move to a separate task list
|
||||
# since they are odd-balls and one-offs
|
||||
|
||||
# bind - localhost only - ns servers only
|
||||
|
||||
# fedmsg - busgateway## only
|
||||
# add /usr/share/collectd/fedmsg-types.db
|
||||
|
||||
# memcached - memcached only
|
||||
|
||||
# postgres - this is a conn check
|
||||
## add /usr/share/collectd/pgconn-types.db
|
||||
|
||||
# openvpn - for bastion/openvpn gateways only
|
||||
|
||||
# mysql
|
||||
## collectd-mysql
|
||||
|
||||
# haproxy
|
||||
## add /usr/share/collectd/haproxy-types.db
|
||||
## add socat pkg
|
||||
##
|
||||
|
||||
# webproxy
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue