Skip to content

Instantly share code, notes, and snippets.

View nowthatsamatt's full-sized avatar

Matthew Cupples nowthatsamatt

  • American Fork, UT
  • 21:02 (UTC -06:00)
View GitHub Profile
@nowthatsamatt
nowthatsamatt / Nagios 4 Install on 12.04
Created December 27, 2013 18:18
This'll install Nagios 4 on Ubuntu 12.04.
apt-get update && apt-get upgrade -y
apt-get install -y libgd2-xpm-dev apache2 php5 libnet-snmp-perl libperl5.14 libpq5 libradius1 libsensors4 libsnmp-base libsnmp15 libtalloc2 libtdb1 libwbclient0 samba-common samba-common-bin smbclient snmp whois libmysqlclient15-dev libssl-dev daemon
cd /usr/local/src
wget https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.2.tar.gz
wget http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.14/nrpe-2.14.tar.gz
tar -xzvf https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz
tar -xzvf http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.2.tar.gz
tar -xzvf http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.14/nrpe-2.14.tar.gz
@nowthatsamatt
nowthatsamatt / gist:8150610
Created December 27, 2013 18:12
Nagios 4 init script for 12.04 systems
#!/bin/sh
# Nagios Startup script for the Nagios monitoring daemon
#
# chkconfig: - 85 15
# description: Nagios is a service monitoring system
# processname: nagios
# config: /etc/nagios/nagios.cfg
# pidfile: /var/nagios/nagios.pid
#
define host{
use server
address x.x.x.x
host_name domain.com
hostgroups hostgroupname
contact_groups contactgroup_name
}
## Note, this file is written by cloud-init on first boot of an instance
## modifications made here will not survive a re-bundle.
## if you wish to make changes you can:
## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg
## or do the same in user-data
## b.) add sources in /etc/apt/sources.list.d
## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl
#
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
violence:mustache nowthatsamatt$ knife cookbook upload node
Uploading node           [0.0.6]
FATAL: Cookbook file providers/nodejs.rb has a ruby syntax error:
FATAL: /Users/nowthatsamatt/Documents/apps/mustache/chef/cookbooks/node/providers/nodejs.rb:4: syntax error, unexpected ':', expecting keyword_then or ';' or '\n'
FATAL: /Users/nowthatsamatt/Documents/apps/mustache/chef/cookbooks/node/providers/nodejs.rb:31: syntax error, unexpected keyword_end, expecting $end
if ($host ~ "www.domain.com/d/s/(.*?)") {
rewrite ^ https://old.domain.com/d/s/$1 permanent;
}
#!/bin/bash
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/ruby/bin"
import_script_news=`ps -ef|grep -c [i]mport_script_news.rb`
if [ $import_script_news -lt 1 ]; then
echo "CRITICAL: import_script_news.rb is NOT running."
cd /srv/news/current && RAILS_ENV=production nohup bundle exec rails runner extras/import_script_news.rb >> /srv/service_logs/import_script_news.log &
exit 2
fi
Jan 27 16:20:41 ip-10-114-90-58 postfix/pickup[3185]: 1E093400B4: uid=0 from=<root>
Jan 27 16:20:41 ip-10-114-90-58 postfix/cleanup[3298]: 1E093400B4: message-id=<20120127162041.1E093400B4@ip-10-114-90-58.ec2.internal>
Jan 27 16:20:41 ip-10-114-90-58 postfix/qmgr[3186]: 1E093400B4: from=<root@ip-10-114-90-58.ec2.internal>, size=600, nrcpt=4 (queue active)
Jan 27 16:20:41 ip-10-114-90-58 postfix/smtp[3301]: 1E093400B4: to=<jeremiah@cloudspace.com>, relay=aspmx.l.google.com[74.125.93.27]:25, delay=0.82, delays=0.06/0.01/0.1/0.66, dsn=2.0.0, status=sent (250 2.0.0 OK 1327681241 dl6si7082128qab.19)
Jan 27 16:20:41 ip-10-114-90-58 postfix/smtp[3301]: 1E093400B4: to=<mcupples@cloudspace.com>, relay=aspmx.l.google.com[74.125.93.27]:25, delay=0.82, delays=0.06/0.01/0.1/0.66, dsn=2.0.0, status=sent (250 2.0.0 OK 1327681241 dl6si7082128qab.19)
Jan 27 16:21:11 ip-10-114-90-58 postfix/smtp[3302]: connect to uffmail01.uff.us[164.51.140.67]:25: Connection timed out
Jan 27 16:21:41 ip-10-114-90-58 postfix/smtp[3302]: connec
rails_env = ENV['RAILS_ENV'] || 'production'
#worker_processes (rails_env == 'production' ? 2 : 2)
worker_processes 4
# Load app into memory for super fast worker spawns
preload_app true
# Restart any workers that haven't responded in 30 seconds
timeout 30
root@host:~# mysqldump -q database > database.sql
mysqldump: Error 1194: Table 'Saacblogscanarticles' is marked as crashed and should be repaired when dumping table `Saacblogscanarticles` at row: 47
root@host:~# mysql database -e"repair table Saacblogscanarticles"
+------------------------------------+--------+----------+-----------------------------------------------------------------+
| Table | Op | Msg_type | Msg_text |
+------------------------------------+--------+----------+-----------------------------------------------------------------+
| database.Saacblogscanarticles | repair | info | Wrong bytesec: 51- 47- 57 at 364138120; Skipped |
| database.Saacblogscanarticles | repair | info | Wrong bytesec: 116-112- 58 at 363135916; Skipped |
| database.Saacblogscanarticles | repair | info | Key 1 - Found wrong stored record at 363003100 |
| databas