This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

[9.006-5] swap usage results

.
.
Script developed by Anonymous, automation by BAlfson:

How to grab theres stats very easy...Login as root and then copy and paste the following blocks of commands:

wget www.mediasoftusa.com/swapusage
md5sum swapusage

The result should be: 0ed29febd7d70393b43d7a86e92e257c

If that's correct, continue with:
mv swapusage swap-usage.pl
chmod u+x swap-usage.pl
./swap-usage.pl
free -m
uptime
version


#!/usr/bin/perl
use warnings;
use strict;

my $overall = 0;
my %out = ();

opendir(my $dh, '/proc/') || die "Can't open /proc: $!";
my @pids = grep { -d "/proc/".$_ && /^[0-9]+$/} readdir($dh);
closedir($dh);
foreach my $pid (@pids) {
    my $sum = 0;
    next unless -d "/proc/$pid";
    print ".";
    foreach my $swap ( `grep Swap /proc/$pid/smaps 2>/dev/null` ){
        next unless $swap;
        $swap = (split(/\s+/,$swap))[-2];
        $sum += $swap;
        $overall += $swap;
    }

    my $progname = `ps -p $pid  -o comm --no-headers`;
    chomp($progname);
    $sum = t($sum);
    $out{$pid} = [$progname,$sum] unless $sum == 0;
}
$overall = t($overall);
my $total = t(`grep SwapTotal /proc/meminfo`);
print "\nSwapTotal: $total MB\n";
print "SwapUsed:   $overall MB\n";
print "========================================\n";
print "MB\t%\tPID\tprocess\n";
foreach my $pid ( sort{ $out{$b}[1]  $out{$a}[1] } keys(%out) ) {
  print $out{$pid}[1]."\t".p($total,$out{$pid}[1])."\t".$pid."\t".$out{$pid}[0]."\n";
}

sub t {
    my $x = shift;
    $x = (split(/\s+/,$x))[-2] if $x =~ /\s/;
    sprintf("%.1f",$x/1024);
}

sub p {
    my $total = shift;
    my $x = shift;
    return sprintf("%.1f",100*$x/$total);
}


Here's my output:


SwapTotal: 1024.0 MB
SwapUsed:   358.6 MB
========================================
MB      %       PID     process
125.8   12.3    6813    snort_inline
52.3    5.1     5787    afcd
32.0    3.1     7548    snort_inline
23.8    2.3     3513    confd.plx
17.7    1.7     28339   index.plx
16.2    1.6     23224   confd.plx
15.5    1.5     16384   confd.plx
15.4    1.5     5659    screenmgr.plx
13.6    1.3     5711    httpproxy
11.8    1.2     3159    confd.plx
6.6     0.6     4060    mdw.plx
5.9     0.6     4135    selfmonng.plx
5.7     0.6     3286    aua.bin
3.7     0.4     3508    notifier.plx
2.7     0.3     4103    selfmonng.plx
1.8     0.2     3237    sysmond
1.3     0.1     3190    confd-qrunner.p
0.9     0.1     5377    named
0.7     0.1     3090    irqd
0.6     0.1     5724    ctasd
0.6     0.1     5709    ctipd.bin
0.3     0.0     6048    master
0.2     0.0     3550    rrdcached
0.2     0.0     2335    udevd
0.2     0.0     5435    sshd
0.2     0.0     31050   awed
0.2     0.0     1474    udevd
0.2     0.0     31027   awed
0.2     0.0     3054    hald-addon-inpu
0.2     0.0     3070    hald-addon-acpi
0.2     0.0     5719    ctasd
0.2     0.0     1473    udevd
0.1     0.0     2784    dbus-daemon
0.1     0.0     5693    frox
0.1     0.0     1       init
0.1     0.0     8730    smtpd.bin
0.1     0.0     3287    logger
0.1     0.0     5136    ipv6_watchdog
0.1     0.0     4130    mingetty
0.1     0.0     3032    hald
0.1     0.0     4129    mingetty
0.1     0.0     6811    argos
0.1     0.0     3104    lcm-162
0.1     0.0     3118    haveged
0.1     0.0     3579    atd
0.1     0.0     4131    mingetty
0.1     0.0     2768    acpid
0.1     0.0     4133    mingetty
0.1     0.0     4128    mingetty
0.1     0.0     4132    mingetty



 astaro:/tmp # free -m
             total       used       free     shared    buffers     cached
Mem:          7957       7711        246          0        249       4155
-/+ buffers/cache:       3307       4650
Swap:         1023        321        702



 astaro:/tmp # uptime
 15:02pm  up 12 days 12:58,  1 user,  load average: 3.11, 3.46, 3.31



 astaro:/tmp # version

Current software version...: 9.006005
Hardware type..............: 320C
Serial number..............:
Installation image.........: 9.004-33.1
Installation type..........: ssi
Installed pattern version..: 44684
Downloaded pattern version.: 44684
Up2Dates applied...........: 4 (see below)
                             sys-9.004-9.004-33.34.1.tgz (Jan 31 14:19)
                             sys-9.004-9.005-29.15.2.tgz (Feb 13 07:57)
                             sys-9.005-9.005-15.16.1.tgz (Mar  7 02:05)
                             sys-9.005-9.006-15.5.2.tgz (Apr  6 02:01)
Up2Dates available.........: 0
Factory resets.............: 0
Timewarps detected.........: 0


This thread was automatically locked due to age.
Parents
  • USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
    root         2  0.0  0.0      0     0 ?        S    Apr18   0:00 [kthreadd]
    root         3  0.0  0.0      0     0 ?        S    Apr18   0:02  \_ [ksoftirqd/0]
    root         5  0.0  0.0      0     0 ?        S    Apr18   0:00  \_ [kworker/u:0]
    root         6  0.0  0.0      0     0 ?        S    Apr18   0:00  \_ [migration/0]
    root         7  0.0  0.0      0     0 ?        S    Apr18   0:00  \_ [migration/1]
    root         9  0.0  0.0      0     0 ?        S    Apr18   0:01  \_ [ksoftirqd/1]
    root        11  0.0  0.0      0     0 ?        S
    root      3290  0.0  0.1  13864  3908 ?        S    Apr18   0:00 /usr/local/bin/notifier.plx -d
    rrdcache  3321  0.0  0.0 116836  1056 ?        Ssl  Apr18   1:39 /usr/bin/rrdcached -l unix:/var/run/rrdcached/socket -m 777 -b /var
    at        3341  0.0  0.0   2344   276 ?        Ss   Apr18   0:00 /usr/sbin/atd
    postgres  3462  0.0  0.1  46832  4996 ?        S    Apr18   0:22 /usr/pgsql84/bin/postgres -D /var/storage/pgsql/data
    postgres  3464  0.0  1.1  46832 34488 ?        Ss   Apr18   0:39  \_ postgres: writer process                            
    postgres  3465  0.0  0.0  46832  1004 ?        Ss   Apr18   0:37  \_ postgres: wal writer process                        
    postgres  3466  0.0  0.0  47104  1328 ?        Ss   Apr18   0:24  \_ postgres: autovacuum launcher process               
    postgres  3467  0.0  0.0   7432  1088 ?        Ss   Apr18   0:21  \_ postgres: stats collector process                   
    postgres  4168  0.0  1.1  49700 36664 ?        Ss   Apr18   1:38  \_ postgres: reporting reporting [local] idle          
    postgres  4853  0.0  0.6  49676 21328 ?        Ss   Apr18   0:04  \_ postgres: postgres smtp 127.0.0.1(38023) idle       
    postgres  5479  0.1  0.3  49312 12172 ?        Ss   01:15   1:21  \_ postgres: postgres smtp 127.0.0.1(50514) idle       
    root      3524  0.0  0.9  77440 30228 ?        S    Apr18   0:08 /var/mdw/mdw.plx
    root      3573  0.0  0.0   1892   484 ?        S    Apr18   0:00  \_ logger -p daemon.debug -t middleware[3524]
    root      3812  0.0  0.0   2944    40 ?        Ss   Apr18   0:00  \_ /bin/bash /bin/DHCPC.sh eth1
    root      4292  0.0  0.0   2608   216 ?        S    Apr18   0:00      \_ /usr/sbin/dhclient -d -cf /etc/eth1.conf -lf /var/db/eth1.l
    root      3569  0.6  0.1  11544  5192 ?        S    Apr18  19:39 /usr/local/bin/selfmonng.plx
    root      3589  0.0  0.0  11184  1844 ?        S    Apr18   0:00  \_ [timewarp check]
    root      3581  0.0  0.0   1888   500 ?        Ss   Apr18   0:18 /usr/local/bin/daemon-watcher selfmonng.plx /usr/local/bin/selfmonn
    root      3582  0.0  0.0   2416   632 tty1     Ss+  Apr18   0:00 /sbin/mingetty --noclear --no-hostname tty1
    root      3583  0.0  0.0   2416   632 tty2     Ss+  Apr18   0:00 /sbin/mingetty --no-hostname tty2
    root      3584  0.0  0.0   2416   628 tty3     Ss+  Apr18   0:00 /sbin/mingetty --no-hostname tty3
    root      3585  0.0  0.0   2416   628 tty4     Ss+  Apr18   0:00 /sbin/mingetty --no-hostname tty4
    root      3907  0.0  0.1   9324  5552 ?        Ss   Apr18   0:32 dns-resolver.plx
    root      3942  0.0  0.0   2364   784 ?        Ss   Apr18   0:00 /usr/sbin/cron
    root      3959  0.0  0.0   4820   776 ?        Ss   Apr18   0:00 /usr/sbin/sshd -f /etc/ssh/sshd_config
    root      3025  0.0  0.0   7408  1408 ?        Ss   14:15   0:00  \_ sshd: loginuser [priv]                   
    100       3054  0.1  0.0   7544  1156 ?        S    14:15   0:18      \_ sshd: loginuser@pts/0                    
    100       3071  0.0  0.0   5036  1828 pts/0    Ss   14:15   0:00          \_ -bash
    root      3105  0.0  0.0   4572  1272 pts/0    S    14:16   0:00              \_ su -
    root      3130  0.0  0.0   5040  1956 pts/0    S    14:16   0:00                  \_ -bash
    root      5234  0.9  0.0   2696  1124 pts/0    S+   18:55   0:00                      \_ top
    sockd     4019  0.0  0.0   6824     4 ?        Ss   Apr18   0:00 /bin/sockd -D
    sockd     4022  0.0  0.0   6824     4 ?        S    Apr18   0:00  \_ sockd: negot 
    sockd     4023  0.0  0.0   6824     0 ?        S    Apr18   0:00  \_ sockd: reque 
    sockd     4024  0.0  0.0   6824     0 ?        S    Apr18   0:00  \_ sockd: reque 
    sockd     4026  0.0  0.0   6824     0 ?        S    Apr18   0:00  \_ sockd: reque 
    sockd     4027  0.0  0.0   6824     0 ?        S    Apr18   0:00  \_ sockd: reque 
    sockd     4028  0.0  0.0   6824     0 ?        S    Apr18   0:00  \_ sockd: iorel 
    root      4068  0.0  0.0   7976  3084 ?        Ss   Apr18   0:47 /usr/sbin/named -4
    root      4105  0.0  0.0   8612  1800 ?        Ss   Apr18   0:06 /bin/httpd -f /etc/httpd/httpd.conf
    root      4107  0.0  0.0   1892    64 ?        S    Apr18   0:00  \_ /bin/logger -t httpd -p local6.notice
    wwwrun    4109  0.0  0.0   8548   672 ?        S    Apr18   0:00  \_ /bin/httpd -f /etc/httpd/httpd.conf
    wwwrun   10302  0.0  0.0  34544  1944 ?        S    Apr19   0:01  |   \_ /var/jape/index.plx
    wwwrun    5366 16.8  1.9  62524 60204 ?        S    18:57   0:03  |   \_ /var/webadmin/webadmin.plx
    wwwrun    5405 37.1  1.6  52092 49800 ?        S    18:57   0:01  |   \_ /var/webadmin/webadmin.plx
    wwwrun    6090  0.0  0.0   9140  2944 ?        S    14:30   0:00  \_ /bin/httpd -f /etc/httpd/httpd.conf
    wwwrun    5368  0.2  0.0   9184  2948 ?        S    18:57   0:00  \_ /bin/httpd -f /etc/httpd/httpd.conf
    wwwrun    5370  0.9  0.0   9076  3000 ?        S    18:57   0:00  \_ /bin/httpd -f /etc/httpd/httpd.conf
    wwwrun    5400  0.0  0.0   8880  2708 ?        S    18:57   0:00  \_ /bin/httpd -f /etc/httpd/httpd.conf
    wwwrun    5402  0.0  0.0   8752  2416 ?        S    18:57   0:00  \_ /bin/httpd -f /etc/httpd/httpd.conf
    wwwrun    5404  0.0  0.0   8752  2424 ?        S    18:57   0:00  \_ /bin/httpd -f /etc/httpd/httpd.conf
    wwwrun    5408  0.0  0.0   8612  1000 ?        S    18:57   0:00  \_ /bin/httpd -f /etc/httpd/httpd.conf
    wwwrun    5409  0.0  0.0   8752  2008 ?        S    18:57   0:00  \_ /bin/httpd -f /etc/httpd/httpd.conf
    root      4166  0.0  0.0   4424  1552 ?        S
Reply
  • USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
    root         2  0.0  0.0      0     0 ?        S    Apr18   0:00 [kthreadd]
    root         3  0.0  0.0      0     0 ?        S    Apr18   0:02  \_ [ksoftirqd/0]
    root         5  0.0  0.0      0     0 ?        S    Apr18   0:00  \_ [kworker/u:0]
    root         6  0.0  0.0      0     0 ?        S    Apr18   0:00  \_ [migration/0]
    root         7  0.0  0.0      0     0 ?        S    Apr18   0:00  \_ [migration/1]
    root         9  0.0  0.0      0     0 ?        S    Apr18   0:01  \_ [ksoftirqd/1]
    root        11  0.0  0.0      0     0 ?        S
    root      3290  0.0  0.1  13864  3908 ?        S    Apr18   0:00 /usr/local/bin/notifier.plx -d
    rrdcache  3321  0.0  0.0 116836  1056 ?        Ssl  Apr18   1:39 /usr/bin/rrdcached -l unix:/var/run/rrdcached/socket -m 777 -b /var
    at        3341  0.0  0.0   2344   276 ?        Ss   Apr18   0:00 /usr/sbin/atd
    postgres  3462  0.0  0.1  46832  4996 ?        S    Apr18   0:22 /usr/pgsql84/bin/postgres -D /var/storage/pgsql/data
    postgres  3464  0.0  1.1  46832 34488 ?        Ss   Apr18   0:39  \_ postgres: writer process                            
    postgres  3465  0.0  0.0  46832  1004 ?        Ss   Apr18   0:37  \_ postgres: wal writer process                        
    postgres  3466  0.0  0.0  47104  1328 ?        Ss   Apr18   0:24  \_ postgres: autovacuum launcher process               
    postgres  3467  0.0  0.0   7432  1088 ?        Ss   Apr18   0:21  \_ postgres: stats collector process                   
    postgres  4168  0.0  1.1  49700 36664 ?        Ss   Apr18   1:38  \_ postgres: reporting reporting [local] idle          
    postgres  4853  0.0  0.6  49676 21328 ?        Ss   Apr18   0:04  \_ postgres: postgres smtp 127.0.0.1(38023) idle       
    postgres  5479  0.1  0.3  49312 12172 ?        Ss   01:15   1:21  \_ postgres: postgres smtp 127.0.0.1(50514) idle       
    root      3524  0.0  0.9  77440 30228 ?        S    Apr18   0:08 /var/mdw/mdw.plx
    root      3573  0.0  0.0   1892   484 ?        S    Apr18   0:00  \_ logger -p daemon.debug -t middleware[3524]
    root      3812  0.0  0.0   2944    40 ?        Ss   Apr18   0:00  \_ /bin/bash /bin/DHCPC.sh eth1
    root      4292  0.0  0.0   2608   216 ?        S    Apr18   0:00      \_ /usr/sbin/dhclient -d -cf /etc/eth1.conf -lf /var/db/eth1.l
    root      3569  0.6  0.1  11544  5192 ?        S    Apr18  19:39 /usr/local/bin/selfmonng.plx
    root      3589  0.0  0.0  11184  1844 ?        S    Apr18   0:00  \_ [timewarp check]
    root      3581  0.0  0.0   1888   500 ?        Ss   Apr18   0:18 /usr/local/bin/daemon-watcher selfmonng.plx /usr/local/bin/selfmonn
    root      3582  0.0  0.0   2416   632 tty1     Ss+  Apr18   0:00 /sbin/mingetty --noclear --no-hostname tty1
    root      3583  0.0  0.0   2416   632 tty2     Ss+  Apr18   0:00 /sbin/mingetty --no-hostname tty2
    root      3584  0.0  0.0   2416   628 tty3     Ss+  Apr18   0:00 /sbin/mingetty --no-hostname tty3
    root      3585  0.0  0.0   2416   628 tty4     Ss+  Apr18   0:00 /sbin/mingetty --no-hostname tty4
    root      3907  0.0  0.1   9324  5552 ?        Ss   Apr18   0:32 dns-resolver.plx
    root      3942  0.0  0.0   2364   784 ?        Ss   Apr18   0:00 /usr/sbin/cron
    root      3959  0.0  0.0   4820   776 ?        Ss   Apr18   0:00 /usr/sbin/sshd -f /etc/ssh/sshd_config
    root      3025  0.0  0.0   7408  1408 ?        Ss   14:15   0:00  \_ sshd: loginuser [priv]                   
    100       3054  0.1  0.0   7544  1156 ?        S    14:15   0:18      \_ sshd: loginuser@pts/0                    
    100       3071  0.0  0.0   5036  1828 pts/0    Ss   14:15   0:00          \_ -bash
    root      3105  0.0  0.0   4572  1272 pts/0    S    14:16   0:00              \_ su -
    root      3130  0.0  0.0   5040  1956 pts/0    S    14:16   0:00                  \_ -bash
    root      5234  0.9  0.0   2696  1124 pts/0    S+   18:55   0:00                      \_ top
    sockd     4019  0.0  0.0   6824     4 ?        Ss   Apr18   0:00 /bin/sockd -D
    sockd     4022  0.0  0.0   6824     4 ?        S    Apr18   0:00  \_ sockd: negot 
    sockd     4023  0.0  0.0   6824     0 ?        S    Apr18   0:00  \_ sockd: reque 
    sockd     4024  0.0  0.0   6824     0 ?        S    Apr18   0:00  \_ sockd: reque 
    sockd     4026  0.0  0.0   6824     0 ?        S    Apr18   0:00  \_ sockd: reque 
    sockd     4027  0.0  0.0   6824     0 ?        S    Apr18   0:00  \_ sockd: reque 
    sockd     4028  0.0  0.0   6824     0 ?        S    Apr18   0:00  \_ sockd: iorel 
    root      4068  0.0  0.0   7976  3084 ?        Ss   Apr18   0:47 /usr/sbin/named -4
    root      4105  0.0  0.0   8612  1800 ?        Ss   Apr18   0:06 /bin/httpd -f /etc/httpd/httpd.conf
    root      4107  0.0  0.0   1892    64 ?        S    Apr18   0:00  \_ /bin/logger -t httpd -p local6.notice
    wwwrun    4109  0.0  0.0   8548   672 ?        S    Apr18   0:00  \_ /bin/httpd -f /etc/httpd/httpd.conf
    wwwrun   10302  0.0  0.0  34544  1944 ?        S    Apr19   0:01  |   \_ /var/jape/index.plx
    wwwrun    5366 16.8  1.9  62524 60204 ?        S    18:57   0:03  |   \_ /var/webadmin/webadmin.plx
    wwwrun    5405 37.1  1.6  52092 49800 ?        S    18:57   0:01  |   \_ /var/webadmin/webadmin.plx
    wwwrun    6090  0.0  0.0   9140  2944 ?        S    14:30   0:00  \_ /bin/httpd -f /etc/httpd/httpd.conf
    wwwrun    5368  0.2  0.0   9184  2948 ?        S    18:57   0:00  \_ /bin/httpd -f /etc/httpd/httpd.conf
    wwwrun    5370  0.9  0.0   9076  3000 ?        S    18:57   0:00  \_ /bin/httpd -f /etc/httpd/httpd.conf
    wwwrun    5400  0.0  0.0   8880  2708 ?        S    18:57   0:00  \_ /bin/httpd -f /etc/httpd/httpd.conf
    wwwrun    5402  0.0  0.0   8752  2416 ?        S    18:57   0:00  \_ /bin/httpd -f /etc/httpd/httpd.conf
    wwwrun    5404  0.0  0.0   8752  2424 ?        S    18:57   0:00  \_ /bin/httpd -f /etc/httpd/httpd.conf
    wwwrun    5408  0.0  0.0   8612  1000 ?        S    18:57   0:00  \_ /bin/httpd -f /etc/httpd/httpd.conf
    wwwrun    5409  0.0  0.0   8752  2008 ?        S    18:57   0:00  \_ /bin/httpd -f /etc/httpd/httpd.conf
    root      4166  0.0  0.0   4424  1552 ?        S
Children
No Data