guyverix wrote: > I dont even pretend to know python syntax, but in most of my transforms, I > have been using quotes. Can you try this in your transform? > > if evt.count > "2": > evt.severity = "5" >
That will work in this case, but it's a bit more expensive. When you put quotes around a number, that tells Python that the number is actually a string (which is sometimes what you actually want). Python converts data types for us on-the-fly, but that type conversion comes at a cost (not big in the larger scheme of things for most event mappings). Here's an example of where putting quotes around numbers won't work: Code: $ pythonPython 2.4.4 (#1, Sep 23 2008, 04:23:42) [GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> blue= "1" >>> blue += 2 Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: cannot concatenate 'str' and 'int' objects In the case above, we are trying to add a string and a number, but now Python gets a little confused: are we trying to get a final result of "12" (two strings added together) or 3 (two numbers added together)? I hope that makes things a little clearer, and hopefully is useful! kells -------------------- m2f -------------------- Read this topic online here: http://forums.zenoss.com/viewtopic.php?p=26910#26910 -------------------- m2f -------------------- _______________________________________________ zenoss-users mailing list [email protected] http://lists.zenoss.org/mailman/listinfo/zenoss-users
