[Python-modules-commits] [python-zenoss] 01/06: Import python-zenoss_0.6.3.orig.tar.gz

Sandro Tosi morph at moszumanska.debian.org
Wed Dec 14 00:25:15 UTC 2016


This is an automated email from the git hooks/post-receive script.

morph pushed a commit to branch master
in repository python-zenoss.

commit bdf53c947293539399a304bda0c887d26537c646
Author: Sandro Tosi <morph at debian.org>
Date:   Tue Dec 13 19:19:10 2016 -0500

    Import python-zenoss_0.6.3.orig.tar.gz
---
 PKG-INFO                    |  2 +-
 setup.py                    |  5 +++--
 zenoss.egg-info/PKG-INFO    |  2 +-
 zenoss.egg-info/SOURCES.txt |  1 -
 zenoss.egg-info/pbr.json    |  1 -
 zenoss.py                   | 46 ++++++++++++++++++++++++++++++++++++---------
 6 files changed, 42 insertions(+), 15 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index 289862f..09423a0 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: zenoss
-Version: 0.6.2
+Version: 0.6.3
 Summary: Module to work with the Zenoss JSON API.
 Home-page: https://github.com/iamseth/python-zenoss
 Author: Seth Miller
diff --git a/setup.py b/setup.py
index 85c5c84..5b1e39b 100644
--- a/setup.py
+++ b/setup.py
@@ -4,12 +4,13 @@ from setuptools import setup
 
 setup(name='zenoss',
 
-version='0.6.2',
+version='0.6.3',
     description='Module to work with the Zenoss JSON API.',
     author="Seth Miller",
     author_email='seth at sethmiller.me',
     url='https://github.com/iamseth/python-zenoss',
     py_modules=['zenoss',],
     keywords = ['zenoss', 'api', 'json', 'rest'],
-    test_suite='tests'
+    test_suite='tests',
+    data_files = [('', ['LICENSE.txt']),('', ['README.md']),('examples', ['list_devices.py']),]
 )
diff --git a/zenoss.egg-info/PKG-INFO b/zenoss.egg-info/PKG-INFO
index 289862f..09423a0 100644
--- a/zenoss.egg-info/PKG-INFO
+++ b/zenoss.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: zenoss
-Version: 0.6.2
+Version: 0.6.3
 Summary: Module to work with the Zenoss JSON API.
 Home-page: https://github.com/iamseth/python-zenoss
 Author: Seth Miller
diff --git a/zenoss.egg-info/SOURCES.txt b/zenoss.egg-info/SOURCES.txt
index eafa211..9b20b45 100644
--- a/zenoss.egg-info/SOURCES.txt
+++ b/zenoss.egg-info/SOURCES.txt
@@ -4,5 +4,4 @@ zenoss.py
 zenoss.egg-info/PKG-INFO
 zenoss.egg-info/SOURCES.txt
 zenoss.egg-info/dependency_links.txt
-zenoss.egg-info/pbr.json
 zenoss.egg-info/top_level.txt
\ No newline at end of file
diff --git a/zenoss.egg-info/pbr.json b/zenoss.egg-info/pbr.json
deleted file mode 100644
index b548629..0000000
--- a/zenoss.egg-info/pbr.json
+++ /dev/null
@@ -1 +0,0 @@
-{"is_release": false, "git_version": "e478c34"}
\ No newline at end of file
diff --git a/zenoss.py b/zenoss.py
index 6e35129..822c8a8 100755
--- a/zenoss.py
+++ b/zenoss.py
@@ -89,6 +89,21 @@ class Zenoss(object):
         return self.__router_request('DeviceRouter', 'getDevices',
                                      data=[{'uid': device_class, 'params': {}, 'limit': limit}])
 
+    def get_components(self, device_name, **kwargs):
+        '''Get components for a device given the name
+        '''
+        uid = self.device_uid(device_name)
+        return self.get_components_by_uid(uid=uid, **kwargs)
+
+    def get_components_by_uid(self, uid=None, meta_type=None, keys=None,
+                              start=0, limit=50, page=0,
+                              sort='name', dir='ASC', name=None):
+        '''Get components for a device given the uid
+        '''
+        data = dict(uid=uid, meta_type=meta_type, keys=keys, start=start,
+                    limit=limit, page=page, sort=sort, dir=dir, name=name)
+        return self.__router_request('DeviceRouter', 'getComponents', [data])
+
     def find_device(self, device_name):
         '''Find a device by name.
 
@@ -218,20 +233,31 @@ class Zenoss(object):
         data = dict(uids=[device['uid']], hashcheck=device['hash'], ip=ip_address)
         return self.__router_request('DeviceRouter', 'resetIp', [data])
 
-    def get_events(self, device=None, limit=100, component=None, event_class=None):
+    def get_events(self, device=None, limit=100, component=None,
+                   severity=None, event_class=None, start=0,
+                   event_state=None, sort='severity', direction='DESC'):
         '''Find current events.
+             Returns a list of dicts containing event details. By default
+             they are sorted in descending order of severity.  By default,
+             severity {5, 4, 3, 2} and state {0, 1} are the only events that
+             will appear.
 
         '''
-        data = dict(start=0, limit=limit, dir='DESC', sort='severity')
-        data['params'] = dict(severity=[5, 4, 3, 2], eventState=[0, 1])
-        if device:
+        if severity is None:
+            severity = [5, 4, 3, 2]
+        if event_state is None:
+            event_state = [0, 1]
+        data = dict(start=start, limit=limit, dir=direction, sort=sort)
+        data['params'] = dict(severity=severity, eventState=event_state)
+        if device is not None:
             data['params']['device'] = device
-        if component:
+        if component is not None:
             data['params']['component'] = component
-        if event_class:
+        if event_class is not None:
             data['params']['eventClass'] = event_class
         log.info('Getting events for %s', data)
-        return self.__router_request('EventsRouter', 'query', [data])['events']
+        return self.__router_request(
+            'EventsRouter', 'query', [data])['events']
 
     def get_event_detail(self, event_id):
         '''Find specific event details
@@ -266,14 +292,16 @@ class Zenoss(object):
         '''
         return self.change_event_state(event_id, 'close')
 
-    def create_event_on_device(self, device_name, severity, summary):
+    def create_event_on_device(self, device_name, severity, summary,
+                               component='', evclasskey='', evclass=''):
         '''Manually create a new event for the device specified.
 
         '''
         log.info('Creating new event for %s with severity %s', device_name, severity)
         if severity not in ('Critical', 'Error', 'Warning', 'Info', 'Debug', 'Clear'):
             raise Exception('Severity %s is not valid.' % severity)
-        data = dict(device=device_name, summary=summary, severity=severity, component='', evclasskey='', evclass='')
+        data = dict(device=device_name, summary=summary, severity=severity,
+                    component=component, evclasskey=evclasskey, evclass=evclass)
         return self.__router_request('EventsRouter', 'add_event', [data])
 
     def get_load_average(self, device):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-zenoss.git



More information about the Python-modules-commits mailing list