Skip to content

Instantly share code, notes, and snippets.

View hafthanhf's full-sized avatar

hafthanhf hafthanhf

  • hanoi,vietnam
View GitHub Profile
@hafthanhf
hafthanhf / get_bgp_ls_Juniper
Created April 26, 2015 08:26
display BGP session status on Juniper router
#!/usr/bin/expect
set user digicom_noc
set pass "digicom@)!#"
set hostname [lindex $argv 0]
#set config
set timeout 120
spawn ssh $user@$hostname
# -------------- do not edit below -------------- #
#get data from remote devices
expect "password:"
@hafthanhf
hafthanhf / check_bgp
Last active August 29, 2015 14:19
check all bgp session on router (tested with Cisco and Juniper)
#!/bin/bash
OK=0
CRITICAL=2
STATE=0
PLUGIN_PATH="/usr/local/nagios/libexec/plugins"
outputfile=/var/log/bgp.log
OID_sysDescr=SNMPv2-MIB::sysDescr.0
OID_hostname=SNMPv2-MIB::sysName.0
COMMUNITY=*****************
DBname=************
@hafthanhf
hafthanhf / get_bw_value
Created April 26, 2015 07:01
display bandwidth information on a network port
#!/usr/bin/expect
#!/bin/bash
## TomDV
## http://blog.penumbra.be/2010/02/expect-scripts-backup-cisco-config/
# ---------------- configuration ---------------- #
#set ciscoHCM 10.255.0.222
#set ciscoIPLC 10.255.0.251
#set huaweiTKC 10.255.0.233
#set ciscoHCM2 10.223.0.250
@hafthanhf
hafthanhf / check_bandwidth
Last active August 29, 2015 14:19
check_bandwidth
#!/bin/bash
#Ussage: Check input bandwidth on each switch port
########## ./check_bw $IP_of_switch $port_No_with_slash $max_threshold $min_threshold#####
########## Version 2.0 ########################################
################################################################
########### Created by Thanh.ha ##############################
######## ###########################
###############################################################
###############################################################
print_usage() {
@hafthanhf
hafthanhf / check_lacp
Created March 3, 2015 15:06
check a lacp link state, if one of the link is down, the script will generate alarm.
#!/bin/bash
OK=0
CRITICAL=2
STATE=0
PLUGIN_PATH="/usr/local/nagios/libexec/plugins"
outputfile=/var/log/bgp.log
OID_sysDescr=SNMPv2-MIB::sysDescr.0
OID_lag=1.2.840.10006.300.43.1.1.1
COMMUNITY=bimat
VERSION="1.0"
@hafthanhf
hafthanhf / check_port
Last active August 29, 2015 14:15
check_port_switch
#!/bin/bash
OK=0
CRITICAL=2
STATE=0
PLUGIN_PATH="/usr/local/nagios/libexec/"
OID_sysDescr=SNMPv2-MIB::sysDescr.0
OID_hostname=SNMPv2-MIB::sysName.0
COMMUNITY=bimat
VERSION="1.1"
author="hafthanhf"