LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 09-02-2010, 06:46 AM   #1
babaqga
LQ Newbie
 
Registered: Aug 2010
Posts: 18

Rep: Reputation: 1
TOP problem


Hi guys,
I am new to Linux and I have the following problem:

I have the "top" command and I want to override its default behavior for every user, even for future users.

Writing with "W" in top is not an option as my top command somehow overrides the custom behavior per user and always turns to default behavior.

So, what I am asking for is, are there command line switches that override default behavior of top,
for example:

Code:
top -<BLABLA>
to show me the load average per core
which would be equivalent to starting top first and then pushing the key "1" on the keyboard.

Remember, writing to toprc is not an option for me as top for some reason ignores its config and just goes for default behavior.

Edit: it seems to me this is a bug in the procps package. That is why I updated it to the latest version for my distro
CentOS 5.5 and procps to the following
http://rpm.pbone.net/index.php3/stat...86_64.rpm.html
HOWEVER, it doesn't work even now.

I can't believe that nobody in this forum haven't seen the problem.

Last edited by babaqga; 09-02-2010 at 09:02 AM.
 
Old 09-02-2010, 09:30 AM   #2
lurker79
Member
 
Registered: Jan 2005
Location: UK
Posts: 55

Rep: Reputation: 16
This is potentially a bug in the version of top that you are running.
If it is not reading .toprc from the user's home directory then it could be related to the fix posted upstream at http://procps.cvs.sourceforge.net/vi...1.132&r2=1.134
It is worth filing a bug against centos 5.5
 
Old 09-02-2010, 10:15 AM   #3
babaqga
LQ Newbie
 
Registered: Aug 2010
Posts: 18

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by lurker79 View Post
This is potentially a bug in the version of top that you are running.
If it is not reading .toprc from the user's home directory then it could be related to the fix posted upstream at http://procps.cvs.sourceforge.net/vi...1.132&r2=1.134
It is worth filing a bug against centos 5.5
Already did that, but not with centOS, as it got shipped with an older package of procps that still doesnt' work. I installed the latest rpm
procps-3.2.7-16.el5
but it is the same story. The thing is it works perfectly when called locally by the script, but this same script, when called by the same user using nrpe, doesn't behave correctly. I am not really sure who is to blame.

To summarize:
Top behaves differently when called with the same user respectively from nrpe and from a locally residing script. I assume it SHOULD have the same config (/home/nagios/.toprc) but when called from nrpe, it ignores its home directory and switches to default. Any hints?
 
Old 09-02-2010, 12:06 PM   #4
Soadyheid
Member
 
Registered: Aug 2010
Location: Near Edinburgh, Scotland
Posts: 760

Rep: Reputation: 125Reputation: 125
Quote:
So, what I am asking for is, are there command line switches that override default behavior of top,
Have you tried checking the manual for switches?
Quote:
man top
Play Bonny!
 
Old 09-03-2010, 02:14 AM   #5
babaqga
LQ Newbie
 
Registered: Aug 2010
Posts: 18

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by Soadyheid View Post
Have you tried checking the manual for switches?


Play Bonny!
Are you actually serious with your question?
I hate derogatory remarks.

Did you at least read what I wrote above?
If you did you might wanna check YOUR top man and tell me why it behaves differently WHEN CALLED FROM THE SAME USER, although the /home/<user>/.toprc file exists?!

Is there anyone else who actually read my question?
 
0 members found this post helpful.
Old 09-03-2010, 02:17 AM   #6
djsmiley2k
Member
 
Registered: Feb 2005
Location: Coventry, UK
Distribution: Home: Gentoo x86/amd64, Debian ppc. Work: Ubuntu, SuSe, CentOS
Posts: 343
Blog Entries: 1

Rep: Reputation: 72
Does the script change directory at all?

in the script, before you call top, get it to echo $PWD to see where the script is running.
 
Old 09-03-2010, 02:26 AM   #7
babaqga
LQ Newbie
 
Registered: Aug 2010
Posts: 18

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by djsmiley2k View Post
Does the script change directory at all?

in the script, before you call top, get it to echo $PWD to see where the script is running.
The script does change the directory, as I explained, however, sometimes unpredictably...

Here is the problem:

1. When called locally with user nagios, the script changes the directory as I wish, because it uses the top command for user nagios, which has its configuration file in /home/nagios/.toprc.

2. However, when called from a deamon (nrpe) with the same user (nagios), the script changes the directory in a different way, because top IGNORES its configuration file and switches to default.

P.S I am absolutely sure that the script is called with the same user on both occasions because I straced it, lsof-ed it and what else.


My question is the following: is there anything else besides user name that tells top where to find its config file. In the documentation it says there isn't. If that is so, top sometimes ignores its configuration file and that is a bug.

P.P.S. This was indeed a bug in procps library but in 2006. As far as I see in the bug fixes, this bug was addressed. However, I am with the newest release and it still bugs. Any hints?

P.P.P.S I am now actually even surer, as I made a "whoami" and in both cases the user is nagios. HINTS!?

Last edited by babaqga; 09-03-2010 at 02:33 AM.
 
Old 09-03-2010, 02:36 AM   #8
djsmiley2k
Member
 
Registered: Feb 2005
Location: Coventry, UK
Distribution: Home: Gentoo x86/amd64, Debian ppc. Work: Ubuntu, SuSe, CentOS
Posts: 343
Blog Entries: 1

Rep: Reputation: 72
All I know is I have the same bug in gentoo, with the newest version of top and its something to do with the way it writes out the config file.

However this doesn't explain the behaviour your seeing (as if its accessing two different versions of top
 
Old 09-03-2010, 02:47 AM   #9
babaqga
LQ Newbie
 
Registered: Aug 2010
Posts: 18

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by djsmiley2k View Post
All I know is I have the same bug in gentoo, with the newest version of top and its something to do with the way it writes out the config file.

However this doesn't explain the behaviour your seeing (as if its accessing two different versions of top
Yep, I wrote the guys at procps, but no reply so far.
 
  


Reply

Tags
nagios, nrpe, top


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
High Load Averages on my Forum- whostmgr2 - top ./top ohlookaforum Linux - Server 6 08-09-2010 05:26 PM
LXer: Firebird download statistics : Top Country : Brazil , Top OS: Linux LXer Syndicated Linux News 0 05-31-2010 07:00 AM
LXer: Can You Top This? 15 Practical Linux Top Command Examples LXer Syndicated Linux News 0 01-09-2010 09:42 PM
top problem phoenix_fei Programming 1 02-23-2005 01:53 AM


All times are GMT -5. The time now is 04:29 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration