Sure, we should do that. The example.py module already demonstrates this as well.
>>> On 9/2/2009 at 10:17 AM, in message <[email protected]>, Bernard Li <[email protected]> wrote: > Hi guys: > > Perhaps we should extend the example in the Wiki to include this > configuration? > > Thanks, > > Bernard > > On Wed, Sep 2, 2009 at 7:50 AM, Matt<[email protected]> wrote: >> Yep, i've come to a similar conclusion. Thanks Brad. >> >> 2009/9/2 Brad Nicholes <[email protected]>: >>> Why can't you just do the following: >>> >>> # webserver.pyconf >>> modules { >>> module { >>> name = "lsof" >>> language = "python" >>> param httpd { >>> value = "doesnt-matter" >>> } >>> param crawler { >>> value = "doesnt-matter" >>> } >>> } >>> } >>> >>> collection_group { >>> collect_every = 30 >>> time_threshold = 60 >>> >>> metric { >>> name = "lsof-httpd" >>> title = "Web Server open files" >>> value_threshold = 1.0 >>> } >>> >>> metric { >>> name = "lsof-crawler" >>> title = "crawler open files" >>> value_threshold = 1.0 >>> } >>> } >>> >>> Then just iterate through all of the params that your module receives and > construct a unique metric name by appending the param name to the module > name. Then create a separate descriptor for each unique metric name and pass > that back. Gmond will generate a metric for each of the descriptors and call > your module to gather each one individually. This way you have one python > module that is loaded once but generates metrics for each process that you > specify in the config file. >>> >>> Brad >>> >>>>>> On 9/2/2009 at 2:15 AM, in message >>> <[email protected]>, Matt >>> <[email protected]> wrote: >>>> Hi all, >>>> >>>> I'm trying to create my python metric modules as versatile as >>>> possible, but i'm not sure exactly how they are supposed to be used. >>>> For instance, i've got a python script that grabs open files for a >>>> process. Can I invoke this module multiple times with different >>>> pyconf files? and if so, how do I change the metric name? I don't >>>> really want to use multiple descriptors, as I don't want to check for >>>> processes I know that are not on the server. example: >>>> >>>> The lsof.py script has a descriptor for lsof, can I use the same >>>> lsof.py for two pyconf files? won't the metrics both show up as lsof? >>>> Or do I need a different lsof.py for every process/metric I want to >>>> capture? >>>> >>>> # webserver.pyconf >>>> modules { >>>> module { >>>> name = "lsof" >>>> language = "python" >>>> param name { >>>> value = "httpd" >>>> } >>>> } >>>> } >>>> >>>> collection_group { >>>> collect_every = 30 >>>> time_threshold = 60 >>>> metric { >>>> name = "lsof" >>>> title = "Web Server open files" >>>> value_threshold = 1.0 >>>> } >>>> } >>>> >>>> #crawler.conf >>>> modules { >>>> module { >>>> name = "lsof" >>>> language = "python" >>>> param processname { >>>> value = "crawler" >>>> } >>>> } >>>> } >>>> >>>> collection_group { >>>> collect_every = 30 >>>> time_threshold = 60 >>>> metric { >>>> name = "lsof" >>>> title = "crawler open files" >>>> value_threshold = 1.0 >>>> } >>>> } >>>> >>>> Thanks, >>>> >>>> Matt >>>> >>>> ------------------------------------------------------------------------------ >>>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day >>>> trial. Simplify your report design, integration and deployment - and focus >>>> on >>>> >>>> what you do best, core application coding. Discover what's new with >>>> Crystal Reports now. http://p.sf.net/sfu/bobj-july >>>> _______________________________________________ >>>> Ganglia-general mailing list >>>> [email protected] >>>> https://lists.sourceforge.net/lists/listinfo/ganglia-general >>> >>> >>> >>> >> >> ------------------------------------------------------------------------------ >> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day >> trial. Simplify your report design, integration and deployment - and focus on >> what you do best, core application coding. Discover what's new with >> Crystal Reports now. http://p.sf.net/sfu/bobj-july >> _______________________________________________ >> Ganglia-general mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/ganglia-general >> > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Ganglia-general mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/ganglia-general ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Ganglia-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ganglia-general

