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
#!/bin/ash | |
# Alternative script for use with busybox (OpenWRT etc..), which uses wget rather than curl | |
SLACK_WEBHOOK="https://hooks.slack.com/services/..." | |
SLACK_CHANNEL="#alerts" | |
SLACK_USERNAME="monit on $MONIT_HOST" | |
if [[ "$MONIT_DESCRIPTION" =~ .*"succeeded".* ]]; then | |
SLACK_ICON=":white_check_mark:" |
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
#!/bin/bash | |
# range-expander.sh, expands a range of ports/numbers e.g. VLANs, or Port/Interface numbers to a long list. | |
# intention is to plug into Ansible roles, but likely more to-do./ | |
# Note, this will only sequence or expand the last numbers so "1/1/1-1/2/24" will work, but | |
# other combintations will only yield the start and ending left most parts e.g. "1/1/1-1/3/24" will not give | |
# any of "1/2/x". | |
# Please split that to "1/1/1-1/1/24,1/2/1-1/3/24" etc.. | |
# Example usage | |
# ./range-expander.sh "1,2,3,1-1,9-17,1002" |
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
#!/bin/bash | |
SLACK_WEBHOOK="https://hooks.slack.com/services/..." | |
SLACK_CHANNEL="#alerts" | |
SLACK_USERNAME="monit on $MONIT_HOST" | |
if [[ "$MONIT_DESCRIPTION" =~ .*"succeeded".* ]]; then | |
SLACK_ICON=":white_check_mark:" | |
SLACK_USERNAME="monit on $MONIT_HOST - service up" | |
elif [[ "$MONIT_DESCRIPTION" =~ .*"failed".* ]]; then | |
SLACK_ICON=":exclamation:" |
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
#!/bin/bash | |
# AWS secrets from the IAM account. | |
export AWS_ACCESS_KEY_ID="" | |
export AWS_SECRET_ACCESS_KEY="" | |
# Passphrase for duplicity backups (GPG encrypted) | |
export PASSPHRASE="" | |
duplicity restore boto3+s3://example-s3-bucket/$j /data/testrestore/$1 --tempdir=/data/tmp |
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
#!/bin/bash | |
# AWS secrets from the IAM account. | |
export AWS_ACCESS_KEY_ID="" | |
export AWS_SECRET_ACCESS_KEY="" | |
# Passphrase for duplicity backups (GPG encrypted) | |
export PASSPHRASE="" | |
# Backup folders | |
backupfolders="" |
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
#!/bin/bash | |
outfile=smart.csv | |
outgraph=smart.png | |
rm $outfile | |
array=('hosts=(root@host1 user@host2 userb@host3)' 'sudo=(root sudo sudo)' 'devices=(sdb,sdd sda,sdb,sdc sda,sdb)') | |
for j in "${array[@]}"; do eval $j; done | |
tmpfile=$(mktemp) | |
let i=0 | |
for h in ${hosts[@]} | |
do |
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
version: "3.6" | |
networks: | |
splunknet: | |
driver: bridge | |
attachable: true | |
services: | |
splunk: | |
networks: |
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
options { | |
time-reap(30); | |
mark-freq(10); | |
keep-hostname(yes); | |
}; | |
source s_network { | |
syslog(transport(udp) port(514)); | |
}; | |
destination d_logs { | |
file( |
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
#!/bin/bash | |
# check epson printer ink levels on an XP-235. | |
typeset -l PRINTERNAME | |
PRTINFO=`mktemp` | |
wget -q -O $PRTINFO http://IP/PRESENTATION/HTML/TOP/PRTINFO.HTML | |
VALUES=`cat $PRTINFO | grep Ink | awk -F\' '{ print $6 }' | xargs | sed -e 's/ /, /g'` | |
PRINTERNAME=`cat $PRTINFO | grep "Printer Name" | awk -F\> '{ print $7}' | sed -e 's$</td$ | |
SLACKWEBHOOK="https://hooks.slack.com/services/blah" | |
echo $PRINTERNAME | |
COLOURS=(Black Yellow Magenta Cyan) |
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
#!/bin/bash | |
# | |
# ldapsearch based on FreeRADIUS configuration | |
# Known issue(s) - Checks only the first LDAP server, doesn't read the configuration file properly, i.e. it's just greping for what might work... | |
if [ -z "$1" ]; then | |
FILE=/etc/freeradius/mods-enabled/ldap | |
else | |
FILE=$1 | |
fi |
NewerOlder