Skip to content

Instantly share code, notes, and snippets.

View crashdump's full-sized avatar
🖖

Adrien P. crashdump

🖖
View GitHub Profile
@crashdump
crashdump / compare-ntp-time.py
Last active December 29, 2022 16:17
Compare the time of two ntp servers.
#!/usr/bin/python
import struct, sys, time, argparse
from socket import socket, AF_INET, SOCK_DGRAM
error_margin = 3
def get_time(host):
sock = socket(AF_INET, SOCK_DGRAM)
sock.settimeout(2)
@crashdump
crashdump / zbx-exim-stats.sh
Created June 3, 2013 12:25
A simple Zabbix statistics pusher. It check and report these values: - Number of running processes exim4 (trigger if 0) - Mails Queue Size (trigger if >500 and >1000) - Mails Received - Mails Error - Mails Received Size in Bytes - Mails Delivered - Mails Delivered Size in Bytes Import the template. Assign to you hosts. Cron the .sh.. You're good…
#!/bin/bash
# Set Variables
EXIMLOG=/var/log/exim4/mainlog
MYLOG=/tmp/exim_status.log
OFFSETFILE=/tmp/eximstatusoffset.dat
EXIMSTATS=/usr/sbin/eximstats
LOGTAIL=/usr/sbin/logtail
ZABBIX_SENDER=/usr/bin/zabbix_sender
ZABBIX_CONF=/etc/zabbix/zabbix_agentd.conf
@crashdump
crashdump / check-dnsrbl.py
Last active December 17, 2015 22:49
Check a hostname (or an ip) against a list of dnsrbls. * dns roundrobin aware: If the domain have multiples ips, then the check is ran for all of them. I've also provided a template if you want to use it with Zabbix as an External Check: - Configure ExternalScripts variable in zabbix_server.conf - Put the script (check-dnsrbl.py and check-dnsrbl…
#!/usr/bin/python
# -*- coding: utf-8 -*-
import time, socket, sys, argparse
from multiprocessing.pool import ThreadPool
DNSRBL_LIST='/etc/zabbix/externalscripts/check-dnsrbl.txt'
result_list = []
def reverse_host(host, separator='.'):
@crashdump
crashdump / check-ssl-expire.py
Last active January 9, 2023 09:45
Report how many days before and http ssl certificate expire. I've also provided a template if you want to use it with Zabbix as an External Check: - Configure ExternalScripts variable in zabbix_server.conf - Put the script in the external script folder (I've used /etc/zabbix/externalscripts/) - Import the template & assign it to your host. - Wat…
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Adrien Pujol - http://www.crashdump.fr/"
__copyright__ = "Copyright 2013, Adrien Pujol"
__license__ = "Mozilla Public License"
__version__ = "0.3"
__email__ = "adrien.pujol@crashdump.fr"
__status__ = "Development"
__doc__ = "Check a TLS certificate validity."
@crashdump
crashdump / zabbix-yahoo_weather.pl
Last active December 17, 2015 16:49
weather.yahooapis.com -> zabbix
#!/usr/bin/perl
use strict;
use XML::Simple;
use WWW::Curl::Easy;
my $WOEID = 12215; # Yahoo! "Where On Earth Identifier" for Bedford, UK
my $ZABBIX_SENDER = "/usr/bin/zabbix_sender";
my $ZABBIX_SERVER = "172.24.1.36";
@crashdump
crashdump / exim-listener.conf
Created November 28, 2012 10:56
Baruwa : Exim config "exim-listener.conf"
.include /usr/local/etc/exim/macros.conf
hide pgsql_servers = PGSQL_SERVERS
#primary_hostname =
domainlist local_domains = @ : localhost : localhost.localdomain
domainlist relay_sql_domains = RELAY_SQL_DOMAINS
domainlist relay_sql_smtp_domains = SMTP_SQL_DOMAINS
domainlist relay_sql_lmtp_domains = LMTP_SQL_DOMAINS
domainlist ldap_domains = LDAP_DOMAINS
domainlist smtp_callback_domains = SMTP_CALLBACK_DOMAINS
domainlist whitelisted_domains = WHITELISTED_DOMAINS
@crashdump
crashdump / logstash.conf
Created October 26, 2012 10:19
Logstash configuration
# This is a configuration for Logstash acting like that:
#
## INPUT
# - Syslog server listening on (custom >1024 as we don't run it as root) UDP/10514
# - GELF event listening on (default) UDP/12201
#
## FILTERING
# - Nothing here yet
#
## OUTPUT
@crashdump
crashdump / logstash.sh
Created October 26, 2012 09:27 — forked from optikfluffel/logstash.conf
Logstash Init script
#! /bin/sh
### BEGIN INIT INFO
# Provides: logstash-server
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.