You can subscribe to this list here.
2007 |
Jan
|
Feb
(65) |
Mar
(276) |
Apr
(544) |
May
(638) |
Jun
(225) |
Jul
(204) |
Aug
(294) |
Sep
(532) |
Oct
(506) |
Nov
(324) |
Dec
(359) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(208) |
Feb
(225) |
Mar
(248) |
Apr
(388) |
May
(222) |
Jun
(47) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <sv...@ze...> - 2007-04-18 17:08:05
|
Author: ecn Date: 2007-04-18 13:08:05 -0400 (Wed, 18 Apr 2007) New Revision: 4745 Modified: trunk/bin/zenoss Log: * start daemons in zenpacks Modified: trunk/bin/zenoss =================================================================== --- trunk/bin/zenoss 2007-04-18 16:51:56 UTC (rev 4744) +++ trunk/bin/zenoss 2007-04-18 17:08:05 UTC (rev 4745) @@ -45,6 +45,13 @@ C="$C zencommand" C="$C zenwin" C="$C zeneventlog" +for i in $ZENHOME/Products/*/daemons/* +do + if [ -x "$i" ] + then + C="$C `basename $i`" + fi +done CMDS=$C reverse() { |
From: <sv...@ze...> - 2007-04-18 16:51:56
|
Author: ecn Date: 2007-04-18 12:51:56 -0400 (Wed, 18 Apr 2007) New Revision: 4744 Modified: trunk/Products/DataCollector/plugins/zenoss/snmp/HRSWRunMap.py Log: * skip processes not named with a path Modified: trunk/Products/DataCollector/plugins/zenoss/snmp/HRSWRunMap.py =================================================================== --- trunk/Products/DataCollector/plugins/zenoss/snmp/HRSWRunMap.py 2007-04-18 16:24:42 UTC (rev 4743) +++ trunk/Products/DataCollector/plugins/zenoss/snmp/HRSWRunMap.py 2007-04-18 16:51:56 UTC (rev 4744) @@ -47,9 +47,8 @@ for proc in fstable.values(): om = self.objectMap(proc) if not hasattr(om, 'procName') or om.procName == "": - log.warn("Your hrSWRun table is broken, " - " zenoss can't do process monitoring") - return rm + log.warn("Skipping process with no name") + continue fullname = (om.procName + " " + om.parameters).rstrip() |
From: <sv...@ze...> - 2007-04-18 16:24:45
|
Author: ecn Date: 2007-04-18 12:24:42 -0400 (Wed, 18 Apr 2007) New Revision: 4743 Modified: trunk/Products/ZenModel/Device.py Log: * fix exception hidding exeption handling Modified: trunk/Products/ZenModel/Device.py =================================================================== --- trunk/Products/ZenModel/Device.py 2007-04-18 16:17:00 UTC (rev 4742) +++ trunk/Products/ZenModel/Device.py 2007-04-18 16:24:42 UTC (rev 4743) @@ -1148,9 +1148,10 @@ idx = dlh.rindex("</table>") response.write(str(dlh[:idx])) handler = setWebLoggingStream(response) + + from Products.DataCollector.zenmodeler import ZenModeler + sc = ZenModeler(noopts=1,app=self.getPhysicalRoot(),single=True) try: - from Products.DataCollector.zenmodeler import ZenModeler - sc = ZenModeler(noopts=1,app=self.getPhysicalRoot(),single=True) sc.options.force = True sc.generateEvents = generateEvents sc.collectSingle(self) |
From: <sv...@ze...> - 2007-04-18 16:17:04
|
Author: ecn Date: 2007-04-18 12:17:00 -0400 (Wed, 18 Apr 2007) New Revision: 4742 Modified: trunk/Products/ZenModel/ZenMenuItem.py Log: * remove pdb Modified: trunk/Products/ZenModel/ZenMenuItem.py =================================================================== --- trunk/Products/ZenModel/ZenMenuItem.py 2007-04-18 16:11:36 UTC (rev 4741) +++ trunk/Products/ZenModel/ZenMenuItem.py 2007-04-18 16:17:00 UTC (rev 4742) @@ -52,7 +52,6 @@ return parent def __cmp__(self, other): - import pdb; pdb.set_trace() if isinstance(other, ZenMenuItem): if other and other.ordering: return cmp(other.ordering, self.ordering) |
From: <sv...@ze...> - 2007-04-18 16:11:37
|
Author: ecn Date: 2007-04-18 12:11:36 -0400 (Wed, 18 Apr 2007) New Revision: 4741 Added: trunk/inst/docs/HelloWorldZenPack/objects/objects.xml Removed: trunk/inst/docs/HelloWorldZenPack/objects/Events.Hello.xml trunk/inst/docs/HelloWorldZenPack/objects/Hello_Menu.xml trunk/inst/docs/HelloWorldZenPack/objects/RRDTemplate_HelloWorld.xml trunk/inst/docs/HelloWorldZenPack/objects/Services.Hello.xml trunk/inst/docs/HelloWorldZenPack/objects/ZenEventManager.commands.helloWorld.xml Log: all the objects in one xml file Deleted: trunk/inst/docs/HelloWorldZenPack/objects/Events.Hello.xml Deleted: trunk/inst/docs/HelloWorldZenPack/objects/Hello_Menu.xml Deleted: trunk/inst/docs/HelloWorldZenPack/objects/RRDTemplate_HelloWorld.xml Deleted: trunk/inst/docs/HelloWorldZenPack/objects/Services.Hello.xml Deleted: trunk/inst/docs/HelloWorldZenPack/objects/ZenEventManager.commands.helloWorld.xml Added: trunk/inst/docs/HelloWorldZenPack/objects/objects.xml |
From: <sv...@ze...> - 2007-04-18 16:03:02
|
Author: ecn Date: 2007-04-18 12:03:02 -0400 (Wed, 18 Apr 2007) New Revision: 4740 Modified: trunk/Products/ZenRelations/ImportRM.py trunk/Products/ZenUtils/Skins.py Log: * more error handling with Zope & zenpacks Modified: trunk/Products/ZenRelations/ImportRM.py =================================================================== --- trunk/Products/ZenRelations/ImportRM.py 2007-04-18 16:02:38 UTC (rev 4739) +++ trunk/Products/ZenRelations/ImportRM.py 2007-04-18 16:03:02 UTC (rev 4740) @@ -134,7 +134,7 @@ firstElement = getattr(obj, name)[0] if type(firstElement) in types.StringTypes: proptype = 'string' - except IndexError: + except (TypeError, IndexError): proptype = 'string' if proptype == "date": try: value = float(value) Modified: trunk/Products/ZenUtils/Skins.py =================================================================== --- trunk/Products/ZenUtils/Skins.py 2007-04-18 16:02:38 UTC (rev 4739) +++ trunk/Products/ZenUtils/Skins.py 2007-04-18 16:03:02 UTC (rev 4740) @@ -49,7 +49,10 @@ skinstool = getToolByName(self, 'portal_skins') for layer in layers: if layer in skinstool.objectIds(): - skinstool._delOb(layer) + try: + skinstool._delOb(layer) + except AttributeError: + pass except ImportError, e: if "Products.CMFCore.utils" in e.args: pass else: raise |
From: <sv...@ze...> - 2007-04-18 16:02:36
|
Author: ecn Date: 2007-04-18 12:02:38 -0400 (Wed, 18 Apr 2007) New Revision: 4739 Added: trunk/Products/ZenWidgets/skins/zenui/dialog_addOneToZenPack.pt Log: * use a form to submit one-at-a-time objects Added: trunk/Products/ZenWidgets/skins/zenui/dialog_addOneToZenPack.pt |
From: <sv...@ze...> - 2007-04-18 16:02:28
|
Author: ecn Date: 2007-04-18 12:02:28 -0400 (Wed, 18 Apr 2007) New Revision: 4738 Modified: trunk/Products/ZenModel/migrate/menus.py Log: * use a form to submit one-at-a-time objects Modified: trunk/Products/ZenModel/migrate/menus.py =================================================================== --- trunk/Products/ZenModel/migrate/menus.py 2007-04-18 16:01:55 UTC (rev 4737) +++ trunk/Products/ZenModel/migrate/menus.py 2007-04-18 16:02:28 UTC (rev 4738) @@ -91,7 +91,7 @@ ordering=2.0, id= 'addToZenPack', description='Add to ZenPack...', - action= 'dialog_addToZenPack', + action= 'dialog_addOneToZenPack', permissions=('View',), isdialog=True, allowed_classes = ['ZenPackable'], @@ -529,8 +529,9 @@ permissions=('Manage DMD',), isdialog= True), ], - # doesn't work: - # 'ReportClass_list': [ZenPackItems], + 'ReportClass_list': [ + ZenPackItems + ], 'ZenPack_list':[ dict( ordering=1.0, |
From: <sv...@ze...> - 2007-04-18 16:02:21
|
Author: ecn Date: 2007-04-18 12:01:55 -0400 (Wed, 18 Apr 2007) New Revision: 4737 Modified: trunk/Products/ZenModel/ZenMenuItem.py Log: * menuItems are packable Modified: trunk/Products/ZenModel/ZenMenuItem.py =================================================================== --- trunk/Products/ZenModel/ZenMenuItem.py 2007-04-18 15:21:42 UTC (rev 4736) +++ trunk/Products/ZenModel/ZenMenuItem.py 2007-04-18 16:01:55 UTC (rev 4737) @@ -9,12 +9,13 @@ from Globals import DTMLFile from AccessControl import ClassSecurityInfo, Permissions from Products.ZenModel.ZenModelRM import ZenModelRM +from Products.ZenModel.ZenPackable import ZenPackable from Products.ZenRelations.RelSchema import * import logging log = logging.getLogger("zen.Menu") -class ZenMenuItem(ZenModelRM): +class ZenMenuItem(ZenModelRM, ZenPackable): meta_type = 'ZenMenuItem' security = ClassSecurityInfo() @@ -26,7 +27,7 @@ banned_classes = () allowed_classes = () ordering = 0.0 - + _properties = ( {'id':'description', 'type':'text', 'mode':'w'}, {'id':'action', 'type':'text', 'mode':'w'}, @@ -40,7 +41,7 @@ _relations = ( ("zenMenus", ToOne(ToManyCont, 'Products.ZenModel.ZenMenu', 'zenMenuItems')), - ) + ) + ZenPackable._relations security = ClassSecurityInfo() @@ -51,10 +52,13 @@ return parent def __cmp__(self, other): - if other and other.ordering: - return cmp(other.ordering, self.ordering) - else: - return cmp(0.0, self.ordering) + import pdb; pdb.set_trace() + if isinstance(other, ZenMenuItem): + if other and other.ordering: + return cmp(other.ordering, self.ordering) + else: + return cmp(0.0, self.ordering) + return cmp(id(self), id(other)) InitializeClass(ZenMenuItem) |
From: <sv...@ze...> - 2007-04-18 15:22:09
|
Author: ecn Date: 2007-04-18 11:21:42 -0400 (Wed, 18 Apr 2007) New Revision: 4736 Modified: trunk/Products/ZenEvents/db/zenevents.sql Log: * make the stats table more efficient in the presence of many clearids Modified: trunk/Products/ZenEvents/db/zenevents.sql =================================================================== --- trunk/Products/ZenEvents/db/zenevents.sql 2007-04-18 13:41:26 UTC (rev 4735) +++ trunk/Products/ZenEvents/db/zenevents.sql 2007-04-18 15:21:42 UTC (rev 4736) @@ -33,7 +33,8 @@ DevicePriority smallint(6) default 3, eventClassMapping varchar(128) default "", PRIMARY KEY ( dedupid ), - Index evididx (evid) + Index evididx (evid), + Index clearidx (clearid) ) ENGINE=INNODB; CREATE TABLE IF NOT EXISTS history |
From: <sv...@ze...> - 2007-04-18 13:41:25
|
Author: ecn Date: 2007-04-18 09:41:26 -0400 (Wed, 18 Apr 2007) New Revision: 4735 Modified: trunk/Products/ZenModel/Report.py Log: make Reports packable Modified: trunk/Products/ZenModel/Report.py =================================================================== --- trunk/Products/ZenModel/Report.py 2007-04-18 13:17:49 UTC (rev 4734) +++ trunk/Products/ZenModel/Report.py 2007-04-18 13:41:26 UTC (rev 4735) @@ -68,6 +68,7 @@ security = ClassSecurityInfo() + _relations = ZenPackable._relations pt_editForm = PageTemplateFile('www/reportEdit', globals(), __name__='pt_editForm') |
From: <sv...@ze...> - 2007-04-18 13:17:51
|
Author: ecn Date: 2007-04-18 09:17:49 -0400 (Wed, 18 Apr 2007) New Revision: 4734 Modified: trunk/bin/zenoss Log: list out all the commands we'll run Modified: trunk/bin/zenoss =================================================================== --- trunk/bin/zenoss 2007-04-18 13:15:57 UTC (rev 4733) +++ trunk/bin/zenoss 2007-04-18 13:17:49 UTC (rev 4734) @@ -87,7 +87,10 @@ issue ;; list) - echo $CMDS + for i in $CMDS + do + echo $i + done ;; *) echo $"Usage: $0 {start|stop|restart|status|list}" |
From: <sv...@ze...> - 2007-04-18 13:15:58
|
Author: ecn Date: 2007-04-18 09:15:57 -0400 (Wed, 18 Apr 2007) New Revision: 4733 Modified: trunk/bin/zeneventlog trunk/bin/zenoss Log: start up zenwin and zeneventlog in regular zenoss Modified: trunk/bin/zeneventlog =================================================================== --- trunk/bin/zeneventlog 2007-04-18 12:53:31 UTC (rev 4732) +++ trunk/bin/zeneventlog 2007-04-18 13:15:57 UTC (rev 4733) @@ -4,7 +4,7 @@ . $ZENHOME/bin/zenfunctions PRGHOME=$ZENHOME/Products/ZenWin -PRGNAME=zenwin.py +PRGNAME=zeneventlog.py CFGFILE=$CFGDIR/zeneventlog.conf PIDFILE=$VARDIR/$PRGNAME.pid generic "$@" Modified: trunk/bin/zenoss =================================================================== --- trunk/bin/zenoss 2007-04-18 12:53:31 UTC (rev 4732) +++ trunk/bin/zenoss 2007-04-18 13:15:57 UTC (rev 4733) @@ -43,6 +43,8 @@ C="$C zenactions" C="$C zentrap" C="$C zencommand" +C="$C zenwin" +C="$C zeneventlog" CMDS=$C reverse() { @@ -84,8 +86,11 @@ status) issue ;; + list) + echo $CMDS + ;; *) - echo $"Usage: $0 {start|stop|restart|status}" + echo $"Usage: $0 {start|stop|restart|status|list}" exit 1 esac exit $? |
From: <sv...@ze...> - 2007-04-18 12:53:30
|
Author: ecn Date: 2007-04-18 08:53:31 -0400 (Wed, 18 Apr 2007) New Revision: 4732 Modified: trunk/bin/zenwin Log: make zenwin executable Property changes on: trunk/bin/zenwin ___________________________________________________________________ Name: svn:executable + * |
From: <sv...@ze...> - 2007-04-18 12:46:10
|
Author: ecn Date: 2007-04-18 08:46:12 -0400 (Wed, 18 Apr 2007) New Revision: 4731 Modified: trunk/wmi/GNUmakefile Log: typo in GNUmakefile Modified: trunk/wmi/GNUmakefile =================================================================== --- trunk/wmi/GNUmakefile 2007-04-18 12:39:47 UTC (rev 4730) +++ trunk/wmi/GNUmakefile 2007-04-18 12:46:12 UTC (rev 4731) @@ -14,7 +14,7 @@ pywmi-installed: cd Samba/source && \ ./autogen.sh && \ - CPPFLAGS="-I$(PYINCLUDE) ./configure" && \ + CPPFLAGS="-I$(PYINCLUDE)" ./configure && \ $(MAKE) proto bin/wmic bin/wmis wmi/_pywmi.so && \ cp wmi/_pywmi.so $(PYLIBDIR) && \ cp wmi/pywmi.py $(PYLIBDIR) |
From: <sv...@ze...> - 2007-04-18 12:39:49
|
Author: ecn Date: 2007-04-18 08:39:47 -0400 (Wed, 18 Apr 2007) New Revision: 4730 Added: trunk/wmi/GNUmakefile trunk/wmi/pycom/setup.py trunk/wmi/pyinclude.py Modified: trunk/wmi/pycom/ Log: fixed #1248: add standard targets for getting wmi stuff installed in $ZENHOM Added: trunk/wmi/GNUmakefile Property changes on: trunk/wmi/pycom ___________________________________________________________________ Name: svn:ignore - *.pyc + *.pyc build Added: trunk/wmi/pycom/setup.py Added: trunk/wmi/pyinclude.py Property changes on: trunk/wmi/pyinclude.py ___________________________________________________________________ Name: svn:executable + * |
From: <sv...@ze...> - 2007-04-18 11:04:16
|
Author: ecn Date: 2007-04-18 07:04:15 -0400 (Wed, 18 Apr 2007) New Revision: 4729 Added: trunk/inst/externallibs/pynetsnmp-0.2.tar.gz Removed: trunk/inst/externallibs/pynetsnmp-0.1.tar.gz Log: fix python 2.3 issue Deleted: trunk/inst/externallibs/pynetsnmp-0.1.tar.gz Added: trunk/inst/externallibs/pynetsnmp-0.2.tar.gz Property changes on: trunk/inst/externallibs/pynetsnmp-0.2.tar.gz ___________________________________________________________________ Name: svn:mime-type + application/octet-stream |
From: <sv...@ze...> - 2007-04-18 11:03:37
|
Author: ecn Date: 2007-04-18 07:03:14 -0400 (Wed, 18 Apr 2007) New Revision: 4728 Added: tags/pynetsnmp-0.2/ Log: making release 0.2 Copied: tags/pynetsnmp-0.2 (from rev 4727, trunk/pynetsnmp) |
From: <sv...@ze...> - 2007-04-18 11:02:27
|
Author: ecn Date: 2007-04-18 07:02:22 -0400 (Wed, 18 Apr 2007) New Revision: 4727 Modified: trunk/pynetsnmp/netsnmp.py Log: rsplit not available on python 2.3 Modified: trunk/pynetsnmp/netsnmp.py =================================================================== --- trunk/pynetsnmp/netsnmp.py 2007-04-18 01:57:23 UTC (rev 4726) +++ trunk/pynetsnmp/netsnmp.py 2007-04-18 11:02:22 UTC (rev 4727) @@ -35,7 +35,7 @@ c_void_p) version = cast(lib.netsnmp_get_version(), c_char_p).value -float_version = float(version.rsplit('.', 1)[0]) +float_version = float('.'.join(version.split('.')[:-1])) if float_version < 5.2: localname = [] else: @@ -362,6 +362,17 @@ raise SnmpError("snmp_send") return req.contents.reqid + def pdu_parse(self, pdu, buffer): + cbuff = create_string_buffer(buffer, len(buffer)) + length = c_size_t(len(buffer)) + after_header = c_char_p() + if lib.snmpv3_parse(byref(pdu), + cbuff, + byref(length), + byref(after_header), + self.sess): + raise SnmpError("pdu_parse") + MAXFD = 1024 fdset = c_long * (MAXFD/32) |
From: <sv...@ze...> - 2007-04-18 01:57:44
|
Author: ecn Date: 2007-04-17 21:57:23 -0400 (Tue, 17 Apr 2007) New Revision: 4726 Modified: trunk/Products/DataCollector/zenmodeler.py trunk/Products/ZenModel/DeviceClass.py trunk/Products/ZenRRD/zencommand.py Log: * fixed #1158: remove CollectorCollect and CollectorIgnore zProperties * zencommand would re-start way too fast Modified: trunk/Products/DataCollector/zenmodeler.py =================================================================== --- trunk/Products/DataCollector/zenmodeler.py 2007-04-17 22:07:09 UTC (rev 4725) +++ trunk/Products/DataCollector/zenmodeler.py 2007-04-18 01:57:23 UTC (rev 4726) @@ -79,44 +79,33 @@ def selectPlugins(self, device, transport): """Build a list of active plugins for a device. """ - tpref = getattr(device,'zTransportPreference', 'snmp') - aqignore = getattr(device, 'zCollectorIgnorePlugins', "") - aqcollect = getattr(device, 'zCollectorCollectPlugins', "") names = getattr(device, 'zCollectorPlugins', []) - if transport == 'snmp' and device.zSnmpMonitorIgnore: return [] - plugins = {} + result = [] + collectTest = lambda x: False + ignoreTest = lambda x: False + if self.options.collectPlugins: + collectTest = re.compile(self.options.collectPlugins).search + elif self.options.ignorePlugins: + ignoreTest = re.compile(self.options.ignorePlugins).search for plugin in self.collectorPlugins.values(): - pname = plugin.name() + if plugin.transport != transport: + continue + name = plugin.name() try: - if pname in names: - self.log.debug("using %s on %s",pname, device.id) - plugins[plugin.maptype] = plugin - elif not plugin.condition(device, self.log): - self.log.debug("condition failed %s on %s",pname,device.id) - elif ((self.options.ignorePlugins - and re.search(self.options.ignorePlugins, pname)) - or (aqignore and re.search(aqignore, pname))): - self.log.debug("ignore %s on %s",pname, device.id) - elif self.options.collectPlugins: - if (re.search(self.options.collectPlugins, pname) and - (not plugins.has_key(plugin.maptype) - or plugins[plugin.maptype].transport != tpref)): - self.log.debug("--collect %s on %s", pname, device.id) - plugins[plugin.maptype] = plugin - elif aqcollect and re.search(aqcollect, pname): - if (not plugins.has_key(plugin.maptype) - or plugins[plugin.maptype].transport != tpref): - self.log.debug("zCollect %s on %s", pname, device.id) - plugins[plugin.maptype] = plugin - elif not (self.options.collectPlugins or aqcollect): - if (not plugins.has_key(plugin.maptype) - or plugins[plugin.maptype].transport != tpref): - self.log.debug("collect %s on %s", pname, device.id) - plugins[plugin.maptype] = plugin + if ignoreTest(name): + self.log.debug("ignoring %s on %s",name, device.id) + elif name in names: + self.log.debug("using %s on %s",name, device.id) + result.append(plugin) + elif collectTest(name): + self.log.debug("--collect %s on %s", name, device.id) + result.append(plugin) + else: + self.log.debug("skipping %s for %s", name, device.id) except (SystemExit, KeyboardInterrupt): raise except: - self.log.exception("failed to select plugin %s", pname) - return [ p for p in plugins.values() if p.transport == transport ] + self.log.exception("failed to select plugin %s", name) + return result def resolveDevice(self, device): Modified: trunk/Products/ZenModel/DeviceClass.py =================================================================== --- trunk/Products/ZenModel/DeviceClass.py 2007-04-17 22:07:09 UTC (rev 4725) +++ trunk/Products/ZenModel/DeviceClass.py 2007-04-18 01:57:23 UTC (rev 4726) @@ -589,11 +589,6 @@ devs._setProperty("zStatusConnectTimeout", 15.0, type="float") # DataCollector properties - devs._setProperty("zTransportPreference", "snmp") - # should be deprecated: - devs._setProperty("zCollectorIgnorePlugins", "") - devs._setProperty("zCollectorCollectPlugins", "") - # replaced by: devs._setProperty("zCollectorPlugins", [], type='lines') devs._setProperty("zCollectorClientTimeout", 180, type="int") devs._setProperty("zCollectorDecoding", 'latin-1') Modified: trunk/Products/ZenRRD/zencommand.py =================================================================== --- trunk/Products/ZenRRD/zencommand.py 2007-04-17 22:07:09 UTC (rev 4725) +++ trunk/Products/ZenRRD/zencommand.py 2007-04-18 01:57:23 UTC (rev 4726) @@ -291,7 +291,7 @@ def nextRun(self): if self.running(): - return self.lastStart + return self.lastStart + self.cycleTime return self.lastStop + self.cycleTime |
From: <sv...@ze...> - 2007-04-17 22:07:14
|
Author: chris Date: 2007-04-17 18:07:09 -0400 (Tue, 17 Apr 2007) New Revision: 4725 Modified: trunk/Products/ZenEvents/MessageProcessing.py Log: updated to handle the localtime/UTC dilemna Modified: trunk/Products/ZenEvents/MessageProcessing.py =================================================================== --- trunk/Products/ZenEvents/MessageProcessing.py 2007-04-17 22:06:48 UTC (rev 4724) +++ trunk/Products/ZenEvents/MessageProcessing.py 2007-04-17 22:07:09 UTC (rev 4725) @@ -6,6 +6,8 @@ ################################################################# import email, socket, time, rfc822 +import calendar +from datetime import tzinfo, timedelta, datetime from Event import Event @@ -18,10 +20,33 @@ eventGroup="mail" +ZERO = timedelta(0) + +# A class building tzinfo objects for fixed-offset time zones. +# Note that FixedOffset(0, "UTC") is a different way to build a +# UTC tzinfo object. +class FixedOffset(tzinfo): + """Fixed offset in minutes east from UTC.""" + + def __init__(self, offset, name): + self.__offset = timedelta(minutes = offset) + self.__name = name + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return self.__name + + def dst(self, dt): + return ZERO + + class MessageProcessor(object): def __init__(self, zem): self.zem = zem + def process(self, messageStr): message = email.message_from_string(messageStr) fromAddr = message.get('From').split('@')[1][:-1] @@ -32,13 +57,30 @@ log.error('hostname lookup failed for host: %s' % fromAddr, exc_info=1) subject = message.get('Subject') - rtime = rfc822.parsedate_tz(message.get('Date')) - tz_offset = rtime[-1] - rtime_secs = time.mktime(rtime[0:9]) - tz_offset + # this is tricky... date comes in with an offset value that + # represents the number of seconds of difference between the + # parsed timezone and UTC. the events database wants all time + # as seconds since the epoch and treats it as UTC. as a + # result we have to use the datetime class to do the + # conversion because the functions in the time module do all + # kinds of covnersions "to be helpful" + t = rfc822.parsedate_tz(message.get('Date')) + + offset_secs = t[-1] + + # convert the offset in seconds to minutes. calendar wants minutes + offset_mins = offset_secs / 60 + tz = FixedOffset(offset_mins, "Unknown") + + # construct dt using the date and time as well as the timezone + dt = datetime(t[0], t[1], t[2], t[3], t[4], t[5], 0, tz) + secs = calendar.timegm(dt.utctimetuple()) + log.info('timestamp of event (should be in UTC): %f' % secs) + + event = MailEvent(device=fromAddr, ipAddress=fromIp, rcvtime=secs) + body = message.get_payload() - - event = MailEvent(device=fromAddr, ipAddress=fromIp, rcvtime=rtime_secs) event.summary = body self.enrich(event, subject) |
From: <sv...@ze...> - 2007-04-17 22:06:54
|
Author: chris Date: 2007-04-17 18:06:48 -0400 (Tue, 17 Apr 2007) New Revision: 4724 Modified: trunk/Products/ZenEvents/zenmail.py Log: removed cycletime. we'll pull that from the performance monitor the user chooses. Modified: trunk/Products/ZenEvents/zenmail.py =================================================================== --- trunk/Products/ZenEvents/zenmail.py 2007-04-17 21:02:37 UTC (rev 4723) +++ trunk/Products/ZenEvents/zenmail.py 2007-04-17 22:06:48 UTC (rev 4724) @@ -4,6 +4,10 @@ # Copyright (c) 2007 Zenoss, Inc. All rights reserved. # ################################################################# +# +# Notes: database wants events in UTC time +# Events page shows local time, as determined on the server where zenoss runs +# __doc__='''zenmail @@ -18,7 +22,10 @@ from twisted.internet import reactor, protocol, defer, task from twisted.internet.ssl import ClientContextFactory from zope.interface import implements +from Products.ZenRRD.RRDDaemon import RRDDaemon +from Products.ZenUtils.Driver import drive, driveLater + from MessageProcessing import MessageProcessor import logging @@ -38,7 +45,7 @@ log.info('logging in...') login = self.login(self.factory.user, self.factory.passwd) login.addCallback(self._loggedIn) - login.addErrback(self._loggedIn) +# login.addErrback(self._loggedIn) login.chainDeferred(self.factory.deferred) @@ -74,6 +81,7 @@ def _finished(self, downloadResults): + log.info('calling retrieveAndParse in %d seconds.' % self.factory.cycletime) reactor.callLater(self.factory.cycletime, self.retrieveAndParse) @@ -97,11 +105,27 @@ self.deferred.errback(reason) -class ZenMail(EventServer): +class MailDaemon(EventServer, RRDDaemon): + # seconds + snmpCycleInterval = 1 * 60 + heartBeatTimeout = snmpCycleInterval * 3 + + properties = RRDDaemon.properties + ('snmpCycleInterval',) + + def __init__(self, name): + EventServer.__init__(self) + RRDDaemon.__init__(self, name) + + def setPropertyItems(self, items): + RRDDaemon.setPropertyItems(self, items) + self.heartBeatTimeout = self.snmpCycleInterval * 3 + + +class ZenMail(MailDaemon): name = 'zenmail' def __init__(self): - EventServer.__init__(self) + MailDaemon.__init__(self, ZenMail.name) self.changeUser() self.processor = MessageProcessor(self.dmd.ZenEventManager) @@ -110,7 +134,7 @@ popuser = self.options.popuser poppasswd = self.options.poppass usessl = self.options.usessl - cycletime = self.options.cycletime + cycletime = self.snmpCycleInterval log.info("creating POPFactory.") log.info("credentials user: %s; pass: %s" % (popuser, len(poppasswd) * '*')) @@ -127,6 +151,16 @@ reactor.connectTCP(host, port, self.factor) + def startUpdateConfig(self, driver): + 'Periodically ask the Zope server for performance monitor information.' + + log.info("fetching property items") + yield self.model().callRemote('propertyItems') + self.setPropertyItems(driver.next()) + + driveLater(self.configCycleInterval * 60, self.startUpdateConfig) + + def handleError(self, error): log.error(error) log.error(error.getErrorMessage()) @@ -139,11 +173,6 @@ default=0, type="int", help="Use SSL when connecting to POP server") - self.parser.add_option('--cycletime', - dest='cycletime', - default="60", - type="int", - help="Number of seconds between polls") self.parser.add_option('--pophost', dest='pophost', default="pop.zenoss.com", |
From: <sv...@ze...> - 2007-04-17 21:02:36
|
Author: ecn Date: 2007-04-17 17:02:37 -0400 (Tue, 17 Apr 2007) New Revision: 4723 Added: trunk/inst/conf/zeneventlog.conf trunk/inst/conf/zenwin.conf trunk/inst/conf/zenwinmodeler.conf Modified: trunk/inst/conf/hubpasswd Log: * configs for everyone Modified: trunk/inst/conf/hubpasswd =================================================================== --- trunk/inst/conf/hubpasswd 2007-04-17 21:01:11 UTC (rev 4722) +++ trunk/inst/conf/hubpasswd 2007-04-17 21:02:37 UTC (rev 4723) @@ -1 +1 @@ -zenoss:zenoss +admin:zenoss Added: trunk/inst/conf/zeneventlog.conf Added: trunk/inst/conf/zenwin.conf Added: trunk/inst/conf/zenwinmodeler.conf |
From: <sv...@ze...> - 2007-04-17 21:01:15
|
Author: ecn Date: 2007-04-17 17:01:11 -0400 (Tue, 17 Apr 2007) New Revision: 4722 Added: trunk/bin/zeneventlog trunk/bin/zenwinmodeler Log: * starters for the other windows programs Added: trunk/bin/zeneventlog Property changes on: trunk/bin/zeneventlog ___________________________________________________________________ Name: svn:executable + * Added: trunk/bin/zenwinmodeler Property changes on: trunk/bin/zenwinmodeler ___________________________________________________________________ Name: svn:executable + * |
From: <sv...@ze...> - 2007-04-17 20:59:37
|
Author: ecn Date: 2007-04-17 16:59:34 -0400 (Tue, 17 Apr 2007) New Revision: 4721 Modified: trunk/Products/ZenEvents/ZenEventClasses.py trunk/Products/ZenHub/services/WmiConfig.py trunk/Products/ZenWin/WinCollector.py trunk/Products/ZenWin/zeneventlog.py trunk/Products/ZenWin/zenwinmodeler.py Log: * zenwinmodeler works a little now Modified: trunk/Products/ZenEvents/ZenEventClasses.py =================================================================== --- trunk/Products/ZenEvents/ZenEventClasses.py 2007-04-17 19:39:16 UTC (rev 4720) +++ trunk/Products/ZenEvents/ZenEventClasses.py 2007-04-17 20:59:34 UTC (rev 4721) @@ -22,6 +22,8 @@ Status_Snmp = "/Status/Snmp" Status_Update = "/Status/Update" Status_Web = "/Status/Web" +Status_Wmi = "/Status/Wmi" Status_Wmi_Conn = "/Status/Wmi/Conn" +Status_WinSrv = "/Status/WinSrv" Status_XmlRpc = "/Status/XmlRpc" Unknown = "/Unknown" Modified: trunk/Products/ZenHub/services/WmiConfig.py =================================================================== --- trunk/Products/ZenHub/services/WmiConfig.py 2007-04-17 19:39:16 UTC (rev 4720) +++ trunk/Products/ZenHub/services/WmiConfig.py 2007-04-17 20:59:34 UTC (rev 4721) @@ -9,27 +9,22 @@ Provides Wmi config to zenwin clients. ''' -from twisted.spread import pb -class ZenWinConfig(pb.Copyable, pb.RemoteCopy): +from Products.ZenHub.HubService import HubService +from Products.DataCollector.ApplyDataMap import ApplyDataMap - def __init__(self, monitor, devices): - self.monitor = monitor - self.devices = devices -pb.setUnjellyableForClass(ZenWinConfig, ZenWinConfig) - -from Products.ZenHub.HubService import HubService class WmiConfig(HubService): def __init__(self, dmd, instance): HubService.__init__(self, dmd, instance) self.config = self.dmd.Monitors.Performance._getOb(self.instance) - def getDeviceWinInfo(self): + def remote_getDeviceWinInfo(self): """Return list of (devname,user,passwd,url) for each device. user and passwd are used to connect via wmi. """ devinfo = [] - for dev in self.config.device(): + for dev in self.config.devices(): + dev = dev.primaryAq() if not dev.monitorDevice(): continue if getattr(dev, 'zWmiMonitorIgnore', False): continue user = getattr(dev,'zWinUser','') @@ -39,7 +34,7 @@ return devinfo - def getWinServices(self): + def remote_getWinServices(self): """Return a list of (devname, user, passwd, {'EvtSys':0,'Exchange':0}) """ svcinfo = [] @@ -62,5 +57,20 @@ return svcinfo def remote_getConfig(self): - return ZenWinConfig(self.config.propertyItems(), - self.getWinServices()) + return self.config.propertyItems() + + def remote_applyDataMap(self, + url, + datamap, + relname="", + compname="", + modname=""): + dev = self.dmd.getObjByPath(url) + adm = ApplyDataMap() + return adm.applyDataMap(dev, + datamap, + relname=relname, + compname=compname, + modname=modname) + + Modified: trunk/Products/ZenWin/WinCollector.py =================================================================== --- trunk/Products/ZenWin/WinCollector.py 2007-04-17 19:39:16 UTC (rev 4720) +++ trunk/Products/ZenWin/WinCollector.py 2007-04-17 20:59:34 UTC (rev 4721) @@ -14,7 +14,6 @@ import Globals from Products.ZenHub.PBDaemon import FakeRemote, PBDaemon as Base -from Products.ZenHub.services import WmiConfig from Products.ZenEvents.ZenEventClasses import Heartbeat from Products.ZenUtils.Driver import drive, driveLater @@ -32,6 +31,7 @@ heartbeat = dict(eventClass=Heartbeat, device=getfqdn(), component='zenwin') + deviceConfig = 'getDeviceWinInfo' def __init__(self): self.heartbeat['component'] = self.agent @@ -81,31 +81,30 @@ def updateConfig(self, cfg): - for a, v in cfg.monitor: + for a, v in cfg: current = getattr(self, a, None) if current is not None and current != v: self.log.info("Setting %s to %r", a, v); setattr(self, a, v) self.heartbeat['timeout'] = self.cycleInterval*3 - self.log.debug('Device data: %r' % (cfg.devices,)) - self.updateDevices(cfg.devices) - def error(self, why): why.printTraceback() self.log.error(why.getErrorMessage()) - def reconfigure(self): - try: - d = self.configService().callRemote('getConfig') - d.addCallbacks(self.updateConfig, self.error) - except Exception, ex: - self.log.exception("Error fetching config") - return defer.fail(ex) - reactor.callLater(self.configCycleInterval, self.reconfigure) - return d + def startConfigCycle(self): + def doReconfigure(driver): + try: + yield self.configService().callRemote('getConfig') + self.updateConfig(driver.next()) + yield self.configService().callRemote(self.deviceConfig) + self.updateDevices(driver.next()) + except Exception, ex: + self.log.exception("Error fecthing config") + driveLater(self.configCycleInterval, doReconfigure) + return drive(doReconfigure) def connected(self): - d = self.reconfigure() + d = self.startConfigCycle() d.addCallback(self.startScan) Modified: trunk/Products/ZenWin/zeneventlog.py =================================================================== --- trunk/Products/ZenWin/zeneventlog.py 2007-04-17 19:39:16 UTC (rev 4720) +++ trunk/Products/ZenWin/zeneventlog.py 2007-04-17 20:59:34 UTC (rev 4721) @@ -31,7 +31,7 @@ def updateDevices(self, devices): """get the config data from server""" - for name,user,passwd,sev,url in devices: + for name, user, passwd, sev, url in devices: try: if name not in self.wmiprobs: self.log.info('wmi prob on %s skipping', name) Modified: trunk/Products/ZenWin/zenwinmodeler.py =================================================================== --- trunk/Products/ZenWin/zenwinmodeler.py 2007-04-17 19:39:16 UTC (rev 4720) +++ trunk/Products/ZenWin/zenwinmodeler.py 2007-04-17 20:59:34 UTC (rev 4721) @@ -7,63 +7,38 @@ import os import time import sys -import copy -import xmlrpclib import logging import wmiclient -import socket +from socket import getfqdn import pywintypes -from zenutils.Utils import prepId, basicAuthUrl -from zenutils.StatusMonitor import StatusMonitor -from zenutils.SendEvent import SendEvent +import Globals +from WinCollector import WinCollector as Base +from Products.ZenEvents.ZenEventClasses import \ + Heartbeat, Status_WinSrv, Status_Wmi +from Products.ZenUtils.Utils import prepId -class zenwinmodeler(StatusMonitor): +class zenwinmodeler(Base): - evtClass = "/Status/WinSrv" - evtAgent = "zenwin" + evtClass = Status_WinSrv + agent = "zenwinmodeler" evtAlertGroup = "ServiceTest" - startevt = {'eventClass':'/App/Start', 'device':socket.getfqdn(), - 'summary': 'zenwinmodeler started', - 'component':'zenwinmodeler', - 'severity':0} - stopevt = {'eventClass':'/App/Stop', 'device':socket.getfqdn(), - 'summary': 'zenwinmodeler stopped', - 'component':'zenwinmodeler', - 'severity': 4} - heartbeat = {'eventClass':'/Heartbeat', 'device':socket.getfqdn(), - 'component': 'zenwinmodeler'} + deviceConfig = 'getDeviceWinInfo' def __init__(self): - StatusMonitor.__init__(self) - self.configCycleInterval = 0 + Base.__init__(self) self.devices = [] - self.lastStart = 0 - - def validConfig(self): - return len(self.devices) - - - def loadConfig(self): - """get the config data from server""" - self.log.info("reloading configuration") - url = basicAuthUrl(self.username, self.password,self.winurl) - server = xmlrpclib.Server(url) - self.lastStart, self.devices = \ - server.getDeviceWinInfo(self.lastStart) - self.log.debug("laststart=%s", self.lastStart) - - def processLoop(self): """For each device collect service info and send to server. """ - self.lastStart = time.time() + self.log.error("devices %r", self.devices); for name, user, passwd, sev, url in self.devices: - if self.options.device and name != self.options.device: continue + if self.options.device and name != self.options.device: + continue try: - if self.checkwmi(name): + if name in self.wmiprobs: self.log.warn("skipping %s has bad wmi state", name) continue self.log.info("collecting from %s using user %s", name, user) @@ -71,14 +46,15 @@ if not svcs: self.log.warn("failed collecting from %s", name) continue - url = basicAuthUrl(self.username, self.password, url) - server = xmlrpclib.Server(url) - server.applyDataMap(svcs,"winservices","os", - "Products.ZenModel.WinService") + svc = self.configService() + d = svc.callRemote('applyDataMap', url, svcs, + 'winservices', 'os', + 'Products.ZenModel.WinService') + d.addErrback(self.error) except (SystemExit, KeyboardInterrupt): raise except pywintypes.com_error, e: msg = "wmi failed " - code,txt,info,param = e + code, txt, info, param = e wmsg = "%s: %s" % (abs(code), txt) if info: wcode, source, descr, hfile, hcont, scode = info @@ -95,15 +71,16 @@ """ data = [] attrs = ("acceptPause","acceptStop","name","caption", - "pathName","serviceType","startMode","startName") + "pathName","serviceType","startMode","startName") dev = wmiclient.WMI(name, user, passwd) dev.connect() wql = "select %s from Win32_Service" % (",".join(attrs)) svcs = dev.query(wql) self.log.debug("query='%s'", wql) for svc in svcs: - sdata = {'id':prepId(svc.name), 'setServiceClass': - {'name':svc.name, 'description':svc.caption}} + sdata = {'id':prepId(svc.name), + 'setServiceClass': {'name':svc.name, + 'description':svc.caption}} for att in attrs: if att in ("name", "caption"): continue sdata[att] = getattr(svc,att,"") @@ -111,24 +88,27 @@ return data - def sendFail(self, name, msg="", evtclass="/Status/Wmi", sev=3): + def sendFail(self, name, msg="", evtclass=Status_Wmi, sev=3): evt = { 'eventClass':evtclass, - 'agent': 'zenwinmodeler', 'component': '', + 'agent': self.agent, + 'component': '', 'severity':sev} if not msg: msg = "wmi connection failed %s" % name evt['summary'] = msg evt['device'] = name - self.zem.sendEvent(evt) + self.sendEvent(evt) #self.log.warn(msg) self.log.exception(msg) self.failed = True + def updateDevices(self, devices): + self.devices = devices if __name__=='__main__': zw = zenwinmodeler() - zw.mainLoop() + zw.run() |