Xymon Mailing List Archive search

Include full command line in top output

5 messages in this thread

list Mailing Lists · Wed, 11 Apr 2012 13:07:59 -0700 ·
I'd like to change the contents of the CPU test details page to include the full command line in the top output. As I don't have my head wrapped fully around how xymon renders this data, I'm not certain where to start. I've modified the client side to include the -c option but it still looks like the client data is truncating on some default width…

Any help would be appreciated.

--
Michael Hobbs
list Henrik Størner · Wed, 11 Apr 2012 22:37:06 +0200 ·
quoted from Mailing Lists
On 11-04-2012 22:07, Mailing Lists wrote:
I'd like to change the contents of the CPU test details page to
include the full command line in the top output. As I don't have my
head wrapped fully around how xymon renders this data, I'm not
certain where to start. I've modified the client side to include the
-c option but it still looks like the client data is truncating on
some default width…
I don't understand - what command is it that you want displayed ?

If it's the command used to run "top", then the easiest way is to just add this to the content of the "[top]" section of the message that the client generates (see the xymon-4.3.7/client/YOUR-OS.sh scripts). The "[top]" section is copied verbatim into the cpu-status text, without being processed in any way.


Regards,
Henrik
list Mailing Lists · Wed, 11 Apr 2012 15:27:09 -0700 ·
Sorry about that. I should have proofread my original post.

The -c argument to top will show the full command line instead of just the process name. I've made this change to hobbit client-linux.sh as shown below.

 $TOP must be set, the install utility should do that for us if it exists.
if test "$TOP" != ""
then
    if test -x "$TOP"
    then
        echo "[top]"
    $TOP -c -b -n 1
    fi
fi

I do see the beginning of the command line as shown in this before and after client data snapshot. 

BEFORE:
PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND            
24525 tomcat    20   0 2805m 958m  11m S   52  1.0  45:03.00 java  

AFTER:
 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND            
31104 tomcat    20   0 2365m 942m  11m S   39  1.0 380:45.86 /var/jdk6/bin/java


My thought is that top truncates based on terminal width because I see more of the command line when I run top -c manually in a fullscreen terminal. Is there anyway to get a wider column width when running top via the xymon client?

By the way, I am running Xymon 4.3.0-0.20101114.beta3.
quoted from Henrik Størner


On Apr 11, 2012, at 1:37 PM, Henrik Størner wrote:

On 11-04-2012 22:07, Mailing Lists wrote:
I'd like to change the contents of the CPU test details page to
include the full command line in the top output. As I don't have my
head wrapped fully around how xymon renders this data, I'm not
certain where to start. I've modified the client side to include the
-c option but it still looks like the client data is truncating on
some default width…
I don't understand - what command is it that you want displayed ?

If it's the command used to run "top", then the easiest way is to just add this to the content of the "[top]" section of the message that the client generates (see the xymon-4.3.7/client/YOUR-OS.sh scripts). The "[top]" section is copied verbatim into the cpu-status text, without being processed in any way.


Regards,
Henrik
list Jeremy Laidman · Thu, 12 Apr 2012 11:35:53 +1000 ·
On my system I can extend the point where top truncates each line, by
increasing the value of the "COLUMNS" variable.  For example:

  COLUMNS=120 $TOP -c -b -n 1

Unfortunately, this pads out every line to 120 characters with spaces.
 This might not be what you want, because when the spaces wrap, you end up
with blank lines.  But give it a try and see how you like it.  You could
clean up the trailing blanks with a bit if sed-fu like: sed 's/ *$//'

J
quoted from Mailing Lists


On Thu, Apr 12, 2012 at 8:27 AM, Mailing Lists <user-f3d3c1539f43@xymon.invalid>wrote:
Sorry about that. I should have proofread my original post.

The -c argument to top will show the full command line instead of just the
process name. I've made this change to hobbit client-linux.sh as shown
below.

 $TOP must be set, the install utility should do that for us if it exists.
if test "$TOP" != ""
then
   if test -x "$TOP"
   then
       echo "[top]"
   $TOP -c -b -n 1
   fi
fi

I do see the beginning of the command line as shown in this before and
after client data snapshot.

BEFORE:
PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
24525 tomcat    20   0 2805m 958m  11m S   52  1.0  45:03.00 java

AFTER:
 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
31104 tomcat    20   0 2365m 942m  11m S   39  1.0 380:45.86
/var/jdk6/bin/java


My thought is that top truncates based on terminal width because I see
more of the command line when I run top -c manually in a fullscreen
terminal. Is there anyway to get a wider column width when running top via
the xymon client?

By the way, I am running Xymon 4.3.0-0.20101114.beta3.


On Apr 11, 2012, at 1:37 PM, Henrik Størner wrote:

On 11-04-2012 22:07, Mailing Lists wrote:
I'd like to change the contents of the CPU test details page to
include the full command line in the top output. As I don't have my
head wrapped fully around how xymon renders this data, I'm not
certain where to start. I've modified the client side to include the
-c option but it still looks like the client data is truncating on
some default width…
I don't understand - what command is it that you want displayed ?

If it's the command used to run "top", then the easiest way is to just add
this to the content of the "[top]" section of the message that the client
generates (see the xymon-4.3.7/client/YOUR-OS.sh scripts). The "[top]"
section is copied verbatim into the cpu-status text, without being
processed in any way.


Regards,
Henrik

list Mailing Lists · Thu, 12 Apr 2012 07:28:22 -0700 ·
Excellent! That was exactly what I was looking for. Thanks.
quoted from Jeremy Laidman


On Apr 11, 2012, at 6:35 PM, Jeremy Laidman wrote:

On my system I can extend the point where top truncates each line, by increasing the value of the "COLUMNS" variable.  For example:

  COLUMNS=120 $TOP -c -b -n 1

Unfortunately, this pads out every line to 120 characters with spaces.  This might not be what you want, because when the spaces wrap, you end up with blank lines.  But give it a try and see how you like it.  You could clean up the trailing blanks with a bit if sed-fu like: sed 's/ *$//'

J


On Thu, Apr 12, 2012 at 8:27 AM, Mailing Lists <user-f3d3c1539f43@xymon.invalid> wrote:
Sorry about that. I should have proofread my original post.

The -c argument to top will show the full command line instead of just the process name. I've made this change to hobbit client-linux.sh as shown below.

 $TOP must be set, the install utility should do that for us if it exists.
if test "$TOP" != ""
then
   if test -x "$TOP"
   then
       echo "[top]"
   $TOP -c -b -n 1
   fi
fi

I do see the beginning of the command line as shown in this before and after client data snapshot.

BEFORE:
PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
24525 tomcat    20   0 2805m 958m  11m S   52  1.0  45:03.00 java

AFTER:
 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
31104 tomcat    20   0 2365m 942m  11m S   39  1.0 380:45.86 /var/jdk6/bin/java


My thought is that top truncates based on terminal width because I see more of the command line when I run top -c manually in a fullscreen terminal. Is there anyway to get a wider column width when running top via the xymon client?

By the way, I am running Xymon 4.3.0-0.20101114.beta3.


On Apr 11, 2012, at 1:37 PM, Henrik Størner wrote:

On 11-04-2012 22:07, Mailing Lists wrote:
I'd like to change the contents of the CPU test details page to
include the full command line in the top output. As I don't have my
head wrapped fully around how xymon renders this data, I'm not
certain where to start. I've modified the client side to include the
-c option but it still looks like the client data is truncating on
some default width…
I don't understand - what command is it that you want displayed ?

If it's the command used to run "top", then the easiest way is to just add this to the content of the "[top]" section of the message that the client generates (see the xymon-4.3.7/client/YOUR-OS.sh scripts). The "[top]" section is copied verbatim into the cpu-status text, without being processed in any way.


Regards,
Henrik