Skip to content

Instantly share code, notes, and snippets.

Russell Endicott rendicott

Block or report user

Report or block rendicott

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
rendicott /
Created Jan 6, 2017
nagios plugin to check filesystem usage based on df output
#!/usr/bin/env python
This script checks the output of the local
'df -P' command and reports the disk usage
for the given mount with perfdata.
OK /dev/mapper/centos-root filesystem mounted on / usage percentage is 17 ; | 'used_percentage'=17;90;95;; 'size'=14530560KB;;;; 'used'=2360596KB;;;; 'available'=12169964KB;;;;
rendicott /
Last active Jan 4, 2017
quick dirty bash script to see if there's a running process of the given name with Nagios style return codes
# Thanks to androidyue on stackoverflow
ps_out=`ps -ef | grep $1 | grep -v 'grep' | grep -v $0`
result=$(echo $ps_out | grep "$1")
if [[ "$result" != "" ]];then
echo "$1 Running"
exit 0
echo "$1 Not Running"
exit 2
rendicott /
Created Jan 3, 2017
bash one-liner to search for ps aux pid by name and get memory usage
pid=$(ps aux | grep [s]nmpd | awk -F' ' '{print $2}') && pmap -x $pid | grep total
rendicott / crontab-entry
Last active Nov 23, 2018
quick backup script to tar and gzip the jenkins home directory and upload it to Artifactory for backup
View crontab-entry
5 18 * * * /root/ >/var/log/jenkinsbackup/jenkinsbackup.`date +\%Y\%m\%d\%H\%M\%S`.log 2>&1
rendicott /
Created Jan 5, 2016
Shell script to refactor Graphite whisper files with updated retention data
cd /var/lib/graphite/whisper/teamcity
for f in $(find $1 -iname "*.wsp")
if [ -a $f ]
# the retention policy should match what's in your /etc/carbon/storage-schemas.conf
/root/source/graphite-project/bin/ $f 1m:7d 5m:28d 15m:1y
chown -R _graphite:_graphite /var/lib/graphite/whisper
rendicott / octoDeployRest.ps1
Created Dec 30, 2015
Uses Powershell to interact with the Octopus REST API to create a deployment to a specific machine / release / environment combination.
View octoDeployRest.ps1
Import-Module Octopus-Cmdlets
#$machineName = 'DOGEN09'
rendicott /
Created Sep 29, 2015
Quick example of how to pull a report from Salesforce in CSV format via the API using Python-Requests. Then take the CSV data and parse it into an object model for sifting sorting and timedelta.
GATSFA - Gateway to Salesforce API
The CSV report this is pulling down is querying the Salesforce event log.
Each line in the CSV is a Salesforce event log entry that has the prefix
of the name of our API application. So the report is a log of the
activity between the gateway API and the Salesforce API
You can’t perform that action at this time.