Hey all, I've cleaned up some of the functions and classes that I've been reusing while writing various gmond python metrics. I want to put them in the ganglia_contrib package on github. I forked it and added my package via submodule -submodule sound ok?
Also, before I add it or do the pull request, I'd love some feedback ...useful, reinventing wheels, good or bad style? Project link: http://github.com/davidbirdsong/pygmonlib README: This package attempts to abstract out reusable python gmond metric extension functions and classes that I found myself rewriting again and again. INSTALL: I've never written a setup.py or learned disutils. For now, just copy the file into your existing PYTHONPATH or modify PYTHONPATH to include the location of FILES: gmreader.py - a set of classes that provides iterator access to records from non-blocking IO resources. unix's 'tail -f' is great for following files and keeping up with logs rotating underneath, but reading from it will block your gmond process. this was implemented with threading at first, but IMHO single proc, single threaded is preferrable when possible. the intention is that this approach makes it easy to reuse code to pull metrics off of other file descriptor resources ..sockets etc... NOTES: - gmreader.GrecordReader - generic base class pass a file descriptor or file-like object(implements a fileno() methood) and a record terminating pattern('\n') - gmreader.GlineReader - extends GrecordReader, pass a file descriptor, it will iterate over '\n', implements readline() and readlines() methods - gmreader.GlogReader - extends GlineReader, pass a filename, use readline() or readlines() EXAMPLES: g = gmreader.GlineReader('/var/log/httpd/access.log') for line in g.readlines(): print line check out *_example.py to see more detailed example ------------------------------------------------------------------------------ Download new Adobe(R) Flash(R) Builder(TM) 4 The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly Flex(R) Builder(TM)) enable the development of rich applications that run across multiple browsers and platforms. Download your free trials today! http://p.sf.net/sfu/adobe-dev2dev _______________________________________________ Ganglia-general mailing list Ganglia-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ganglia-general