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:
| #!/usr/bin/perl -w | |
| # This mojo will just check for an open port. | |
| # I use this with nagios to alert me if a firewalled webserver is open to the public internet. | |
| # I run this in a nano cloud instance off network. I use nginx to serve it, and hypnotoad to run it. | |
| # Nagios calls it like "http://foo.app.com/check?host=1.2.3.4&port=443&key=abc123" | |
| # | |
| # You can setup a nagios command like this: | |
| # define command { | |
| # command_name check_api_port_open | |
| # command_line /usr/bin/curl -s "https://foo.app.com/check?host=$HOSTADDRESS$&port=443" | /usr/bin/grep -q '"status":"open"' && echo "Port 443 is OPEN" && exit 2 || echo "Port 443 is closed" && exit 0 |
| #!/usr/bin/perl -w | |
| # This script will run and parse the command pjsip show channels and check for stale calls that are more than an hour old | |
| # and print to the console the channel number and the time the call has been up for, this is mostly a fix for Sangoma App, | |
| # which has a bug when "bridging" a call, since there is no attended transfer, the call will stay up forever if the conference | |
| # bug hits. Hopefully sangoma will fix this, but for now, to save money on long distance calls, we'll just hang up the call if it | |
| # meets criteria. This script will also email the admin if a call is found to be stale, and not ignored. The script will also | |
| # disconnect a conference call. We had a customer mostly conferencing in a CC processor, so we match on the route being specific to | |
| # the conference bridge, that way we can auto cancel it. Otherwise we'll just alert the admin. | |
| use strict; | |
| use MIME::Lite; |
| #!/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"; |
| #!/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; |
| #!/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. |
| <?php | |
| print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); | |
| print("<MyIPPhoneDirectory clearlight=\"true\">\n"); | |
| print("<Prompt>Prompt</Prompt>\n"); | |
| set_time_limit(5); # Set max execution time | |
| $output = shell_exec("/usr/sbin/asterisk -rx \"database show AMPUSER\" | grep cidname"); # grab cidname and number cleanly | |
| $outAry = explode("\n",$output); # explode to array | |
| foreach ($outAry as $line) { # loop array | |
| # /AMPUSER/1000/cidname : TX03 Receptionist |
| #!/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; |
I hereby claim:
To claim this, I am signing this object: