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 python | |
import RPi.GPIO as GPIO | |
import datetime | |
import socket | |
import time | |
import os | |
metric_path = "sun.loc1" |
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
tune2fs -l /dev/sda1 | awk -F" +" '/Filesystem created/ { print $2 }' |
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
function resample() { | |
sample_interval=$1 | |
fh=$2 | |
ctr=1 | |
while read line; do | |
[[ $sample_interval -eq $ctr ]] && echo "$line" && ctr=0 | |
((ctr++)) | |
done < <(echo "$fh") | |
} |
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
/* CPU values in /proc/stat are measured in USER_HZ which is | |
generally 1/100th of a second, but you can verify with this. | |
See http://man7.org/linux/man-pages/man5/proc.5.html | |
*/ | |
#include <unistd.h> | |
#include <stdio.h> | |
int main() | |
{ | |
printf("USER_HZ is %d\n", sysconf(_SC_CLK_TCK)); |
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 | |
# function to expand the range of allowed CPUs | |
range_expand () ( | |
IFS=, | |
set -- $1 | |
n=$# | |
for element; do | |
if [[ $element =~ ^(-?[0-9]+)-(-?[0-9]+)$ ]]; then | |
set -- "$@" $(eval echo "{${BASH_REMATCH[1]}..${BASH_REMATCH[2]}}") |
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 | |
# Produce custom facts about HBA/HCA cards for facter | |
# This file should be executable in /etc/facter/facts.d/ | |
# Look for Mellanox, Emulex, and QLogic cards | |
varq=$(lspci | awk '/[Mm]ellanox/ { | |
printf "mellanox=%s\n", $1 } | |
/[Ee]mulex/ { | |
printf "emulex=%s\n", $1 } | |
/[Qq][Ll]ogic/ { |
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
function pecho { | |
if [[ $LOGGING ]]; then | |
printf "$@" | tee -a some.log | |
else | |
printf "$@" | |
fi | |
} | |
pecho "%-10s %10s\n" "Logging:" "On" |
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 python | |
import yaml | |
import json | |
import sys | |
with open(sys.argv[2], "w") as outf, open(sys.argv[1]) as inf: | |
o = yaml.safe_load(inf) | |
json.dump(o, outf) |
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/sh | |
# Source this file | |
# Your Zenoss server settings. | |
ZENOSS_URL="http://localhost:8080" | |
ZENOSS_USERNAME="admin" | |
ZENOSS_PASSWORD="zenoss" | |
# Generic call to make Zenoss JSON API calls easier on the shell. |
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
sub update_mongodb { | |
if (!Opts::option_is_set('noupdate')) { | |
my $client = MongoDB::MongoClient->new(host => $mongohost, port => $mongoport); | |
my $database = $client->get_database( $mongodatabase ); | |
my $db = $database->get_collection( $mongocollection ); | |
my $mongohash = \%hosthash; | |
my $mongoresult = $db->update({ "hostname" => $hosthash{'hostname'} }, $mongohash, { "upsert" => 1} ); | |
print $mongoresult; | |
} | |
} |
OlderNewer