Skip to content

Instantly share code, notes, and snippets.

@ericpulvino
ericpulvino / gist:d813d32a1892acb79b21ee258e214e93
Last active October 14, 2022 17:14
Update Source working in 5.3.0_prerelease
cumulus@cl-vx1:mgmt:~$ cat /etc/image-release
IMAGE_ID="Cumulus Linux"
IMAGE_RELEASE=5.3.0
IMAGE_DESCRIPTION="Cumulus Linux 5.3.0"
IMAGE_SWITCH_ARCHITECTURE=vx-amd64
IMAGE_BUILD_ID=18735a9z2060b1386
IMAGE_BUILD_SERIAL_ID=5.dev.2418
IMAGE_BUILD_DATE=2022-10-13T18:38:26+00:00
IMAGE_BUILD_USER=sw-r2d2-bot
@ericpulvino
ericpulvino / runbook for fixing netaddr
Created September 28, 2019 03:35
Method to update the out of date MAC/OUI database in the python3 netaddr library
$ sudo pip3 install netaddr
[sudo] password for eric:
The directory '/home/eric/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/eric/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting netaddr
Downloading https://files.pythonhosted.org/packages/ba/97/ce14451a9fd7bdb5a397abf99b24a1a6bb7a1a440b019bebd2e9a0dbec74/netaddr-0.7.19-py2.py3-none-any.whl (1.6MB)
100% |████████████████████████████████| 1.6MB 978kB/s
Installing collected packages: netaddr
Successfully installed netaddr-0.7.19
[23:24] eric @ p52: ~
@ericpulvino
ericpulvino / cl_support_lldp_parser.py
Created September 9, 2019 14:44
Script to create a dot file from CL-supports
#!/usr/bin/env python
import os
import sys
import glob
import shutil
import tarfile
import subprocess
cumulus@leaf03:~$ sudo su
root@leaf03:/home/cumulus# cat << EOT > /etc/apt/sources.list.d/jessie.list
> deb http://deb.debian.org/debian jessie main
> deb-src http://deb.debian.org/debian jessie main
>
> deb http://deb.debian.org/debian jessie-updates main
> deb-src http://deb.debian.org/debian jessie-updates main
> EOT
root@leaf03:/home/cumulus# apt-get udpate -y
E: Command line option 'y' [from -y] is not known.
@ericpulvino
ericpulvino / netq oom check
Created July 11, 2018 02:05
checks the netq ts for OOM condition
#!/bin/bash
used_memory=$(redis-cli info memory | grep "used_memory:" | cut -d ":" -f2 | tr -d '\r' )
max_memory=$(redis-cli info memory | grep "maxmemory:" | cut -d ":" -f2 | tr -d '\r' )
if [[ "$used_memory" -gt "$max_memory" ]]
then
echo "ALERT -- NETQ TS is consuming too much memory!!!"
else
echo "INFO: Memory level on the NetQ TS server is within acceptable limits $used_memory/$max_memory bytes in use."
@ericpulvino
ericpulvino / LLDP Interface Description Playbook
Created April 11, 2018 15:03
LLDP Interface Description Playbook
(eric@xenial3)-(09:27 PM Sun Dec 10)->
-(17 files, 344Kb)--> cat ./test.yml
- name: LLDP LABELER
hosts: all
become: yes
tasks:
- name: COLLECT LLDP INFO in JSON Format
shell: net show lldp json
register: lldp_info_json
@ericpulvino
ericpulvino / OverDriveMediaConsole.md
Last active March 22, 2018 00:22 — forked from alghanmi/OverDriveMediaConsole.md
Install OverDrive Media Console on Linux

OverDrive Media Console

OverDrive is a very common provider for eBooks and Audiobooks for the many public libraries. The ODMC is the application used to download resources.

OD now supports MP3 for all its audio-books and epub for their ebooks. This allows you to use it on Linux.

Install and Setup

Step 1. Dependencies

To use ODMC on Linux, you need to install wine and winetricks. On a debian-based system, you can do:

sudo apt-get install wine-stable winetricks -qy
@ericpulvino
ericpulvino / custom_syslog.py
Created May 10, 2017 14:27
Quick Script to Send New Parameters to Syslog
#!/usr/bin/python
import time
import json
import subprocess
import logging
import logging.handlers
# Log to CLI and Syslog or just CLI
log_to_syslog=True
@ericpulvino
ericpulvino / err_disabled.py
Last active April 17, 2017 13:50
Quick script to enable ports which have been set to err-disabled by mstpctl
#!/usr/bin/python
# Quick Script to Recover Error-Disabled Ports
# Originally written by Eric Pulvino (2017-04-17)
import time
import json
import subprocess
import logging
@ericpulvino
ericpulvino / dhcp_snooping.sh
Last active June 3, 2019 14:28
Quick Script to Emulate Basic DHCP Trusted Ports / DHCP Snooping / DHCP Filtration
#!/bin/bash
# Root Check
if [ $(whoami) != 'root' ]; then
echo "ERROR: Must be root to run $0"
exit 1;
fi
TRUSTED_PORTS=( swp1 swp3 )