This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
check_type, _ , message = file_output.partition(':') | |
status_regex = re.search(r"(OK|WARNING|CRITICAL|UNKNOWN)", check_type) | |
try: | |
status = status_regex.groups()[0] | |
# Nagios check | |
if len(message) == 0: | |
check_type, _ , message = file_output.partition('-') | |
except: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ping -c 1 google.com &> /dev/null && echo "OK - Ping to google.com successful" || echo "CRITICAL - Cant ping google.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_ignored(self, fragment): | |
ignore_list = ['indicator', 'unity', 'gnome', 'zeitgeist', 'notify', 'hud', 'colord', | |
'whoopsie', 'bluetooth', 'ubuntu', 'gtk', 'watchdog', 'bdi', 'jbd', | |
'kworker', 'flush', 'vbox', 'upstart', 'ksoftirqd', 'irq', 'dbus', | |
'migration', 'sh', 'ssh', 'nautilus', 'compiz', 'update', 'at-spi', | |
'telepathy', 'mission', 'network', 'cupsd', 'pulseaudio', 'gvfs', | |
'udevd', 'dnsmasq', 'init', 'zsh', 'polkit', 'bamfdaemon', | |
'modem', 'pid', 'console', 'dconf', 'gconf', 'mount', 'dhclient', 'su', 'du', 'df', 'apt', | |
'sort', 'sleep', 'goa', 'plugin', 'kthreadd', 'kswap', 'khung', 'launc', | |
'udisks', 'deja', 'cat', 'gdu', 'nm-', 'avahi', 'rtkit', 'accounts', 'acpid', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"exec" | |
"log" | |
"os" | |
) | |
// Pipeline strings together the given exec.Cmd commands in a similar fashion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from amon.apps.notifications.generator import generate_notifications | |
from amon.apps.notifications.generator import generate_message | |
from amon.apps.notifications.mail.sender import send_notification_email | |
from amon.apps.notifications.webhooks.sender import send_webhook_notification | |
from amon.apps.notifications.pushover.sender import send_pushover_notification | |
from amon.apps.notifications.victorops.sender import send_victorops_notification | |
from amon.apps.notifications.pagerduty.sender import send_pagerduty_notification | |
from amon.apps.notifications.opsgenie.sender import send_opsgenie_notification | |
from amon.apps.notifications.slack.sender import send_slack_notification |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
from amon.apps.notifications.models import notifications_model | |
from amon.apps.notifications.generator import generate_message | |
def send_victorops_notification(notification=None): | |
sent = False | |
victorops_data = notifications_model.get_for_provider(provider_id='victorops') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// these docs, in 2.6, get bucketed into the 256 bucket (size without header = 240) | |
// From Object.bsonsize(db.data.findOne()), the size is actually 198 for reference, so add 16 to that for an exact fit | |
// with that doc size, 80,000 is a nice round number under the 16MiB limit, so will use that for the inner loop | |
// We are shooting for ~16 GiB of data, without indexes, so do 1,024 iterations (512 from each client) | |
// This will mean being a little short (~500MiB) in terms of target data size, but keeps things simple | |
for(var j = 0; j < 512; j++){ // | |
bigDoc = []; | |
for(var i = 0; i < 80000; i++){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# chkconfig: 2345 95 05 | |
# description: Amon web server | |
# processname: amon | |
# pidfile: /var/run/amon.pid | |
### BEGIN INIT INFO | |
# Provides: amon | |
# Required-Start: $all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Base container | |
RUN apt-get install gcc build-essential git python-dev ... | |
docker build --force-rm=true --rm=true --no-cache -t=yourapp/base . | |
# yourwebapp:latest | |
FROM yourwebapp:base | |
ADD yoursource .... | |
docker build --force-rm=true --rm=true --no-cache -t=yourapp:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
auto_accept: True | |
log_level: debug | |
max_open_files: 100000 | |
keep_jobs: 1 | |
file_roots: | |
base: | |
- /salt/amon |