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 Reply Children
  • This is my Astaro's output:


    SwapTotal: 1024.0 MB
    SwapUsed:   633.1 MB
    ========================================
    MB      %       PID     process
    213.4   20.8    27314   httpproxy
    30.4    3.0     6885    confd.plx
    28.7    2.8     6997    confd.plx
    28.2    2.8     6860    index.plx
    26.3    2.6     5115    cssd
    25.4    2.5     4683    screenmgr.plx
    25.3    2.5     5319    acc-agent.plx
    23.7    2.3     3325    confd.plx
    20.9    2.0     3563    awed
    18.9    1.8     3185    confd.plx
    18.8    1.8     4429    awed
    18.3    1.8     4750    smtpd.bin
    17.3    1.7     3365    confd.plx
    15.0    1.5     4692    smtpd.bin
    13.7    1.3     2493    confd.plx
    11.5    1.1     3786    mdw.plx
    8.5     0.8     6996    index.plx
    7.9     0.8     3516    notifier.plx
    7.4     0.7     3277    aua.bin
    6.4     0.6     3881    selfmonng.plx
    5.0     0.5     3837    selfmonng.plx
    4.2     0.4     5162    ctasd
    3.8     0.4     23524   vpn-reporter.pl
    3.6     0.4     23526   ips-reporter.pl
    3.5     0.3     23523   pfilter-reporte
    3.3     0.3     23529   waf-reporter.pl
    2.7     0.3     23490   admin-reporter.
    2.7     0.3     23525   mailsec-reporte
    2.7     0.3     4301    dns-resolver.pl
    2.6     0.3     5189    ctipd.bin
    2.4     0.2     4436    named
    2.2     0.2     5320    afcd
    2.1     0.2     3216    confd-qrunner.p
    2.0     0.2     3235    sysmond
    1.6     0.2     6588    snmpd
    1.6     0.2     27134   postgres
    1.4     0.1     4577    httpd
    1.4     0.1     6218    dhcpd
    1.4     0.1     4580    httpd
    1.2     0.1     27163   httpd
    1.1     0.1     3113    irqd
    1.0     0.1     3140    httpd
    0.8     0.1     4625    ulogd
    0.7     0.1     4534    openvpn
    0.7     0.1     4789    postgres
    0.6     0.1     2794    syslog-ng
    0.6     0.1     4630    postgres
    0.5     0.0     3902    udevd
    0.5     0.0     3141    haveged
    0.5     0.0     6121    pluto
    0.5     0.0     23531   postgres
    0.5     0.0     3901    udevd
    0.5     0.0     2353    udevd
    0.4     0.0     3735    postgres
    0.4     0.0     23530   postgres
    0.4     0.0     3560    rrdcached
    0.3     0.0     3056    hald
    0.3     0.0     3732    postgres
    0.3     0.0     3733    postgres
    0.3     0.0     3737    postgres
    0.3     0.0     2793    syslog-ng
    0.3     0.0     3734    postgres
    0.3     0.0     5595    master
    0.3     0.0     6571    qmgr
    0.2     0.0     3078    hald-addon-inpu
    0.2     0.0     3736    postgres
    0.2     0.0     6113    starter
    0.2     0.0     5160    ctasd
    0.2     0.0     2825    dbus-daemon
    0.2     0.0     23528   websec-reporter
    0.2     0.0     3094    hald-addon-acpi
    0.2     0.0     3730    postgres
    0.2     0.0     4671    frox
    0.2     0.0     4408    sshd
    0.2     0.0     3057    hald-runner
    0.1     0.0     3895    mingetty
    0.1     0.0     3896    mingetty
    0.1     0.0     23527   websec-reporter
    0.1     0.0     3422    postgres
    0.1     0.0     3898    mingetty
    0.1     0.0     3899    mingetty
    0.1     0.0     3594    atd
    0.1     0.0     3186    logger
    0.1     0.0     3127    lcm-162
    0.1     0.0     1       init
    0.1     0.0     2596    ntpd
    0.1     0.0     3676    asg_ha_zeroconf
    0.1     0.0     6496    _pluto_adns
    0.1     0.0     3900    mingetty
    0.1     0.0     4372    cron
    0.1     0.0     3278    logger
    0.1     0.0     3897    mingetty
    0.1     0.0     2810    acpid


    Memory:

                 total       used       free     shared    buffers     cached
    Mem:          1974       1679        294          0          4        486
    -/+ buffers/cache:       1188        785
    Swap:         1023        703        320

    Uptime:
     18:36pm  up 16 days 22:16,  1 user,  load average: 0.18, 0.22, 0.20

    Version: 
    Current software version...: 9.105009
    Hardware type..............: 220r5

    Installation image.........: 9.005-16.1
    Installation type..........: ssi
    Installed pattern version..: 50547
    Downloaded pattern version.: 50547
    Up2Dates applied...........: 9 (see below)
                                 sys-9.005-9.006-15.5.2.tgz (Apr 27 11:54)
                                 sys-9.006-9.100-5.14.1.tgz (May 14 08:56)
                                 sys-9.006-9.100-5.8.1.tgz (Apr 27 16:50)
                                 sys-9.100-9.100-8.16.1.tgz (May 14 09:08)
                                 sys-9.100-9.101-16.12.1.tgz (Jun  3 20:08)
                                 sys-9.101-9.102-11.8.2.tgz (Jun 28 17:28)
                                 sys-9.102-9.103-8.5.2.tgz (Jul 16 09:02)
                                 sys-9.103-9.104-5.17.2.tgz (Aug 11 12:03)
                                 sys-9.104-9.105-17.9.1.tgz (Aug 21 20:18)
    Up2Dates available.........: 0
    Factory resets.............: 0
    Timewarps detected.........: 1





    Seems to be the HTTP Proxy, restarted the service on Tuesday and the Astaro has now again high swap usage shown in the graphs.