Skip to content

Instantly share code, notes, and snippets.

View adrianlzt's full-sized avatar

Adrián López adrianlzt

View GitHub Profile
#! /bin/sh
### BEGIN INIT INFO
# Provides: puppetmaster
# Required-Start: $network $named $remote_fs $syslog
# Required-Stop: $network $named $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
#
# Collectd check should be defined:
# Name: collectd
# Puppet type: monitorizacion::checks::collectd
# Example: {"Plugin":"processes","Process":"sshd","Threshold":[{"Instance":"sshd","Type":[{"Name":"ps_count","DataSource":"processes","FailureMin":1}]}]}
#
#{
# "Plugin": "processes",
# "Process": "sshd",
# "Threshold": [
import gearman
import base64
import time
def check_request_status(job_request):
if job_request.complete:
print "Job %s finished! Result: %s - %s" % (job_request.job.unique, job_request.state, job_request.result)
elif job_request.timed_out:
print "Job %s timed out!" % job_request.unique
elif job_request.state == JOB_UNKNOWN:
[icinga-stable-release]
name=ICINGA (stable release for epel)
baseurl=http://packages.icinga.org/epel/$releasever/release/
enabled=1
gpgcheck=1
gpgkey=http://packages.icinga.org/icinga.key
define command{
command_name check_local_users
command_line $USER1$/check_users -w $ARG1$ -c $ARG2$
}
define command{
command_name check-host-alive
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
}
define host {
address 127.0.0.1
alias Maquina tid campus XX
host_name tidcampusXX
hostgroups tidcampus
use tidcampus
}
define service {
host_name tidcampusXX
service_description users
define module{
module_name mod_gearman
module_type neb
path /usr/lib64/mod_gearman/mod_gearman.o
args config=/etc/mod_gearman/mod_gearman_neb.conf
}
- name: backup of current conf.d dir
shell: cp -pr /etc/icinga/conf.d /etc/icinga/conf.d.bak
- name: delete current conf.d dir contents
shell: rm -fr /etc/icinga/conf.d/*
- name: extract advanced configuration
unarchive: src=conf.d-dsmc.tgz dest=/etc/icinga/conf.d
notify:
- Restart icinga
#!/bin/sh
# chkconfig: 2345 85 15
# description: Mod-Gearman Worker Daemon
### BEGIN INIT INFO
# Provides: mod_gearman_worker
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Should-Start:
@adrianlzt
adrianlzt / -
Last active August 29, 2015 14:10
validar fichero de configuracion
fallar si el esquema del fichero no es ini
En el error pasar la ruta del fichero que está fallando.
si no existe el fich de por defecto, continuar sin fallar
si nos pasan un fich de conf que no existe, fallar
coger los params del fich de conf