Skip to content

Instantly share code, notes, and snippets.

View ravnx's full-sized avatar

Michael Palmer ravnx

  • Houston, TX
  • 11:27 (UTC -05:00)
View GitHub Profile
@ravnx
ravnx / today-dnd.pl
Last active January 20, 2024 17:14
Pull a DND report from FreePBX for the current day, or specified day for a user extension. Send via email.
#!/usr/bin/perl -w
# This will search the CDR logs for DND toggles for a user.
# Run it from cron if you want, its quiet. If you don't specify a date,
# it will pull today's date.
use strict;
use MIME::Lite;
use Time::Local;
my $ext = $ARGV[0] or die "Must provide extension number";
@ravnx
ravnx / check-pbx-outage.pl
Created January 14, 2024 21:36
Checks Asterisk/FreePBX for more than x phones offline, if we have an outage, switch the Call Flow Control to NIGHT. Switches back to DAY on recovery.
#!/usr/bin/perl -w
# This script will check for if more than $maxoffline phones are offline and
# change the first daynight mode via asterisk if we go over the limit, and alert the user
# Set this up in crontab to run during business hours. This probably could be done safer, and better
# using the AMI interface. But needed something done during an outage, so this got hacked together.
use strict;
use MIME::Lite;
# debug mode
my $debug = $ARGV[0] || 0;
@ravnx
ravnx / status2json.py
Last active August 20, 2022 18:46 — forked from alexwright/status2json.py
Parse the Nagios status.dat and poop out some JSON
#!/usr/bin/python3
"""
This script will dump host stats from your Nagios4 status.dat as JSON.
You can put this in your /usr/lib/cgi-bin/nagios4 directory and chmod +x this file,
then, to access it remotely use python requests:
r = requests.get('https://nagiosinstall-location.com/nagios4/cgi-bin/status2json.py', auth=HTTPDigestAuth(user,pass))
print(r.json())
You might need to add .py to your http.conf cgi handlers.
@ravnx
ravnx / yealink-phonebook.php
Created August 20, 2020 22:38
Yealink Phonebook XML, quick and dirty.
@ravnx
ravnx / polycomPhonebook.pl
Created August 20, 2020 22:32
Polycom Directory of all extensions for IP650 for Asterisk
#!/usr/bin/perl -w
# Quick script to hack out a directory for a mac address. I use it for the
# receptionist's BLF on her IP650 with sidecars.
use strict;
use Polycom::Contact::Directory;
use DBI;
# Grab the MAC address from ARGV and make a file
my $mac = $ARGV[0] or die "No MAC Specified\n";
my $contactFile = "/tftpboot/polycom/contacts/$mac-directory.xml";
#!/usr/bin/perl -w
# This perl script will do a quick and dirty parse from
# outlook vcal to evolution ical format
# Last Update:Thu Feb 05 11:49:59 CST 2004
## New note: Putting this here for archival purposes. Not even sure if outlook uses vcs anymore.
use strict;
my $file = $ARGV[0] or die "No filename specified";
die if (!-e $file);
my $newfile = $file;

Keybase proof

I hereby claim:

  • I am ravnx on github.
  • I am michaelp713 (https://keybase.io/michaelp713) on keybase.
  • I have a public key whose fingerprint is A8EB 25D7 BF9C 8EDB 4C37 E855 6EDA 5B69 4ECB F69E

To claim this, I am signing this object: