Commit 7125b37e authored by Alex Tayts's avatar Alex Tayts

initial commit

parents
Packages
--------
Provides a way to install packages via a module, such that multiple other
modules can use and avoid resource conflicts
Things included here should be relatively straightforward; the need for a class
file greater than 15 lines or so may be best served in its own module...
# $Id: mutt-cache.rc 15779 2009-05-26 21:03:00Z tskirvin $
# Uses a cache file in the user's home directory for headers and bodies
set header_cache="~/.mutt-cache/headers"
set message_cachedir="~/.mutt-cache/bodies"
# $Id: stanford-imap.rc 15779 2009-05-26 21:03:00Z tskirvin $
# Default mutt configuration for Stanford systems
set hostname="stanford.edu"
set spoolfile=imaps://$USER.pobox.stanford.edu/INBOX
set folder=imaps://$USER.pobox.stanford.edu
dictionaries-common dictionaries-common/default-ispell select american (American English)
dictionaries-common dictionaries-common/default-wordlist select american (American English)
# CRAN version of R packages
deb http://cran.cnr.berkeley.edu/bin/linux/ubuntu natty/
deb http://cran.stat.ucla.edu/bin/linux/ubuntu natty/
# CRAN version of R packages
deb http://cran.cnr.berkeley.edu/bin/linux/ubuntu oneiric/
deb http://cran.stat.ucla.edu/bin/linux/ubuntu oneiric/
# CRAN version of R packages
deb http://cran.cnr.berkeley.edu/bin/linux/ubuntu precise/
deb http://cran.stat.ucla.edu/bin/linux/ubuntu precise/
# CRAN version of R packages
deb http://cran.rstudio.com/bin/linux/ubuntu trusty/
# The following are the old defaults, but the one above
# is supposed to be a global access to all mirrors.
# deb http://cran.cnr.berkeley.edu/bin/linux/ubuntu trusty/
# deb http://cran.stat.ucla.edu/bin/linux/ubuntu trusty/
This diff is collapsed.
#!/bin/sh
#
# Rekey system keytabs.
#
# wallet-rekey-periodic will only do something if there are DES keys in a
# keytab or if the day of the year matches a thirty-day periodic cycle defined
# by this system's hostname.
/usr/sbin/wallet-rekey-periodic
# /etc/nagios-plugins/ipmi_sel.conf -*- config -*-
#
# Configuration file for the check_ipmi_sel Nagios plugin.
# The configuration file supports lines with three syntaxes:
#
# ignore = REGEX
#
# where REGEX is taken to be a regular expression and all lines matching
# that regular expression are ignored (not treated as errors).
#
# alertclear = /alertREGEX/clearREGEX/
#
# where 'clearREGEX' corresponds to the clear for alert 'alertREGEX' in the 5th "|" delimited trimmed field
# of the ipmitool sel list line.
#
# statusclear = /statusREGEX/clearREGEX/
#
# where 'clearREGEX' corresponds to the clear for status 'statusREGEX' in the 6th "|" delimited trimmed field
# of the ipmitool sel list line.
#
# The delimiter "/" can be any character not appearing in the REGEXs.
#
# Currently, this file is maintained in stanford-server since it's not
# expected to frequently change. If that expectation is wrong, it will be
# moved into Puppet and maintained there.
ignore = Log area reset
ignore = General Chassis intrusion
ignore = OS graceful shutdown
ignore = System Firmware Progress
ignore = SEL has no entries
ignore = OEM record dd
ignore = C: boot completed
ignore = Lower Non-critical going low
statusclear = /Asserted/Deasserted/
alertclear = /Redundancy Lost/Fully Redundant/
alertclear = /State Asserted/State Deasserted/
alertclear = /Predictive Failure Asserted/Predictive Failure Deasserted/
alertclear = /Performance Lags/Performance Met/
puppet ALL /usr/sbin/puppet-backend /etc/remctl/acl/systems-root
#!/usr/bin/perl
#
# check_hardware_health -- Nagios plugin to perform hardware checks
#
# Written by Jason Bishop <jason.bishop@stanford.edu>
# Copyright 2012, 2013
# The Board of Trustees of the Leland Stanford Junior University
#
# This program is free software; you may redistribute it and/or modify it
# under the same terms as Perl itself.
use 5.006;
use strict;
use warnings;
# Path to the binary used to get internal storage status on Dell systems
our $OMREPORT = '/opt/dell/srvadmin/bin/omreport';
# Path to the binary used to get internal storage status on HP systems
our $HPACUCLI = '/opt/ss-scripting-toolkit/utilities/hpacucli/hpacucli';
# Report a configuration or runtime error and exit. We do this via stdout in
# order to satisfy the Nagios plugin output requirements, but also report a
# more conventional error via stderr in case people are calling this outside
# of Nagios.
sub error {
print 'HARDWARE UNKNOWN - ', join ('', @_), "\n";
warn "$0: ", join ('', @_), "\n";
exit 3;
}
# Exit if we don't have the required tool installed.
if (! -x $OMREPORT && ! -x $HPACUCLI) {
print "HARDWARE UNKNOWN - neither omreport or hpacucli utility installed\n";
exit 3;
}
my $status = 0;
my $perfdata = '';
my $output = '';
if (-x $OMREPORT) {
# Gather the data from omreport.
my $vdiskid;
open (OMREPORT, '-|', $OMREPORT, 'storage', 'vdisk')
or error ("cannot run $OMREPORT");
while (<OMREPORT>) {
chomp;
if (/ID\s+:\s+(\d+)$/) {
$vdiskid = $1;
$perfdata .= "; " if $perfdata;
$perfdata .= "VD$vdiskid = ";
}
if (/State\s+:(.*)/) {
my $state = $1;
$perfdata .= "$state ";
if ($state =~ /Degraded/) {
$output .= " $vdiskid (DEGRADED)";
$status = 2;
} elsif ($state !~ /Ready/) {
$output .= " $vdiskid ($state)";
$status = 3 unless $status;
}
if (/Layout\s+:\s+(.*)/) {
$perfdata .= "$1 ";
}
if (/^Size\s+:\s+(.*)\(/) {
$perfdata .= "$1 ";
}
if (/^Device\sName\s+:\s+(.*)/) {
$perfdata .= "$1 ";
}
if (/Status\s+:\s+(.*)/) {
$perfdata .= "$1 ";
}
}
}
close OMREPORT;
# ug, no way to get physical disk status except to trudge through
# all of the controllers
if (-x $OMREPORT) {
#Gather the data from omreport.
my @controllers = ();
open (OMREPORT, '-|', $OMREPORT, 'storage', 'controller')
or error ("cannot run $OMREPORT");
while (<OMREPORT>) {
chomp;
if (/ID\s+:\s+(\d+)$/) {
push @controllers, $1;
}
}
close OMREPORT;
my $pdiskid = '';
foreach my $controller (@controllers) {
open (OMREPORT, '-|', $OMREPORT, 'storage', 'pdisk', "controller=$controller")
or error ("cannot run $OMREPORT");
while (<OMREPORT>) {
chomp;
if (/ID\s+:\s+(.*)$/) {
$pdiskid = $1;
}
if (/Failure\sPredicted\s+:\s+(.*)/) {
if ($1 eq "Yes") {
$output .= " $pdiskid (PHYSICAL DISK FAILURE PREDICTED)";
$status = 2;
$perfdata .= "(Failure Predicted) ";
}
}
if (/^Status\s+:\s+(.*)/) {
$perfdata .= "; " if $perfdata;
$perfdata .= "PD$pdiskid = $1 ";
}
}
close OMREPORT;
}
}
}
if (-x $HPACUCLI) {
# Gather the data from hpacucli
my @controllers = ();
open (HPACUCLI, '-|', $HPACUCLI, 'controller', 'all', 'show')
or error ("cannot run $HPACUCLI");
while (<HPACUCLI>) {
chomp;
if (/^.*?\sin\sSlot\s(\d+)\s+/) {
push @controllers, $1;
}
}
close HPACUCLI;
foreach my $controller (@controllers) {
my $currentcontroller = 'not set';
my $currentlogicaldrive = 'not set';
open (HPACUCLI, '-|', $HPACUCLI, 'controller', "slot=$controller", 'logicaldrive', 'all', 'show')
or error ("cannot run $HPACUCLI");
while (<HPACUCLI>) {
chomp;
if (/^.*?\sin\sSlot\s(\d+)\s+/) {
$currentcontroller=$1
}
if (/^\s+array\s+(\w+)\s+/) {
$currentlogicaldrive=$1
}
if (/^\s+logicaldrive\s+(\d+)\s+\((.*),(.*),\s+(.*)\)/) {
$perfdata .= "; " if $perfdata;
$perfdata .= "logicaldrive $1 $2 $3 $4";
if ($4 ne "OK") {
$status = 2;
$output .= " LD$1 (DEGRADED)";
}
}
}
close HPACUCLI;
}
}
# Output the results in Nagios format.
if ($status == 0) {
print "HARDWARE OK | $perfdata\n";
} elsif ($status == 3) {
print "HARDWARE UNKNOWN -$output | $perfdata\n";
} elsif ($status == 2) {
print "HARDWARE WARNING -$output | $perfdata\n";
} else {
print "HARDWARE ERROR -$output | $perfdata\n";
}
exit $status;
__END__
=for stopwords
Nagios util
=head1 NAME
check_hardware_health - Nagios plugin to perform hardware checks
B<check_hardware_health>
=head1 DESCRIPTION
This Nagios check is intended to encapsulate various checks for local
hardware health that require additional vendor-specific software to be
installed. Currently, the only check it does is for the RAID status on
Dell systems.
=head1 EXIT STATUS
B<check_hardware_health> follows the standard Nagios exit status
requirements. This means that it will exit with status 0 if there are no
problems or with status 2 if there are hardware errors found. For other
errors, such as invalid syntax, inability to parse command output,
or requisite software not installed
B<check_hardware_health> will exit with status 3.
=head1 BUGS
The standard Nagios plugin command-line options are not supported.
=head1 CAVEATS
This script does not use the Nagios util library or any of the defaults
that it provides, which makes it somewhat deficient as a Nagios plugin.
=head1 AUTHOR
Jason Bishop <jason.bishop@stanford.edu>
=cut
#!/usr/bin/perl
#
# check_ipmi_sel -- Nagios plugin to check ipmitool sel list for errors.
#
# Written by Darren Patterson <darrenp1@stanford.edu>
# Modified by Michael Goll <mgoll@stanford.edu>
# Copyright 2011, 2013
# The Board of Trustees of the Leland Stanford Junior University
use strict;
use warnings;
our $CONFIG = '/etc/nagios-plugins/ipmi_sel.conf';
# Report a configuration error and exit. We do this via stdout in order to
# satisfy the Nagios plugin output requirements, but also report a more
# conventional error via stderr in case people are calling this outside of
# Nagios.
sub error {
print "IPMI UNKNOWN - ", join ('', @_), "\n";
warn "$0: ", join ('', @_), "\n";
exit 3;
}
open (FILE, $CONFIG) || error ("Could not open config file: $!");
my @contents = grep { ! /^(#|\s+$)/ } <FILE>; # parse out comments in conf
close (FILE);
my @ignore;
my @results;
my (@statusmatch, @statusclear);
my (@alertmatch, @alertclear);
# parse options
foreach (@contents) {
if (/^ignore\s*=\s*(.*?)\s*$/) {
push (@ignore, $1);
} elsif ( /^statusclear\s*=\s*(.)([^\1]*)\1([^\1]*)\1$/ ) {
push (@statusmatch, $2);
push (@statusclear, $3);
} elsif ( /^alertclear\s*=\s*(.)([^\1]*)\1([^\1]*)\1$/ ) {
push (@alertmatch, $2);
push (@alertclear, $3);
}
}
chomp @ignore;
# exit nicely if running in vmware.
# TODO: take param for detecting VM from config?
if ( -x '/usr/sbin/dmidecode' && `/usr/sbin/dmidecode 2>&1` =~ /vmware/i) {
print "IPMI OK - VM detected so not running ipmitool.\n";
exit 0;
}
# Run ipmitool.
unless (-x '/usr/bin/ipmitool') {
error ('/usr/bin/ipmitool not found');
}
my $regex = join ('|', map { "(?:$_)" } @ignore);
my @raw_results = grep { ! /$regex/ } `/usr/bin/ipmitool sel list 2>&1`;
RAW_RESULT: for (my $i=0; $i < @raw_results; $i++) {
$raw_results[$i] =~ /^[^|]*\|[^|]*\|[^|]*\|\s*([^|]*?)\s*\|\s*([^|]*?)\s*(?:\|\s*([^|]*?)\s*)?$/;
my $what = '';
my $alert = '';
my $status = '';
my $alertclearer = '';
my $statusclearer = '';
$what = $1 if ($1);
$alert = $2 if ($2);
$status = $3 if ($3);
# skip both alert and status clears
foreach (@alertclear) {
if ( $alert =~ /$_/ ) { next RAW_RESULT }
}
foreach (@statusclear) {
if ( $status =~ /$_/ ) { next RAW_RESULT }
}
# lookup the expected alert to clear this alert
for ( my $i=0; $i<@alertmatch; $i++ ) {
if ( $alert =~ /$alertmatch[$i]/ ) {
$alertclearer = $alertclear[$i];
last;
}
}
# lookup the expected status to clear this alert
for ( my $i=0; $i<@statusmatch; $i++ ) {
if ( $status =~ /$statusmatch[$i]/ ) {
$statusclearer = $statusclear[$i];
last;
}
}
my @remaining = @raw_results[$i..@raw_results-1];
# check if there was a subsequent matching clear
if ( not &check_for_clear($what, $alert, $alertclearer, $statusclearer, \@remaining) ) {
unshift (@results,$raw_results[$i]); # nope
}
}
chomp $results[0] if ($results[0]);
$results[0] =~ s%\|%//%g if (@results >= 1);
if (@results == 0) {
print "IPMI OK\n";
} elsif (@results == 1) {
print "IPMI CRITICAL - $results[0]\n";
exit 2;
} else {
my $more = scalar (@results) - 1;
print "IPMI CRITICAL - $results[0] (and $more more)\n";
exit 2;
}
sub check_for_clear() {
my $parm_what = shift;
my $parm_alert = shift;
my $alertclearer = shift;
my $statusclearer = shift;
my ($array) =@_;
foreach (@$array) {
/^[^|]*\|[^|]*\|[^|]*\|\s*([^|]*?)\s*\|\s*([^|]*?)\s*(?:\|\s*([^|]*?)\s*)?$/;
my $what = '';
my $alert = '';
my $status = '';
$what = $1 if ($1);
$alert = $2 if ($2);
$status = $3 if ($3);
if ( $parm_what eq $what && (
( $parm_alert eq $alert && $statusclearer ne '' && $status =~ /$statusclearer/ ) ||
( $alertclearer ne '' && $alert =~ /$alertclearer/ )
)) {
return 1
}
}
# if we fall through there was no clear
return 0
}
__END__
=for stopwords
IPMI Nagios ipmitool remctl sel util Goll REGEXs alertREGEX alertclear
clearREGEX statusREGEX syntaxes 4th 5th
=head1 NAME
check_ipmi_sel - Nagios plugin to check ipmitool sel list for errors
=head1 SYNOPSIS
B<check_ipmi_sel>
=head1 DESCRIPTION
This Nagios plugin calls C<ipmitool sel list> and filters the results
using strings/regexes from the config file at
F</etc/nagios-plugins/ipmi_sel.conf>. It will attempt to match alerts
with the corresponding clears and drop them by using the alertclear and
status clear options. It's meant to be called via remctl from Nagios as
part of routine system monitoring.
The configuration file supports lines with three syntaxes:
ignore = REGEX
where REGEX is taken to be a regular expression and all lines matching
that regular expression are ignored (not treated as errors).
alertclear = /alertREGEX/clearREGEX/
alertclear = /Redundancy Lost/Fully Redundant/
where 'clearREGEX' corresponds to the clear for alert 'alertREGEX' in the
4th "|" delimited trimmed field of the ipmitool sel list line.
statusclear = /statusREGEX/clearREGEX/
statusclear = /Asserted/Deasserted/
where 'clearREGEX' corresponds to the clear for status 'statusREGEX' in
the 5th "|" delimited trimmed field of the ipmitool sel list line.
The delimiter "/" can be any character not appearing in the REGEXs.
=head1 EXIT STATUS
B<check_ipmi_sel> follows the standard Nagios exit status requirements.
This means that it will exit with status 0 if there are no problems or
with status 2 if there are errors in IPMI. For other errors, such as
invalid syntax, B<check_ipmi_sel> will exit with status 3.
=head1 BUGS
The standard Nagios plugin command-line options are not supported.
=head1 CAVEATS
This script does not use the Nagios util library or any of the defaults
that it provides, which makes it somewhat deficient as a Nagios plugin.
=head1 AUTHORS
Darren Patterson <darrenp1@stanford.edu>
Michael Goll <mgoll@stanford.edu>
=head1 SEE ALSO
ipmitool(1)
=cut
#!/bin/sh
#
# monitor-base -- remctl backend for standard Nagios probes.
#
# Copyright 2005, 2008, 2010, 2011, 2012, 2013
# The Board of Trustees of the Leland Stanford Junior University
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
PATH=/usr/lib/nagios/plugins:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export PATH
# The 'disk-rw' check needs a default location and a file name. Note that
# this file sticks around between runs.
TEST_DISK=/var/tmp
TEST_FILE=testfile-rw
cmd="$1"
shift
case $cmd in
disk)
setuidgid nobody check_disk "$@" -x /usr/vice/cache -x /main3
;;
disk-rw)
if [ "x${1}" != "x" ]; then
TEST_DISK=$1
fi
if [ ! -d $TEST_DISK ]; then
echo "monitor-base: $cmd - no such directory '$1'"
exit 2
fi
TEST_FILE="${TEST_DISK}/${TEST_FILE}"
echo "checking ${TEST_DISK}"
exec touch ${TEST_FILE}
;;
hardware-health)
check_hardware_health "$@"
;;
ipmi)
check_ipmi_sel "$@"
;;
load)
setuidgid nobody check_load "$@"
;;
localcert)
setuidgid nobody check_ssl_local "$@"
;;
log)
check_log "$@"
;;
file-age)
check_file_age "$@"
;;
mysql)
setuidgid nobody check_mysql "$@"
;;
filesystemstate)
check_filesystem_state
;;
nic)
interface="$1"
if [ -z "$interface" ] ; then