Skip to content

Instantly share code, notes, and snippets.

View jcurry's full-sized avatar

Jane Curry jcurry

  • Skills 1st Ltd
  • Taplow, UK
View GitHub Profile
@jcurry
jcurry / setSnmpCommunity.py
Created April 16, 2019 09:48
Change zSnmpCommunity for multiple devices
#!/usr/bin/env python
#
# Author: Jane Curry
# Date October 30th 2012
# Description: Sets local zSnmpCommunity property to NewSnmpCom
# Updates:
#
import sys
from optparse import OptionParser
import Globals
#!/usr/bin/env zendmd
#
# Change ZenPack name
#dmd.ZenPackManager.packs._delObject('ZenPacks.zenoss.ZenPackName')
# commit()
packs = None
if hasattr(dmd, 'ZenPackManager'):
packs = dmd.ZenPackManager.packs
else:
packs = dmd.packs
@jcurry
jcurry / unmanage_dev_component.py
Created January 6, 2017 17:28
Python script to unmanage a component - see top of script for usage and example
#!/usr/bin/env python
#
# Author: Jane Curry
# Date June 9th 2014
# Description: Unmanages a specific component of a specific device
# $1 = device, $2 = component, $3 = component_type, $4 = on/off
# eg. ./unmanage_dev_component.py zen42.class.example.org / filesystems on
# Updates:
#
import sys
@jcurry
jcurry / ReportMail_4.2.5_SUP671.py
Created November 30, 2016 18:19
ReportMail.py from /opt/zenoss/Products/ZenReports on Zenoss 4.2.5 SUP 671
##############################################################################
#
# Copyright (C) Zenoss, Inc. 2007, all rights reserved.
#
# This content is made available according to terms specified in
# License.zenoss under the directory where your Zenoss product is installed.
#
##############################################################################
@jcurry
jcurry / get_devices_with_process.py
Created October 29, 2016 12:11
Supply process class name and get all devices running that process
#!/usr/bin/env python
# Author: Jane Curry
# Date: October 28th, 2016
# Description: Takes a process name as a parameter and delivers
# all devices running that process
# Note that strictly the process parameter is a "Process Class name"
# - check your Process definitions from INFRASTRUCTURE -> Processes
# Also may take output file parameter - default is /tmp/get_devices_with_process.out
# Requires parameter:
# -p <process>
@jcurry
jcurry / poll_processes_4.py
Created October 28, 2016 14:39
Uses SNMP to search for processes, returning processes plus cpu and memory used
#!/usr/bin/env python
# Author: Jane Curry
# Date: May 1st 2013
# Description: Uses twisted SNMP to get process data from Host Resources MIB
# searching for supplied string (currently in attributes).
# Delivers process count, total mem used and total cpu used
# Requires parameters:
# -H <IP addr> -V <snmp ver> -c <community> -p <string in Path> -a <string in attrs> -v (for verbose}
# eg. -H 10.0.0.125 -V v2c -c public -p "/var/run/vmnet-netifup"
# Updated: April 14th, 2014
@jcurry
jcurry / snmpGetHrStorageAllocationUnits.sh
Last active September 20, 2016 16:04
Use snmpGet to get size of storage allocation unit for storageSystem. Pass device parameters for snmp and filesystem snmpindex to get correct OID instance.
#!/bin/sh
# Driven by
# /z/scripts/snmpGetHrStorageAllocationUnits.sh ${device/manageIp} ${device/zSnmpCommunity} ${device/zSnmpVer} ${here/snmpindex}
set -x
# Nagios return codes
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
##############################################################################
#
# Copyright (C) Zenoss, Inc. 2016, all rights reserved.
#
# This content is made available according to terms specified in
# License.zenoss under the directory where your Zenoss product is installed.
#
##############################################################################
#!/opt/zenoss/bin/python
###########################################################################
#
# This program is part of Zenoss Core, an open source monitoring platform.
# Copyright (C) 2007, 2009 Zenoss Inc.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
# For complete information please visit: http://www.zenoss.com/oss/
@jcurry
jcurry / get_events1.py
Created December 22, 2015 22:47
JSON API code to get Zenoss events
#!/usr/bin/env python
# Zenoss-4.x JSON API Example (python)
#
# To quickly explore, execute 'python -i get_events.py
#
# >>> z = getEventsWithJSON()
# >>> events = z.get_events()
# etc.