[Boston.pm] Thanks Damian!
Damian, I really enjoyed the SAT talk tonight. Is it just me or were there substantial changes from the version you gave at YAPC last month? Either way I'm pumped up and ready to make my interfaces simpler yet more powerful! :-) Thanks again for your continuing presentations here in Boston. They are definitely appreciated (and even useful!). IIRC, I think I've seen you 3-4 times here, and I've missed 1 or 2 meetings as well. Drew -- - Drew Taylor * Web app development consulting [EMAIL PROTECTED] * Site implementation hosting www.drewtaylor.com * perl/mod_perl/DBI/mysql/postgres - ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] reading in HTML with SSI and processing in perl
Found the solution. It's wasn't having difficulties with the set commends. It was having trouble reading the folllowing line: !--#if expr=$HTTP_USER_AGENT != /WebTV/ -- my script didn't process anything within this if statement. Once I removed this if statement, everythign worked out fine. Thanks anyway. And sorry to bother. --Alex P.S. If anyone knows why it did not accept that line I would love to know. Otherwise I'll try to deal without it... I hate to bug you all with a perl question like this seeing as I am new to the group. But I'm getting kinda stuck on this one. I am simply trying to read in an external html file (to be used as the header of a web page) and then print it out. That sounds nice and easy. However, the header file contains SSI, and not just an include, and sets and echos. I've been trying to get CGI::SSI to work, but, near as I can tell, it's not understanding the set commands or the if/else commands in SSI. Do you guys have any suggestions on this one? I KNOW there has to be a way --Alex WPI ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Thanks Damian!
A big thanks to Damian from me as well. Always a treat. I'm going to have to add /mxs to Impatient Perl, now. It just seems so right. Unfortunately, that's about the only specific thing I can remember from teh talk. Should have taken notes. I was too busy laughing though. Some people have a brain like a seive, I've got a brain like a colander. What was the #include module again? That one was really cool. And then there was the module to make /mxs the default regexp options. I think there were a couple modules that I'd like to roll into Impatient Perl. Does anyone have a list of modules mentioned in the talk? The names would probably be enough to remind me what they were about. -- Impatient Perl A GNU-FDL training manual for the hyperactive. Free HTML/PDF downloads at www.greglondon.com/iperl Paperback/coilbound available for $8.50+sh ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Thanks Damian!
Here are some brief notes; I hope they're helpful to fill in gaps. If anyone can correct any mistakes, I'll be grateful. I've tried to not give away any punchlines, since Damian makes his living by giving these talks; I apologize if different people think I've given away too much, or not enough. But since it was his talk, the only person whose opinions on this I'll be sure to follow are Damian's. :-) -- spiteyourface.com - 2001 space odyssey in lego dec 1-3 melbourne AU - yapc::AU Acme::Pythonic IO::All - one function to IO them all. operator ... pulp fiction operator. use IO::All::Pulp::Fiction - one-line version- uses overriding glob operator. use Perl6::Slurp; $text = slurp 'filename'; use IO::Prompt ... perl best practices talk he's giving at oscon: use /xms all the time. improve maintainability of regexes. use Regexp::Auto; which does all of these. not on CPAN yet. it's not done as source filters. too difficult to use '/' as filter ... overload::constant IO::Progress - draws progress bars. what about those boring comments? want intelligent comments, such as paintings in harry potter... use Smart::Comments; comments control program operation. does use source filtering. perl 5 doesn't provide hooks to manipulate comments... # check $i = 10 -- will warn on problems. # strict $i = 10 -- will die. Sufficiently Advanced meta-Technologies : how do you include a batch of these improvements into ALL of your code? You can't just write a module S::A::T that uses all of the above; for example, use strict is scoped to the file. use Module::Macro - gets around fact that S::A::T would only make T magic, if T included use (each of his magical stuff above). similar to Filter::include improvements on Lingua::EN::Inflect, his first YAPC talk. say inflect $story chambers were found - say $story chambers were found Lingua::EN::Autoinflect -- Daniel Allen http://kw.pm.org/ - Kitchener-Waterloo Perl Mongers - [EMAIL PROTECTED] http://coder.com/ - Prescient Code Solutions - (519) 575-3733 [EMAIL PROTECTED] On Wed, 14 Jul 2004 12:31:21 -0400 (EDT), Greg London [EMAIL PROTECTED] wrote: A big thanks to Damian from me as well. Always a treat. I'm going to have to add /mxs to Impatient Perl, now. It just seems so right. Unfortunately, that's about the only specific thing I can remember from teh talk. Should have taken notes. I was too busy laughing though. Some people have a brain like a seive, I've got a brain like a colander. What was the #include module again? That one was really cool. And then there was the module to make /mxs the default regexp options. I think there were a couple modules that I'd like to roll into Impatient Perl. Does anyone have a list of modules mentioned in the talk? The names would probably be enough to remind me what they were about. -- Impatient Perl A GNU-FDL training manual for the hyperactive. Free HTML/PDF downloads at www.greglondon.com/iperl Paperback/coilbound available for $8.50+sh ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
RE: [Boston.pm] Is there a module to access memory usage?
Yeah, I thought of that. I was hoping for a platform independent mechanism. If not, then I can use this type of methodology, but how do I account for Windows based machines? Tal -Original Message- From: Anthony R. J. Ball [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 14, 2004 2:14 PM To: Tal Cohen Cc: 'Boston.PM' Subject: Re: [Boston.pm] Is there a module to access memory usage? `top -n 1` will spit out one iteration of top that you could then parse. On Wed, Jul 14, 2004 at 02:05:07PM -0400, Tal Cohen wrote: Hi All, I need to write a script that will return how much memory (RAM) is on a system as well as how much of it is being used. Can anyone assist? Thanks, Tal Cohen ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm -- www.suave.net - Anthony Ball - [EMAIL PROTECTED] OSB - http://rivendell.suave.net/Beer -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Live as you will have wished to have lived when you are dying. ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
RE: [Boston.pm] Is there a module to access memory usage?
I know, but that is what I am stuck with (besides, what is wrong with writing platform independent code?). I could use a Windows/DOS batch command...if I knew which one to use. Tal PS Rude comments are always welcome...they're entertaining :D -Original Message- From: Anthony R. J. Ball [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 14, 2004 2:54 PM To: Tal Cohen Cc: 'Boston.PM' Subject: Re: [Boston.pm] Is there a module to access memory usage? I will refrain from rude comment ;) On Wed, Jul 14, 2004 at 02:22:31PM -0400, Tal Cohen wrote: Yeah, I thought of that. I was hoping for a platform independent mechanism. If not, then I can use this type of methodology, but how do I account for Windows based machines? Tal -Original Message- From: Anthony R. J. Ball [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 14, 2004 2:14 PM To: Tal Cohen Cc: 'Boston.PM' Subject: Re: [Boston.pm] Is there a module to access memory usage? `top -n 1` will spit out one iteration of top that you could then parse. On Wed, Jul 14, 2004 at 02:05:07PM -0400, Tal Cohen wrote: Hi All, I need to write a script that will return how much memory (RAM) is on a system as well as how much of it is being used. Can anyone assist? Thanks, Tal Cohen ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm -- www.suave.net - Anthony Ball - [EMAIL PROTECTED] OSB - http://rivendell.suave.net/Beer -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Live as you will have wished to have lived when you are dying. ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm -- www.suave.net - Anthony Ball - [EMAIL PROTECTED] OSB - http://rivendell.suave.net/Beer -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= A man's life, of any worth, is a continual allegory. -- Keats ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
RE: [Boston.pm] Is there a module to access memory usage?
Tal, You might have a look at Win32::SystemInfo module. It claims to do what you need. If the above doesn't work try to use use Win32::TieRegistry and then extract the registry key which contains the information about the amount of installed memory. I assume it is either under HKEY_LOCAL_MACHINE\Hardware or HKEY_LOCAL_MACHINE\System but you'll have to look for it as I don't have such a deep knowledge of the Windows registry. Stefan --- Tal Cohen [EMAIL PROTECTED] wrote: Yeah, I thought of that. I was hoping for a platform independent mechanism. If not, then I can use this type of methodology, but how do I account for Windows based machines? Tal -Original Message- From: Anthony R. J. Ball [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 14, 2004 2:14 PM To: Tal Cohen Cc: 'Boston.PM' Subject: Re: [Boston.pm] Is there a module to access memory usage? `top -n 1` will spit out one iteration of top that you could then parse. On Wed, Jul 14, 2004 at 02:05:07PM -0400, Tal Cohen wrote: Hi All, I need to write a script that will return how much memory (RAM) is on a system as well as how much of it is being used. Can anyone assist? Thanks, Tal Cohen ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm -- www.suave.net - Anthony Ball - [EMAIL PROTECTED] OSB - http://rivendell.suave.net/Beer -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Live as you will have wished to have lived when you are dying. ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
RE: [Boston.pm] Is there a module to access memory usage?
On Wed, 14 Jul 2004, Tal Cohen wrote: Yeah, I thought of that. I was hoping for a platform independent mechanism. If not, then I can use this type of methodology, but how do I account for Windows based machines? Set up SNMP on each client and write generic, cross-platform scripts that can make SNMP queries to find out such things (or better still, install a package like Mon or MRTG that does such things for you). O'Reilly's _Perl for System Administration_ gives a quick overview of such things; chapter 10 appendix E have the material you need here. The _Essential SNMP_ book gets into much more detail, and has chapters on MRTG setup use and using Perl to script SNMP work. Setting up an SNMP architecture may be more overhead than you have in mind, but once you have it in place, monitoring all kinds of things, for all kinds of devices (computers with about any operating system, as well as things like printers, network hardware, etc) gets really easy. How does one brew a cup of tea? First one must create the universe... -- Chris Devers ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Is there a module to access memory usage?
On Wed, 14 Jul 2004, David Cantrell wrote: Tal Cohen wrote: I know, but that is what I am stuck with (besides, what is wrong with writing platform independent code?). I could use a Windows/DOS batch command...if I knew which one to use. mem, I think. Yes, this seems to work -- sort of: % ssh $windows_host_FOO_with_cygwin_ssh_set_up [EMAIL PROTECTED]'s password: Last login: Wed Jul 7 19:14:00 2004 from bar [EMAIL PROTECTED] ~ $ mem /? Displays the amount of used and free memory in your system. MEM [/PROGRAM | /DEBUG | /CLASSIFY] /PROGRAM or /P Displays status of programs currently loaded in memory. /DEBUG or /D Displays status of programs, internal drivers, and other information. /CLASSIFY or /C Classifies programs by memory usage. Lists the size of programs, provides a summary of memory in use, and lists largest memory block available. [EMAIL PROTECTED] ~ $ mem 655360 bytes total conventional memory 655360 bytes available to MS-DOS 632720 largest executable program size 1048576 bytes total contiguous extended memory 0 bytes available contiguous extended memory 941056 bytes available XMS memory MS-DOS resident in High Memory Area [EMAIL PROTECTED] ~ $ mem /classify Conventional Memory : NameSize in Decimal Size in Hex - - - MSDOS 12080 ( 11.8K) 2F30 KBD 3280 ( 3.2K)CD0 HIMEM 1248 ( 1.2K)4E0 COMMAND 4272 ( 4.2K) 10B0 FREE 112 ( 0.1K) 70 FREE 634192 (619.3K) 9AD50 Total FREE : 634304 (619.4K) Upper Memory : NameSize in Decimal Size in Hex - - - SYSTEM163824 (160.0K) 27FF0 MOUSE 12528 ( 12.2K) 30F0 MSCDEXNT 464 ( 0.5K)1D0 REDIR 2672 ( 2.6K)A70 DOSX 34848 ( 34.0K) 8820 FREE1456 ( 1.4K)5B0 FREE 46208 ( 45.1K) B480 Total FREE :47664 ( 46.5K) Total bytes available to programs (Conventional+Upper) : 681968 (666.0K) Largest executable program size : 632736 (617.9K) Largest available upper memory block : 46208 ( 45.1K) 1048576 bytes total contiguous extended memory 0 bytes available contiguous extended memory 941056 bytes available XMS memory MS-DOS resident in High Memory Area $ So, if you have ssh set up, and can use ssh-agent to cache the password, then it appears you can get a nicely parseable display of memory usage. As long as you're happy with memory available to DOS that is. :-/ But hey, 666.0K ought to be enough for anybody! :-) -- Chris Devers ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] reading in HTML with SSI and processing in perl
On Wed, 14 Jul 2004, Alex Brelsfoard wrote: I've been trying to get CGI::SSI to work, but, near as I can tell, it's not understanding the set commands or the if/else commands in SSI. Do you guys have any suggestions on this one? I KNOW there has to be a way I know this isn't the answer you were looking for, but have you considered the possibility of re-writing this in a proper template language rather than trying to meld CGI and SSI? You're trying to do something reasonably sophisticated, and glueing together CGI SSI seems like a messy way to do something that would be dirt easy with HTML::Template, Template Toolkit, or Mason. Are you really bound to this approach, or would an alternative be an option? I think in the long run you'll have a much easier time with this if you could go about the problem in a different way. -- Chris Devers Saddly, yes I am committed to having to use SSI. I have used HTML::Template before, and enjoyed it. The problem is that I am trying to create an all-emcompassing email form script that does EVERYTHING. Our current setup is that we have header and footer files for each and ever page, read in by yup SSI. So, when I have this script print out a page I am having it read in the appropriate header and footer files and throw them up on the page as well. So far everything is working great. It's just that one if statement that is not working Any other ideas? :P Thanks. --Alex ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
RE: [Boston.pm] Is there a module to access memory usage?
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris Devers Sent: Wednesday, July 14, 2004 4:33 PM To: Tal Cohen Cc: 'Boston.PM' Subject: RE: [Boston.pm] Is there a module to access memory usage? On Wed, 14 Jul 2004, Tal Cohen wrote: Yeah, I thought of that. I was hoping for a platform independent mechanism. If not, then I can use this type of methodology, but how do I account for Windows based machines? Set up SNMP on each client and write generic, cross-platform scripts that can make SNMP queries to find out such things (or better still, install a package like Mon or MRTG that does such things for you). O'Reilly's _Perl for System Administration_ gives a quick overview of such things; chapter 10 appendix E have the material you need here. The _Essential SNMP_ book gets into much more detail, and has chapters on MRTG setup use and using Perl to script SNMP work. Setting up an SNMP architecture may be more overhead than you have in mind, but once you have it in place, monitoring all kinds of things, for all kinds of devices (computers with about any operating system, as well as things like printers, network hardware, etc) gets really easy. How does one brew a cup of tea? First one must create the universe... -- Chris Devers ___ I asked him where he had it made, he said he made it himself, and when I asked him where he got his tools said he made them himself and laughing added if I had staid for other people to make my tools and things for me, I had never made anything... http://www.physics.mq.edu.au/units/phys242/pryortext/c4.html ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Is there a module to access memory usage?
I need to write a script that will return how much memory (RAM) is on a system as well as how much of it is being used. Can anyone assist? If this is done under UNIX/Linux, it might be easier than you think: just poke around the proc filesystem and you might find that all you need is really there -Federico _ -- 'Problem' is a bleak word for challenge - Richard Fish Muad'Dib of Caladan (Federico L. Lucifredi)- BU Harvard University [EMAIL PROTECTED], http://www.lucifredi.com ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Is there a module to access memory usage?
--- Federico Lucifredi mumbled on 2004-07-14 23.06.01 -0400 --- I need to write a script that will return how much memory (RAM) is on a system as well as how much of it is being used. Can anyone assist? If this is done under UNIX/Linux, it might be easier than you think: just poke around the proc filesystem and you might find that all you need is really there [EMAIL PROTECTED] ~% uname -a FreeBSD long.example.org 5.2.1-RELEASE FreeBSD 5.2.1-RELEASE #0: Mon Feb 23 20:45:55 GMT 2004 [EMAIL PROTECTED]:/usr/obj/usr/src/sys/GENERIC i386 [EMAIL PROTECTED] ~% ls /proc [EMAIL PROTECTED] ~% [EMAIL PROTECTED] ~% uname -a OpenBSD lube.example.org 3.4 GENERIC#0 i386 [EMAIL PROTECTED] ~% ls /proc ls: /proc: No such file or directory [EMAIL PROTECTED] ~% [EMAIL PROTECTED] ~% uname -a SunOS russian.example.org 5.9 Generic_112233-12 sun4u sparc UNW,Sun-Blade-1500 [EMAIL PROTECTED] ~% ls /proc 0/ 136/17457/ 177/ 220/245/ 290/ 306/ 368/ 8730/ 1/ 139/17458/ 183/ 22788/ 252/ 296/ 309/ 369/ 8914/ 12971/ 13999/ 17460/ 189/ 233/268/ 297/ 326/ 371/ 8916/ 12978/ 149/17462/ 2/241/270/ 3/334/ 49/ 8918/ 12980/ 165/17471/ 202/ 242/272/ 301/ 344/ 59/ -- Mike Burns [EMAIL PROTECTED] http://netgeek.ws ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Is there a module to access memory usage?
On Wed, 14 Jul 2004, Timothy Kohl wrote: Forwarded message: I need to write a script that will return how much memory (RAM) is on a system as well as how much of it is being used. Can anyone assist? If this is done under UNIX/Linux, it might be easier than you think: just poke around the proc filesystem and you might find that all you need is really there -Federico Under Linux: @array_of_information=split(`cat /proc/meminfo`); But of course, this isn't portable. It won't work on Windows -- which was specifically asked for -- and it also won't work on OSX or various other Unix variants. Back to square one? I still think SNMP is the most portable approach, even if it may be a lot of overhead to get started with... -- Chris Devers ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Is there a module to access memory usage?
On Jul 14, 2004, at 3:56 PM, Mike Williams wrote: Tal Cohen wrote: On Wed, Jul 14, 2004 at 02:05:07PM -0400, Tal Cohen wrote: I need to write a script that will return how much memory (RAM) is a system as well as how much of it is being used. Can anyone assist? One question that I have just to clarify things. Are you wondering how much memory the machine has? Or trying to figure out how much you can use? Just because the system has it, doesn't mean that it will give it to you. On BSD-ish Unix systems, http://search.cpan.org/~jhi/BSD-Resource-1.24/ will let your perl program ask the system what might be available to it. Yeah, I thought of that. I was hoping for a platform independent mechanism. If not, then I can use this type of methodology, but how do I account for Windows based machines? You could either use `mem` or the Win32::SystemInfo module on windoze. If you can access /proc/meminfo on the linux (you didn't specify..) boxes you can read that instead of spawning a process. For asking the system how much memory it has in total, the answer is pretty system dependent, and in this sense Unix describes a family of operating systems, and not single implementation. The vmstat, which is common on Unix doesn't even give you quite what you need, because the ordering and spelling of words such as swapped and free differ between implementations. On Solaris, look at /usr/sbin/prtconf and vmstat. On Linux, try /usr/bin/free. On Mac OS X you could use either /usr/bin/vm_stat or /usr/sbin/system_profiler SPHardwareDataType|awk -F: '/Memory/{print $2}' (or /usr/sbin/system_profiler -xml SPHardwareDataType passed through this XSLT stylesheet) ?xml version=1.0 encoding=UTF-8? xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform; version=1.0 xsl:output media-type=text/plain omit-xml-declaration=yes/ xsl:template match=/ xsl:value-of select=/plist/array/dict/array/dict/key[text() = 'physical_memory']/following-sibling::string[1] / /xsl:template /xsl:stylesheet but I mention that only to show a neat way of getting info out of an OS X plist and a comparison between XML processing tools and traditional unix tools like awk. ) On BSD systems, there is also a sysctl() system call, but I don't see a perl module that interfaces to it. On windows, this sort of information will be in the registry under the HKEY_PERFORMANCE_DATA key. Chris Devers' recommendation elsewhere on using SNMP is something to consider, since it would essentially be taking the platform dependent behavior that someone has already written and accessing it with a common API. -- When I write 'Barbie', am I supposed to add the little R in a circle around it? -- Samantha Langmead, age 7. When I write 'Barbie', am I supposed to add the little R in a circle around it? -- Samantha Langmead, age 7. ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Is there a module to access memory usage?
Fellow Speakeasy User Mike Burns wrote: If this is done under UNIX/Linux, it might be easier than you think: just poke around the proc filesystem and you might find that all you need is really there Hey pal, I did not guarantee it for *all* variants.. I said you *might* find it there. But I have to say I was surprised a bit, I knew Solaris did not have it, but never noticed that my (net)BSDs were lacking it. Is meminfo actually exclusive to Linux only ? If that is the case, one more mark in my list of small superior (convenient?) features for the penguin OS. Then again, perhaps that is one feature I would like to patch into NetBSD So many projects, so little time *sigh* -F [EMAIL PROTECTED] ~% uname -a FreeBSD long.example.org 5.2.1-RELEASE FreeBSD 5.2.1-RELEASE #0: Mon Feb 23 20:45:55 GMT 2004 [EMAIL PROTECTED]:/usr/obj/usr/src/sys/GENERIC i386 [EMAIL PROTECTED] ~% ls /proc [EMAIL PROTECTED] ~% [EMAIL PROTECTED] ~% uname -a OpenBSD lube.example.org 3.4 GENERIC#0 i386 [EMAIL PROTECTED] ~% ls /proc ls: /proc: No such file or directory [EMAIL PROTECTED] ~% [EMAIL PROTECTED] ~% uname -a SunOS russian.example.org 5.9 Generic_112233-12 sun4u sparc UNW,Sun-Blade-1500 [EMAIL PROTECTED] ~% ls /proc 0/ 136/17457/ 177/ 220/245/ 290/ 306/ 368/ 8730/ 1/ 139/17458/ 183/ 22788/ 252/ 296/ 309/ 369/ 8914/ 12971/ 13999/ 17460/ 189/ 233/268/ 297/ 326/ 371/ 8916/ 12978/ 149/17462/ 2/241/270/ 3/334/ 49/ 8918/ 12980/ 165/17471/ 202/ 242/272/ 301/ 344/ 59/ -- Mike Burns [EMAIL PROTECTED] http://netgeek.ws ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Is there a module to access memory usage?
But of course, this isn't portable. It won't work on Windows -- which was specifically asked for -- and it also won't work on OSX or various other Unix variants. Back to square one? The point is, there is obviously no portable way to do this except code a bunch of different variants and bundle them together in one monolithic module. For example DBI has to be taught (more or less) how to handle different flavored databases. -T ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Is there a module to access memory usage?
On Thu, 15 Jul 2004, Timothy Kohl wrote: But of course, this isn't portable. It won't work on Windows -- which was specifically asked for -- and it also won't work on OSX or various other Unix variants. Back to square one? The point is, there is obviously no portable way to do this except code a bunch of different variants and bundle them together in one monolithic module. Which, as I keep saying, is generally known as SNMP. And it's not just a Perl module, it's a big scary ISO standard that is already spoken today by gobs of hardware software all around you if you just know to look. And, as you seem suggest, that is probably the best approach here. SNMP is a formal, massively over-engineered spec for getting and setting information of just about any kind for just about any kind of network addressable host, including such things as computers, printers, routers, wireless access points, monitors, carrier pigeons, etc. The people that came up with SNMP developed this huge, overarching hierarchy of objects that you can get or set info about, and this hierarchy can be traversed or walked in useful ways. All of the elements in this hierarchy can be referred to by name (which is somewhat easier to remember, but there's so much hierarchy that no human is likely to bother) or by number (which is baffling, but if you bundle it all up in software you only have to look it up once). Therefore, if you have the SNMP command line tools installed, you can do commands such as these: % snmpget solarisbox public .iso.org.dod.internet.mgmt.mib-2.system.sysDescr.0 % snmpget solarisbox public .1.3.6.1.2.1.1.1.0 And either way you get back output like this: system.sysDescr.0 = Sun SNMP Agent, Ultra-1 Luckily, because almost every query you're likely to be interested in is going to have the same prefix (note that we don't get to internet until the fourth level down), you can do abbreviated queries too, e.g.: % snmpget solarisbox public system.sysUpTime.0 system.sysUpTime.0 = Timeticks: (5126167) 14:14:21.67 So, in order to solve the problem being asked in this thread, all you have to do is look up the path to the objects that relate usefully to the available memory on the device you want to poll, and then write a five line Perl script to retrieve that value. This should be completely portable and, once the infrastructure is in place, more or less easy to manage. The tricky bit isn't portability, but in coping with the complexity of the spec -- I don't, for example, have the slightest clue where memory will be denoted, though it is probably nested in there somewhere (I've seen MRTG graphs that depict memory usage over time, so SNMP must be reporting it somehow). For example DBI has to be taught (more or less) how to handle different flavored databases. Right, but any device which supports SNMP has, by that very fact, already come up with the necessary handler; at the level we're dealing with, you never ever have to dirty your hands with such details. On the downside, there are completely different, filthy details, but at least they're portably filthy. :-) Really, don't do this from scratch, just set up some infrastructure (that is, make sure hosts you want info about are responding to SNMP queries properly) and then see if you can get a package like Mon to do the work for you. This may be overkill for a small project, but it makes whole classes of diagnostic problems into known quantities that you don't have to think about anymore, which is certainly appealing. -- Chris Devers ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm