Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Linux free command
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  10 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
jvan  
View profile  
 More options Mar 5 2010, 7:45 am
From: jvan <Joey.Van_de_Ste...@Alcatel-Lucent.com>
Date: Fri, 5 Mar 2010 04:45:13 -0800 (PST)
Local: Fri, Mar 5 2010 7:45 am
Subject: Linux free command
Hello All,

To detect memory leaks we want to use the free command on linux
machines.

Output of free:
#free
             total       used       free     shared    buffers
cached
Mem:       5972748    5901336      71412          0     468256
4314976
-/+ buffers/cache:    1118104    4854644
Swap:     32764528      99640   32664888

Via awk i make one line of this output:
free -s 5 | awk ' /[[:digit:]]/ { if ($1 == "Mem:") printf("%s %s %s
%s %s %s ", $2, $3, $4, $5, $6, $7); if ($1 == "-/+") printf("%s %s ",
$3, $4); if ($1 == "Swap:") printf("%s %s %s\n", $2, $3, $4);}'

5972748 5899368 73380 0 468256 4315036 1116076 4856672 32764528 99640
32664888
5972748 5907752 64996 0 468256 4315040 1124456 4848292 32764528 99640
32664888
5972748 5900940 71808 0 468256 4315048 1117636 4855112 32764528 99640
32664888
5972748 5913076 59672 0 468256 4315052 1129768 4842980 32764528 99640
32664888
5972748 5900788 71960 0 468256 4315056 1117476 4855272 32764528 99640
32664888
5972748 5900820 71928 0 468256 4315060 1117504 4855244 32764528 99640
32664888

I have created a script LfreeSTAT.sh

#cat LfreeSTAT.sh
#!/bin/ksh
exec /usr/bin/free -s 5 | /bin/awk ' /[[:digit:]]/ { if ($1 == "Mem:")
printf("%s %s %s %s %s %s ", $2, $3, $4, $5, $6, $7); if ($1 == "-/+")
printf("%s %s ", $3, $4); if ($1 == "Swap:") printf("%s %s %s\n", $2,
$3, $4);}'

Gives the same output as above.

Changed the access file to include this script and restart the
STATsrv.
command  Test            /etc/STATsrv/bin/LfreeSTAT.sh

Created an add-on-STAT:
#
=======================================================================
# Test: dim_STAT New STAT Description
#
=======================================================================
Test
11
0
Test Statistic(s)
Test %i

#
=======================================================================
# Column: column3 (Mem_total)
#
=======================================================================
column3
1
1
Mem_total
free total physical memory
0
#
=======================================================================
# Column: column4 (Mem_used)
#
=======================================================================
column4
1
2
Mem_used
free used physical memory
0
#
=======================================================================
# Column: column5 (Mem_free)
#
=======================================================================
column5
1
3
Mem_free
free free physical memory
0
#
=======================================================================
# Column: column6 (Mem_shared)
#
=======================================================================
column6
1
4
Mem_shared
free shared physical memory
0
#
=======================================================================
# Column: column7 (Mem_buffers)
#
=======================================================================
column7
1
5
Mem_buffers
free buffers physical memory
0
#
=======================================================================
# Column: column8 (Mem_cached)
#
=======================================================================
column8
1
6
Mem_cached
free cached physical memory
0
#
=======================================================================
# Column: column9 (Application_used)
#
=======================================================================
column9
1
7
Application_used
free used physical - buffers - cached
0
#
=======================================================================
# Column: column10 (Application_free)
#
=======================================================================
column10
1
8
Application_free
free total physical - Application_used
0
#
=======================================================================
# Column: column11 (swap_total)
#
=======================================================================
column11
1
9
swap_total
free total swap memory
0
#
=======================================================================
# Column: column12 (swap_used)
#
=======================================================================
column12
1
10
swap_used
free used swap memory
0
#
=======================================================================
# Column: column13 (swap_free)
#
=======================================================================
column13
1
11
swap_free
free free swap memory
0

I can select it when creating a new collect. But i never see the
collects when i wont to analyze the inputs.
In the /etc/STATsrv/log/access.log logfile I see next:
STATsrv-25095:> Connect -> [138.203.236.96] CMD= "STAT_LIST" TIME: Fri
Mar  5 13:34:55 2010
STATsrv-25095:> Exit -> [138.203.236.96] CMD= "STAT_LIST" TIME: Fri
Mar  5 13:34:55 2010
STATsrv-25099:> Connect -> [138.203.236.96] CMD= "STAT_LIST" TIME: Fri
Mar  5 13:34:57 2010
STATsrv-25099:> Exit -> [138.203.236.96] CMD= "STAT_LIST" TIME: Fri
Mar  5 13:34:57 2010
STATsrv-25100:> Connect -> [138.203.236.96] CMD= "STAT_LIST" TIME: Fri
Mar  5 13:34:57 2010
STATsrv-25100:> Exit -> [138.203.236.96] CMD= "STAT_LIST" TIME: Fri
Mar  5 13:34:57 2010
STATsrv-25441:> Connect -> [138.203.236.96] CMD= "Test 5" TIME: Fri
Mar  5 13:35:05 2010
STATsrv-25831:> Connect -> [138.203.236.96] CMD= "Test 5" TIME: Fri
Mar  5 13:35:55 2010
STATsrv-26437:> Connect -> [138.203.236.96] CMD= "Test 5" TIME: Fri
Mar  5 13:36:45 2010
STATsrv-27145:> Connect -> [138.203.236.96] CMD= "Test 5" TIME: Fri
Mar  5 13:37:35 2010
STATsrv-27846:> Connect -> [138.203.236.96] CMD= "Test 5" TIME: Fri
Mar  5 13:38:25 2010
STATsrv-28589:> Connect -> [138.203.236.96] CMD= "Test 5" TIME: Fri
Mar  5 13:39:15 2010
STATsrv-29172:> Connect -> [138.203.236.96] CMD= "Test 5" TIME: Fri
Mar  5 13:40:05 2010
STATsrv-29531:> Connect -> [138.203.236.96] CMD= "Test 5" TIME: Fri
Mar  5 13:40:55 2010

#psg free
root     25443 25442  0 13:35 pts/6    00:00:00 /usr/bin/free -s 5
root     25833 25832  0 13:35 pts/6    00:00:00 /usr/bin/free -s 5
root     26439 26438  0 13:36 pts/6    00:00:00 /usr/bin/free -s 5
root     27147 27146  0 13:37 pts/6    00:00:00 /usr/bin/free -s 5
root     27848 27847  0 13:38 pts/6    00:00:00 /usr/bin/free -s 5
root     28591 28590  0 13:39 pts/6    00:00:00 /usr/bin/free -s 5
root     29174 29173  0 13:40 pts/6    00:00:00 /usr/bin/free -s 5
root     29533 29532  0 13:40 pts/6    00:00:00 /usr/bin/free -s 5

So it starts every 50 sec a new free process.
What I'm a doing wrong?

Greetings,

Joey


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
(dim)  
View profile  
 More options Mar 5 2010, 8:56 am
From: "(dim)" <dimitrik...@gmail.com>
Date: Fri, 5 Mar 2010 05:56:07 -0800 (PST)
Local: Fri, Mar 5 2010 8:56 am
Subject: Re: Linux free command
Hi Joey,

let's start from the beginning: first of all let's fix your command
printing free output..

1. you set a fixed timeout within your script, so it'll not print data
on a requested interval :-)
2. you pipe the whole output to "awk" which is not flushing your data
by default (to check it you may simply start:
  $ LfreeSTAT.sh | more

and you'll see that even within 1 minute there will be no output :-)
and that's the main problem why you don't see any data :-)

To fix it quickly you may change your script to:

===========================================================
while true
do
/usr/bin/free | /bin/awk ' /[[:digit:]]/ { if ($1 == "Mem:")
 printf("%s %s %s %s %s %s ", $2, $3, $4, $5, $6, $7); if ($1 == "-/
+")
 printf("%s %s ", $3, $4); if ($1 == "Swap:") printf("%s %s %s\n",
$2,
 $3, $4);}'
sleep $1
done
===========================================================

in this case:
  $ LfreeSTAT.sh 10

will really print data every 10 sec. and as awk will be involved on
each iteration the output will be flushed for sure :-)

then if you want to get a more in depth data about memory usage on
your Linux system you may write a script getting data directly from "/
proc/meminfo"

After that I think everything will work for you :-) as well you may
get a look on some debug tips discussed within this thread:
http://groups.google.com/group/dimstat/browse_thread/thread/47df741ed...

Rgds,
-Dimitri

On Mar 5, 1:45 pm, jvan <Joey.Van_de_Ste...@Alcatel-Lucent.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jvan  
View profile  
 More options Mar 5 2010, 9:28 am
From: jvan <Joey.Van_de_Ste...@Alcatel-Lucent.com>
Date: Fri, 5 Mar 2010 06:28:18 -0800 (PST)
Local: Fri, Mar 5 2010 9:28 am
Subject: Re: Linux free command
Hey Dimitri,

This does the job, thanks a lot.

Greetings,

Joey


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
CapPlan  
View profile  
 More options Mar 5 2010, 9:57 am
From: CapPlan <thomasnt...@verizon.net>
Date: Fri, 5 Mar 2010 06:57:42 -0800 (PST)
Local: Fri, Mar 5 2010 9:57 am
Subject: Re: Linux free command
Hi Joey and Dimitri,

I spotted something in this thread and want to ask for clarifications:

Joey mentioned "Changed the access file to include this script and
restart the STATsrv."

- Is this to update the STAT_LIST or is there another reason for
restarting the STATsrv?

- How can a new add-on STAT like this LfreeSTAT.sh be added to an
existing collect using the same collect ID?  I am hoping to be able to
add the new STAT without having to stop an active collect, recycle the
ID then restart the collect with the new STAT.  I want to avoid losing
collected data (or having to save and restore).

Thanks for your input,
Tom


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dimitri  
View profile  
 More options Mar 5 2010, 12:55 pm
From: Dimitri <dimitrik...@gmail.com>
Date: Fri, 5 Mar 2010 18:55:51 +0100
Local: Fri, Mar 5 2010 12:55 pm
Subject: Re: [dim_STAT] Re: Linux free command
Hi Tom,

1. you never need to stop STAT-service :-)  except if you want to
upgrade it to the newer version or simply want to suspend collects for
a while, etc.

2. there is no "normal"  way to add any new STAT into an already
existing collect, as well you don't need to keep the same collect
forever for every server - at any time you may stop an existing
collect, and simply start a new one (with a new ID) including more or
less stats according your needs :-)

But well, as everything is based on scripts too, you may always hack
them to do what you want ;-)  - every time when you're starting a new
collect there is a restart script created automatically.. - it's
called ".restart.{DBNAME}.{CollectID}" and you may find it generally
under "/apps/client". You may edit the file corresponding to your DB
and collect, and change the line containing the list of STATs and add
or remove some of them - so on the next stop/restart you'll see more
or less stats within your collect :-)

Rgds,
-Dimitri

On 3/5/10, CapPlan <thomasnt...@verizon.net> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
CapPlan  
View profile  
 More options Mar 5 2010, 2:09 pm
From: CapPlan <thomasnt...@verizon.net>
Date: Fri, 5 Mar 2010 11:09:25 -0800 (PST)
Local: Fri, Mar 5 2010 2:09 pm
Subject: Re: Linux free command
Hi Dimitri,

I knew there had to be a way :-)

So there are still more undocumented features.. the hidden .restart
files!

Thanks very much for the quick response, this is great!
Tom


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
(dim)  
View profile  
 More options Mar 5 2010, 5:56 pm
From: "(dim)" <dimitrik...@gmail.com>
Date: Fri, 5 Mar 2010 14:56:14 -0800 (PST)
Local: Fri, Mar 5 2010 5:56 pm
Subject: Re: Linux free command
Hi Tom,

I cannot call it "feature" - it's more likely a hack :-)
as well you may hack many things in dim_STAT or do things in different
manner, etc.
For example, historically there are start and stop scripts which are
created on every new collect, and you have an option to start the
collect or just create these scripts (and I wanted already to remove
it, but there are still some users who use these scripts and not
starting collects via web interface :-))

But well, better you know how the tool is working - more confident
you're (at least it's what I think) - so nothing hidden, just ask :-))

Rgds,
-Dimitri

On Mar 5, 8:09 pm, CapPlan <thomasnt...@verizon.net> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jvan  
View profile  
 More options Mar 9 2010, 3:04 am
From: jvan <Joey.Van_de_Ste...@Alcatel-Lucent.com>
Date: Tue, 9 Mar 2010 00:04:46 -0800 (PST)
Local: Tues, Mar 9 2010 3:04 am
Subject: Re: Linux free command
Hi Dimitri,

I have still one more question. I made some changes in the Add-On STAT
description manually(Just another name for 2 columns), then i deleted
the one i was using and restored the changed Add-On. For new collect
this is working fine, but the old collects i have made with the old
Add-On seem to be lost? Is there a way to recover them or are they
lost forever?

Kr,

Joey


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alain Chéreau  
View profile  
 More options Mar 9 2010, 3:32 am
From: Alain Chéreau <cheral...@googlemail.com>
Date: Tue, 9 Mar 2010 09:32:25 +0100
Local: Tues, Mar 9 2010 3:32 am
Subject: Re: [dim_STAT] Re: Linux free command

Hi Joey,

When you create a new Add-On stat, Dimstat create a table
in the MySQL database to store your data.
The list, type and name of columns is defined by your stat description.

When you create a new Add-On stat with the name of an old one,
dimstat drop the old table and create the new one.

If you have not made a backup before, there is no way to get your old data
back.

Regards.

Alain.

2010/3/9 jvan <Joey.Van_de_Ste...@alcatel-lucent.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dimitri  
View profile  
 More options Mar 9 2010, 4:24 am
From: Dimitri <dimitrik...@gmail.com>
Date: Tue, 9 Mar 2010 10:24:51 +0100
Local: Tues, Mar 9 2010 4:24 am
Subject: Re: [dim_STAT] Re: Linux free command
Thanks Alain - it's exactly how it works :-)
Add-On is a high level operation, so every time you create a new
Add-On it'll cleanup all information in the database corresponding to
its name (and drop any corresponding tables too). And as you may see
there is no "Modify" option in web interface - only Add New or Delete
(and Restore is managed as Add New) - so you drop all Add-On data on
every operation (except Save :-)).

Rgds,
-Dimitri

On 3/9/10, Alain Chéreau <cheral...@googlemail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »