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 / __init__.py
Created September 5, 2012 08:34 — forked from cluther/__init__.py
Changing Zenoss Permissions
import logging
log = logging.getLogger('zen.ZenPack')
import Globals
from AccessControl import ClassSecurityInfo
from Products.ZenModel.Location import Location
from Products.ZenModel.ZenPack import ZenPack as ZenPackBase
from Products.ZenModel.ZenossSecurity import ZEN_COMMON, ZEN_VIEW
from Products.ZenWidgets.ZenossPortlets import ZenossPortlets
@jcurry
jcurry / zenoss_event_escalation_transform.py
Created September 5, 2012 08:39 — forked from cluther/zenoss_event_escalation_transform.py
Zenoss Event Escalation Transform
# This is an example Zenoss event transform that will escalate an event's
# severity to critical if it has occurred more than three (3) times in a row
# without clearing.
#
# It is compatible with all existing Zenoss versions which includes up to 4.1
# at the time this was written.
# Initialize existing_count.
existing_count = 0
@jcurry
jcurry / devices_to_file.py
Created September 11, 2012 14:45
Create file with all Zenoss devices listed
#!/usr/bin/env python
# Author: Jane Curry
# Date Sept 11th 2012
# Description: Output all devices to a file supplied by user
# Output gives id, title and manageIp
# Output is sorted on device id
# Parameters: File name for output
# Updates:
#
import sys
@jcurry
jcurry / deviceClasses_to_file.py
Created September 11, 2012 14:49
Create file with Zenoss device class hierarchy with devices
#!/usr/bin/env python
# Author: Jane Curry
# Date Sept 11th 2012
# Description: Output all device classes with device instances to a file supplied by user
# Output gives device class and device id
# Output is sorted on device class and then device id
# Parameters: File name for output
# Updates:
#
import sys
@jcurry
jcurry / maintWins_to_file.py
Created March 15, 2013 14:35
Script to output all Zenoss Maintenance windows
#!/usr/bin/env python
# Author: Jane Curry
# Date Sept 18th 2012
# Description: Output all Maintenance Windows to a file supplied by user
# Output gives Maintenance Windows
# Output is sorted on Maintenance Windows
# Parameters: File name for output
# Updates:
#
import sys
#!/usr/bin/env python
#
# Author: Jane Curry
# Date October 7th, 2013
# Description: Generates Zenoss event using JSON API
# Lines at top may need modifying for Zenoss server, port and https
# Requires parameters for device, severity, evclasskey and summary where summary in format
# User=jane Rig=Rig3 Host=testdb33 App=DBS stop
# Updates: October 21st 2013
# Modified user parameter to gather info directly from environment if ommited from summary string
@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.
###########################################################################
#
# 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/
##############################################################################
#
# 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
@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