Skip to content

Instantly share code, notes, and snippets.

@viviandarkbloom
viviandarkbloom / Polycom reboot
Created September 10, 2011 04:51
Reboot polycom phones
A bash "one-liner" that requires serious explaining:
A Polycom phone will automatically reboot if you change anything in its webui (but you have to change something). This bash/awk/curl loop changes the length of time between sntp resyncs (basically a super-trivial setting) from 86400 seconds (1 day) to 86401. If you run this twice, you would need to change 86401 back to 86400. This is a super-dirty hack. Also note that this sets the sntp server to pool.ntp.org, and the time zone to Pacific (-28800). Although those settings will get overridden if you're setting those in your DHCP scope (which you should), please adjust as necessary. To clarify, $i is an IP address. In this example, I get a list of phone IPs from asterisk and grep the ones I need to reboot, but you can iterate over any list of IPs.
----------
for i in $(asterisk -rx 'sip show peers' | grep 192.168.10 | awk '{print $2}'); do curl -s --user Polycom:456 -H application/x-www-form-urlencoded --referer http://$i/timeConf.htm -d "tcpIpApp.sntp.ad
@viviandarkbloom
viviandarkbloom / awsserverinfo.rb
Created February 21, 2012 06:01
Get data about AWS instances
require 'rubygems'
require 'yaml'
require 'right_aws'
connect = File.open('./cred.yml')
creds = YAML.load(connect)
aws_access_key_id = creds["Credentials"]["aws_access_key_id"]
aws_secret_access_key = creds["Credentials"]["aws_secret_access_key"]
#!/usr/bin/python
import sys
import json
import requests
from NagAconda import Plugin
__description__ = 'Check Elasticsearch shard info'
__url__ = 'https://gerrit.ctgrd.com/#/admin/projects/puppet-modules'
__version__ = '1.0.0'
#!/usr/bin/python
import sys
import json
import requests
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-H",
help='name of elasticsearch host' )
args = parser.parse_args()
@viviandarkbloom
viviandarkbloom / zookeeper-graphite.py
Created November 19, 2015 07:27
zookeeper mntr metrics to graphite - only sends numeric values; relies on nventory fqdns
#!/usr/bin/python
import os
import sys
import socket
import logging
import random
import re
import subprocess
import telnetlib
import time