The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Findout iLO type installed in a machine skmdu Linux 1 09-25-2009 05:38 AM
How to mount a Files System where RHEL is installed on a Sun server Machine.. sankasu SUN Solaris 2 08-03-2009 09:24 AM
Installed memory ≠ usable size? CRGreathouse Filesystems, Disks and Memory 23 07-16-2009 08:12 PM
How to Find JRE installed in linux machine..? XivaX Shell Programming and Scripting 3 01-31-2008 09:18 PM
How to get amount of memory installed. elgholm UNIX for Dummies Questions & Answers 4 08-24-2001 08:04 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-25-2009
insania insania is offline
Registered User
  
 

Join Date: Nov 2005
Posts: 30
User perl to get memory installed in a machine

I currently have a statistics gathering script i run on my Linux servers. One of the stat i gather is total memory in the machine. The script is all perl with the exception of gathering the memory for that i use the following command:


Code:
 $ram = (`cat /proc/meminfo |  grep "MemTotal" | awk '{print \$2}'`);

Is there a way to do this with an internal perl command (modules would work too, however to install them i need to go through a change management process). I just want to make it a pure perl script, not that it will make it any better i just want to.

thanks,

Sean
  #2 (permalink)  
Old 09-25-2009
durden_tyler's Avatar
durden_tyler durden_tyler is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2009
Posts: 553
Check the Linux::MemInfo module at cpan:


Code:
$ 
$ cat /proc/meminfo |  grep "MemTotal" | awk '{print $2}'
961528
$ 
$ perl -le 'BEGIN{use Linux::MemInfo} %mem=get_mem_info; print $mem{"MemTotal"}'
961528
$ 
$

tyler_durden
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:48 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0