#!/usr/bin/perl use POSIX; use strict; $|++; # print when we say so; don't wait for a newline. my $version = 20040426; my %opts; process_options(); print_full_usage() if $opts{'--longhelp'}; print_usage() if( !$ARGV[0] || $ARGV[0] =~ /^--?h(elp)?$/i || !($opts{'--fields'} || $opts{'--preset'}) ); my @order = split //, $opts{'--fields'}; my $net_cmd = '/sbin/ifconfig eth0|grep "RX bytes"'; my $cpu_ut_cmd = 'cat /proc/stat'; my $load_cmd = 'uptime'; my $mem_cmd = 'cat /proc/meminfo'; my ($rx, $tx, $rx_last, $tx_last); my ($rxfill, $txfill, $rxstring, $txstring, $ampm, $colon); my ($mem_used_percent, $swap_used_percent, $memstring, $swapstring); my ($cpu_idle_time_last, $cpu_ut, $cpustring, $load, $loadstring); my ($date, $label, $padding_length); my ($output_string, $output_padding); # First time through (before we enter the main loop), manually perform # one iteration so that the _last values are sane, and the first line # of output makes sense. ($rx, $tx) = get_net_data(); $cpu_idle_time_last = get_cpu_idle_time(); while(1) { sleep 1; $output_string = ''; ($rx, $tx) = get_net_data() if $opts{'--fields'} =~ /r|t/; ($mem_used_percent, $swap_used_percent) = get_mem_data() if $opts{'--fields'} =~ /m|s/; $colon = ($opts{'--blink-colons'} && $colon eq $opts{'--colon-char'}) ? ' ' : $opts{'--colon-char'}; # Create output string in order requested: for(@order) { if(/r/) { $label = $opts{'--align-labels'} ? "RX$opts{'--spacer-char'}$opts{'--spacer-char'}" : 'RX'; $rxstring = create_graph($label, $opts{'--rx-unit'}, $colon, $opts{'--max-rx-value'}, $rx, $opts{'--rx-graph-width'}, $opts{'--graph-filled-char'}, $opts{'--graph-blank-char'}, 1, $opts{'--rx-field-width'}, $opts{'--spacer-char'}); $output_string .= $rxstring . $opts{'--spaces-after-rx'}; } elsif(/t/) { $label = $opts{'--align-labels'} ? "TX$opts{'--spacer-char'}$opts{'--spacer-char'}" : 'TX'; $txstring = create_graph($label, $opts{'--tx-unit'}, $colon, $opts{'--max-tx-value'}, $tx, $opts{'--tx-graph-width'}, $opts{'--graph-filled-char'}, $opts{'--graph-blank-char'}, 1, $opts{'--tx-field-width'}, $opts{'--spacer-char'}); $output_string .= $txstring . $opts{'--spaces-after-tx'}; } elsif(/c/) { $cpu_ut = get_cpu_data(); $label = $opts{'--align-labels'} ? "CPU$opts{'--spacer-char'}" : 'CPU'; $cpustring = create_graph($label, '%', $colon, 100, $cpu_ut, $opts{'--cpu-graph-width'}, $opts{'--graph-filled-char'}, $opts{'--graph-blank-char'}, 1, $opts{'--cpu-field-width'}, $opts{'--spacer-char'}); $output_string .= $cpustring . $opts{'--spaces-after-cpu'}; } elsif(/l/) { $load = get_load_data(); $label = 'Load'; # because 4 is the longest label already. $loadstring = create_graph($label, '', $colon, $opts{'--load-max-value'}, $load, $opts{'--load-graph-width'}, $opts{'--graph-filled-char'}, $opts{'--graph-blank-char'}, 1, $opts{'--load-field-width'}, $opts{'--spacer-char'}); $output_string .= $loadstring . $opts{'--spaces-after-load'}; } elsif(/m/) { $label = $opts{'--align-labels'} ? "RAM$opts{'--spacer-char'}" : 'RAM'; $memstring = create_graph($label, '%', $colon, 100, $mem_used_percent, $opts{'--mem-graph-width'}, $opts{'--graph-filled-char'}, $opts{'--graph-blank-char'}, 1, $opts{'--mem-field-width'}, $opts{'--spacer-char'}); $output_string .= $memstring . $opts{'--spaces-after-mem'}; } elsif(/s/) { $label = 'Swap'; # because 4 is the longest label already. $swapstring = create_graph($label, '%', $colon, 100, $swap_used_percent, $opts{'--swap-graph-width'}, $opts{'--graph-filled-char'}, $opts{'--graph-blank-char'}, 1, $opts{'--swap-field-width'}, $opts{'--spacer-char'}); $output_string .= $swapstring . $opts{'--spaces-after-swap'}; } elsif(/d/) { $date = strftime($opts{'--date-format'},localtime); $output_string .= $date . $opts{'--spaces-after-date'}; } } # Print output: print "\n" unless $opts{'--no-newlines'}; $output_string =~ s/\s+$// unless $opts{'--keep-trailing-spaces'}; $padding_length = $opts{'--total-width'} - length($output_string) if $opts{'--total-width'}; # If the user has specified a --total-width then we pad the output string to that width. # By default we split the padding to center the string, but that can be overridden with # either --align-right or --align-left. if($opts{'--align-right'}) { print ' ' x $padding_length; } else { print ' ' x ($padding_length / 2) unless ($opts{'--nopadding'} || $opts{'--use-newline-for-spacer'} || $opts{'--align-left'}); } print $output_string; if($opts{'--align-left'}) { print ' ' x $padding_length; } else { print ' ' x ($padding_length / 2) unless ($opts{'--nopadding'} || $opts{'--use-newline-for-spacer'} || $opts{'--align-right'}); } # If we're centering the output (aka, not aligning left or right), and the padding_length # is an odd number, then we've only printed padding_length-1 so far. Add the final space. if( !$opts{'--align-right'} && !$opts{'--align-left'} && ($padding_length % 2) ) { print ' '; } } # Pass a zero for graphsize to disable the graph. sub create_graph($$$$$$$$$$$) { my ($label,$unit,$colon,$maxval,$actualval,$graphsize,$graphchar,$graphblankchar,$usebrackets,$fieldsize,$fieldblankchar) = @_; my $utilization = $actualval / $maxval; if($actualval > $maxval) { # some kind of error occurred, most likely we spent >1sec sleeping or working # during the previous loop... $utilization = 1; $actualval = '!'; } $utilization *= $graphsize; $utilization = sprintf("%.0f",$utilization); # really rounds; doesn't truncate my ($startbracket,$endbracket) = ('[',']') if $usebrackets; my $retval = $label . $colon; $retval .= $startbracket . $graphchar x $utilization . $graphblankchar x ($graphsize - $utilization) . $endbracket if $graphsize; $retval .= $fieldblankchar x ($fieldsize - length($actualval)) . $actualval . $unit; } sub get_mem_data { my @mem_output = `$mem_cmd`; my ($mem_tot) = ($mem_output[0] =~ /(\d+)/); my ($mem_free) = ($mem_output[1] =~ /(\d+)/); my $mem_used_percent = sprintf("%.0f",($mem_tot - $mem_free) / $mem_tot * 100) if $mem_tot; my ($swap_tot) = ($mem_output[11] =~ /(\d+)/); my ($swap_free) = ($mem_output[12] =~ /(\d+)/); my $swap_used_percent = sprintf("%.0f",($swap_tot - $swap_free) / $swap_tot * 100) if $swap_tot; return ($mem_used_percent, $swap_used_percent); } sub get_net_data { my $net_output = `$net_cmd`; my ($rx_total, $tx_total) = ($net_output =~ /RX bytes:(\d+).+TX bytes:(\d+)/); my $rx = $rx_total - $rx_last; my $tx = $tx_total - $tx_last; $rx_last = $rx_total; $tx_last = $tx_total; if ($opts{'--rx-unit'} eq 'KB') { $rx /= 1024; } elsif($opts{'--rx-unit'} eq 'MB') { $rx /= 1024*1024; } elsif($opts{'--rx-unit'} eq 'Kb') { $rx *= 8/1024; } elsif($opts{'--rx-unit'} eq 'Mb') { $rx *= 8/(1024*1024); } elsif($opts{'--rx-unit'} eq 'b' ) { $rx *= 8; } if ($opts{'--tx-unit'} eq 'KB') { $tx /= 1024; } elsif($opts{'--tx-unit'} eq 'MB') { $tx /= 1024*1024; } elsif($opts{'--tx-unit'} eq 'Kb') { $tx *= 8/1024; } elsif($opts{'--tx-unit'} eq 'Mb') { $tx *= 8/(1024*1024); } elsif($opts{'--tx-unit'} eq 'b' ) { $tx *= 8; } for($rx,$tx) { #s/(\.\d{$opts{'--net-decimal-places'}}).+/$1/; #s/\.$//; # leftover decimal if they asked for 0 places. #$_ .= '.' . '0' x $opts{'--net-decimal-places'} unless $_; $_ = sprintf("%.$opts{'--net-decimal-places'}f",$_); } return ($rx, $tx); } sub get_load_data { my $load_output = `$load_cmd`; my ($load) = ($load_output =~ /load average: \S+, (\S+), \S+/); return $load; } sub get_cpu_idle_time { my @cpu_ut_output = `$cpu_ut_cmd`; my @words = split /\s+/, $cpu_ut_output[0]; return $words[4]; } sub get_cpu_data { my $cpu_idle_time = get_cpu_idle_time(); my $cpu_ut = 100 - ($cpu_idle_time - $cpu_idle_time_last); $cpu_idle_time_last = $cpu_idle_time; return $cpu_ut; } sub process_options { ###################################################################### # Set some defaults; overridden if specified on command line. ###################################################################### $opts{'--rx-field-width'} = 5; $opts{'--tx-field-width'} = 5; $opts{'--cpu-field-width'} = 3; $opts{'--load-field-width'} = 5; $opts{'--mem-field-width'} = 3; $opts{'--swap-field-width'} = 3; $opts{'--spacer-char'} = ' '; $opts{'--colon-char'} = ':'; $opts{'--rx-graph-width'} = 8; $opts{'--tx-graph-width'} = 8; $opts{'--load-graph-width'} = 8; $opts{'--cpu-graph-width'} = 10; $opts{'--mem-graph-width'} = 10; $opts{'--swap-graph-width'} = 10; $opts{'--graph-blank-char'} = '-'; $opts{'--graph-filled-char'} = '#'; $opts{'--spacer-size'} = 3; $opts{'--total-width'} = 0; $opts{'--max-rx-value'} = 400; $opts{'--max-tx-value'} = 64; $opts{'--rx-unit'} = 'KB'; $opts{'--tx-unit'} = 'KB'; $opts{'--net-decimal-places'} = 0; $opts{'--date-format'} = '%a %b %d / %H:%M'; $opts{'--load-max-value'} = 8; ###################################################################### # Apply user-specified presets; individual options will still be # overridden below if specified explicitly: ###################################################################### my $i = 0; for(@ARGV) { # only extract the presets here. $opts{$_} = 1; if(/--preset/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--global-graph-width/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } $i++; } if($opts{'--global-graph-width'}) { $opts{'--rx-graph-width'} = $opts{'--global-graph-width'}; $opts{'--tx-graph-width'} = $opts{'--global-graph-width'}; $opts{'--cpu-graph-width'} = $opts{'--global-graph-width'}; $opts{'--load-graph-width'} = $opts{'--global-graph-width'}; $opts{'--mem-graph-width'} = $opts{'--global-graph-width'}; $opts{'--swap-graph-width'} = $opts{'--global-graph-width'}; } if($opts{'--preset'} eq 'log') { $opts{'--fields'} = 'dclmstr'; $opts{'--date-format'} = '%Y%m%d-%H%M%S'; $opts{'--spacer-size'} = 1; } elsif($opts{'--preset'} eq 'one-per-line') { $opts{'--use-newline-for-spacer'} = 1; $opts{'--align-labels'} = 1; $opts{'--cpu-field-width'} = 6; $opts{'--mem-field-width'} = 6; $opts{'--swap-field-width'} = 6; $opts{'--load-field-width'} = 7; unless($opts{'--show-graphs'}) { $opts{'--spacer-char'} = '.'; $opts{'--colon-char'} = '.'; } } elsif($opts{'--preset'} eq 'ant-full') { $opts{'--fields'} = 'clmsrtd'; $opts{'--no-newlines'} = 1; $opts{'--spacer-size'} = 12; $opts{'--total-width'} = 212; $opts{'--show-graphs'} = 1; $opts{'--spaces-after-tx'} = 11; } elsif($opts{'--preset'} eq 'ant-half') { $opts{'--fields'} = 'clmsrtd'; $opts{'--no-newlines'} = 1; $opts{'--spacer-size'} = 4; $opts{'--total-width'} = 212; $opts{'--show-graphs'} = 1; $opts{'--spacer-size'} = 4; $opts{'--rx-graph-width'} = 5; $opts{'--tx-graph-width'} = 5; $opts{'--cpu-graph-width'} = 5; $opts{'--load-graph-width'} = 5; $opts{'--mem-graph-width'} = 0; $opts{'--swap-graph-width'} = 0; $opts{'--rx-field-width'} = 4; $opts{'--tx-field-width'} = 4; $opts{'--align-right'} = 1; } # This one is for my fvwm config that uses two separate fvwmbutton bars # along the bottom, that just appear to be one bar. elsif($opts{'--preset'} eq 'ant-half-test') { $opts{'--fields'} = 'clmsrtd'; $opts{'--no-newlines'} = 1; $opts{'--spacer-size'} = 4; #$opts{'--total-width'} = 212; $opts{'--total-width'} = 125; $opts{'--show-graphs'} = 1; $opts{'--spacer-size'} = 4; $opts{'--rx-graph-width'} = 5; $opts{'--tx-graph-width'} = 5; $opts{'--cpu-graph-width'} = 5; $opts{'--load-graph-width'} = 5; $opts{'--mem-graph-width'} = 0; $opts{'--swap-graph-width'} = 0; $opts{'--rx-field-width'} = 4; $opts{'--tx-field-width'} = 4; $opts{'--align-right'} = 1; } unless($opts{'--show-graphs'}) { $opts{'--rx-graph-width'} = 0; $opts{'--tx-graph-width'} = 0; $opts{'--cpu-graph-width'} = 0; $opts{'--load-graph-width'} = 0; $opts{'--mem-graph-width'} = 0; $opts{'--swap-graph-width'} = 0; } ###################################################################### # Apply user's options. ###################################################################### $i = 0; for(@ARGV) { $opts{$_} = 1; if(/--fields/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--rx-field-width/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--tx-field-width/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--cpu-field-width/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--load-field-width/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--mem-field-width/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--swap-field-width/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--spacer-char/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--colon-char/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--rx-graph-width/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--tx-graph-width/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--cpu-graph-width/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--load-graph-width/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--mem-graph-width/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--swap-graph-width/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--graph-blank-char/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--graph-filled-char/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--spacer-size/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--total-width/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--max-rx-value/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--max-tx-value/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--rx-unit/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--tx-unit/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--net-decimal-places/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--date-format/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--load-max-value/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--spaces-after-cpu/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--spaces-after-load/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--spaces-after-tx/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--spaces-after-rx/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--spaces-after-mem/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--spaces-after-swap/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } if(/--spaces-after-date/) { $opts{$_} = $ARGV[$i+1]; $opts{$ARGV[$i+1]} = ''; } $i++; # Some options need to be mutually exclusive, so make sure the last one undoes any # earlier ones. if(/--align-left/) { $opts{'--align-right'} = 0; } if(/--align-right/) { $opts{'--align-left'} = 0; } } ###################################################################### # This needs to happen last because --spaces-after-foo is initially a # number, and it gets turned into space-times-that-number (or into a # single newline). ###################################################################### my $spacer = $opts{'--use-newline-for-spacer'} ? "\n" : ' ' x $opts{'--spacer-size'}; $opts{'--spaces-after-cpu'} = $opts{'--spaces-after-cpu'} ? ' ' x $opts{'--spaces-after-cpu'} : $spacer; $opts{'--spaces-after-load'} = $opts{'--spaces-after-load'} ? ' ' x $opts{'--spaces-after-load'} : $spacer; $opts{'--spaces-after-tx'} = $opts{'--spaces-after-tx'} ? ' ' x $opts{'--spaces-after-tx'} : $spacer; $opts{'--spaces-after-rx'} = $opts{'--spaces-after-rx'} ? ' ' x $opts{'--spaces-after-rx'} : $spacer; $opts{'--spaces-after-mem'} = $opts{'--spaces-after-mem'} ? ' ' x $opts{'--spaces-after-mem'} : $spacer; $opts{'--spaces-after-swap'} = $opts{'--spaces-after-swap'} ? ' ' x $opts{'--spaces-after-swap'} : $spacer; $opts{'--spaces-after-date'} = $opts{'--spaces-after-date'} ? ' ' x $opts{'--spaces-after-date'} : $spacer; } sub print_full_usage { print qq`------------------------------------------------------------------------------ Overview -------- antsysmon, by Anthony DiSante, http://nodivisions.com/software/antsysmon/ antsysmon is a highly configurable system monitor for GNU/Linux systems. It is text-based, but it can display "graphs" made of text. It can show any or all of: system load average current utilization of CPU, RAM, swap, network (with independent TX/RX) current date/time It runs forever and updates once per second. It is designed to be used within a terminal (probably swallowed by a window-manager module) that is sized to only show one line of output, so that each new line seamlessly replaces the last one, and only the values/graphs will appear to change. There is just one mandatory argument: either --fields or --preset. The --fields argument can accept any/all of: c CPU l load m memory (RAM) s swap t transmitted network data rate r received network data rate d date/time So "antsysmon --fields dlm" will display the date, load, and memory usage, in that order. There are currently a few presets you can use: "antsysmon --preset log" fits everything into 76 columns: 20040426-073858 CPU: 10% Load: 0.24 RAM: 76% Swap: 0% TX: 31KB RX: 93KB "antsysmon --fields lcmstr --preset one-per-line" looks like this: with --show-graphs: without --show-graphs: Load:[----------] 0.37 Load....0.34 CPU :[##########] 97% CPU.....100% RAM :[########--] 77% RAM......82% Swap:[----------] 0% Swap......0% TX :[####------] 12KB TX.......4KB RX :[#---------] 29KB RX.....138KB Then there are two presets called ant-full and ant-half that fit nicely along a single line at the bottom of my 1280x1024 screen, looking something like this (truncated here): RAM: 80% Swap: 0% RX:[#----] 49KB TX:[##---] 13KB Mon Apr 26 / 07:51 If you are going to use the network TX or RX fields, you'll at least want to set the --max-tx-value and --max-rx-value fields, so that the graphs display something meaningful for your connection. (They default to 400 RX and 32 TX, for my cable connection; the values are in KB by default.) ------------------------------------------------------------------------------ Options ------- Here is the full option list. Remember, you need to use at least --fields or --preset. If you use other options at the same time as --preset, the other options will take precedence. --fields [clmsrtd] --preset --show-graphs By default, graphs are not displayed. Field widths: the max number of chars that a given value will take up. For example, in "TX:[##---] 7KB" the --tx-field-width is set to 3, and the seven is currently only using one of those 3 slots. The other two are filled with --spacer-char which defaults to an actual space. (Note that the unit KB is not part of the field width.) --rx-field-width --tx-field-width --cpu-field-width --load-field-width --mem-field-width --swap-field-width --spacer-char This is what fills any unused field width --colon-char This comes after the label, as in "TX:" --blink-colons Replace the colon with a space every-other-second Graph widths: the number of chars in the graph, not counting the brackets. You can set them all at once by setting --global-graph-width instead; then you can override individual ones if you want. --rx-graph-width --tx-graph-width --cpu-graph-width --load-graph-width --mem-graph-width --swap-graph-width --graph-blank-char Defaults to - --graph-filled-char Defaults to # --spacer-size The number of spaces between the displayed stats --total-width Define this if you want the output padded to a specific length; it's centered by default if so --align-left Use with --total-width if you don't want centered output --align-right Use with --total-width if you don't want centered output --use-newline-for-spacer Puts newlines instead of spaces between the stats --align-labels Useful with --use-newline-for-spacer to make the labels ("CPU", "Swap", "RX", etc) and graphs line up vertically. Preset one-per-line includes this. --spaces-after-foo: these all default to --spacer-size (or to a newline if --use-newline-for-spacer is set) but can be overridden individually. I usually only use these if the length of my output is one or two chars shorter than I want my --total-width to be; in that case, I just pick some random one of these and add one or two to it. --spaces-after-cpu --spaces-after-load --spaces-after-tx --spaces-after-rx --spaces-after-mem --spaces-after-swap --spaces-after-date For the network data rate graphs to make sense, they need to know what the maximum possible value is. For example, my cable connection can transmit at 32KB per second max, and receive at about 400KB per second max. The unit is whatever you specify for --rx-unit or --tx-unit. --max-rx-value Some number --max-tx-value Some (probably different) number --rx-unit KB (default), Kb, MB, Mb, B, or b (B=bytes, b=bits) --tx-unit KB (default), Kb, MB, Mb, B, or b (B=bytes, b=bits) --net-decimal-places Defaults to zero --date-format Defaults to "%a %b %d / %H:%M" see man strftime --load-max-value Defaults to 8 ------------------------------------------------------------------------------ Bugs ---- The terminals that I use (aterm, xterm) don't seem to let you turn off the displaying of the cursor. And in order to make the output be the full width of your screen AND on a single line, the cursor apparently needs to overlap the last character in the line. aterm lets me use -cr to define the color of the cursor, and since the cursor is just a hollow rectangle when the terminal doesn't have focus, I can just set the cursor color the same as the background color. The result is that a few pixels of the final character on the line get overwritten by the edge of the cursor. It's a very small issue and isn't even noticable on most characters, but it's sort of annoying knowing I can't just turn off the cursor. Of course the workaround is to simply make the final char in the line be a space or a period or something. ------------------------------------------------------------------------------ Contact ------- For help, etc: Anthony DiSante: orders\@nodivisions.com http://nodivisions.com/software/antsysmon/ `; exit; } sub print_usage { print qq`antsysmon, version $version. by Anthony DiSante, http://nodivisions.com/software/antsysmon/ email: orders\@nodivisions.com Usage: antsysmon --longhelp - for full option list antsysmon --fields [clmsrtd] - use any/all of these fields antsysmon --preset log - fits everything into 76 columns antsysmon --preset ant-half - single-line output antsysmon --preset ant-full - single-line output, full width of my monitor antsysmon --preset one-per-line - multi-line output If not using a preset, you must use --fields, and you probably at least want to define these: --show-graphs - if you want --max-rx-value - define these to some numbers, because otherwise the --max-tx-value - graphs won't really make any sense (in KB by default) --total-width - pad the output string to some total width; useful if you're also using --no-newlines and running within a window with a fixed width (equal to --total-width characters) `; exit; }