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
  • Is this problem fixed in 9.1 ?


    ...not entirely

    It´s much better, but Swap is still creeping up (see Attachment)

    I did a fresh install two Weeks ago and the System is running with this Config:

    • Firewall is active with 20 rules
    • Intrusion Prevention is active with 7747 of 15806 patterns
    • Web Filtering is active, 350 requests served today
    • Network Visibility is active, 7 Application Control rules active
    • SMTP Proxy is active, 0 emails processed, 0 emails blocked
    • Endpoint Protection is active...
    • Remote Access is active with 0 online users
    • Antivirus is active for protocols HTTP/S, FTP, SMTP
    • Antispam is active for protocols SMTP
    • Antispyware is active


    and the folowing Options and "Tunig" Settings:

    • Endpoint Protection / Web Control (to use the new Sophos Content Servers instead of the cffs??.astaro.com) 
    • http sc_local_db = none (default)
    • vm.swappiness = 60 (default and i may change that to "10")
    • ips num_instances = 2 (default would be "0" = automatic, which confused Snort to use 3 Instances on my 2 Core with HT System)


    And here the "swap-usage" output:
    asg:/root # ./swap-usage.pl
    
    ..............................................................................................................................................................................
    SwapTotal: 1024.0 MB
    SwapUsed:   361.9 MB
    ========================================
    MB      %       PID     process
    81.1    7.9     4980    snort_inline
    64.3    6.3     4994    snort_inline
    36.7    3.6     3790    mdw.plx
    21.8    2.1     4731    screenmgr.plx
    15.6    1.5     3413    confd.plx
    14.2    1.4     5538    httpproxy
    13.7    1.3     9322    confd.plx
    13.6    1.3     28981   confd.plx
    12.6    1.2     3199    confd.plx
    11.5    1.1     28723   confd.plx
    10.7    1.0     4847    smtpd.bin
    9.6     0.9     4817    smtpd.bin
    7.2     0.7     3338    aua.bin
    6.6     0.6     5551    epp_client.plx
    6.3     0.6     3860    selfmonng.plx
    6.1     0.6     5549    eplog.plx
    5.9     0.6     3546    notifier.plx
    5.0     0.5     3840    selfmonng.plx
    2.2     0.2     4276    dns-resolver.pl
    2.0     0.2     3249    sysmond
    1.4     0.1     3230    confd-qrunner.p
    1.3     0.1     5560    afcd
    1.0     0.1     4282    named
    0.8     0.1     5216    ctipd.bin
    0.7     0.1     4879    postgres
    0.7     0.1     3135    irqd
    0.7     0.1     5214    ctasd
    0.6     0.1     4431    postgres
    0.5     0.0     4654    ulogd
    0.4     0.0     3739    postgres
    0.3     0.0     5671    udevd
    0.3     0.0     6094    udevd
    0.3     0.0     2815    syslog-ng
    0.3     0.0     3077    hald
    0.3     0.0     5479    master
    0.3     0.0     2350    udevd
    0.3     0.0     2814    syslog-ng
    0.3     0.0     3571    rrdcached
    0.3     0.0     4658    postgres
    0.2     0.0     4532    openvpn
    0.2     0.0     3740    postgres
    0.2     0.0     4689    frox
    0.2     0.0     5209    cssd
    0.2     0.0     3741    postgres
    0.2     0.0     3737    postgres
    0.2     0.0     3738    postgres
    0.2     0.0     4397    sshd
    0.2     0.0     5212    ctasd
    0.2     0.0     3734    postgres
    0.2     0.0     3099    hald-addon-inpu
    0.2     0.0     3116    hald-addon-acpi
    0.2     0.0     5731    argos
    0.1     0.0     3339    logger
    0.1     0.0     4360    cron
    0.1     0.0     4430    hotspotd
    0.1     0.0     3854    mingetty
    0.1     0.0     3078    hald-runner
    0.1     0.0     3736    postgres
    0.1     0.0     6067    postgres
    0.1     0.0     3855    mingetty
    0.1     0.0     6066    postgres
    0.1     0.0     1544    postgres
    0.1     0.0     3200    logger
    0.1     0.0     2831    acpid
    0.1     0.0     2846    dbus-daemon
    0.1     0.0     3856    mingetty
    0.1     0.0     1       init
    0.1     0.0     8235    postgres
    0.1     0.0     3155    haveged
    0.1     0.0     3853    mingetty
    0.1     0.0     4531    openvpn
    0.1     0.0     3605    atd
    asg:/root # free -m
                 total       used       free     shared    buffers     cached
    Mem:          3950       3819        131          0         54       1902
    -/+ buffers/cache:       1862       2088
    Swap:         1023        307        716
    kay-asg:/root # uptime
     06:45am  up 10 days  9:42,  1 user,  load average: 0.86, 0.69, 0.47
    asg:/root # version

    Current software version...: 9.100016
    Hardware type..............: Software Appliance
    Installation image.........: 9.005-16.1
    Installation type..........: asg
    Installed pattern version..: 45986
    Downloaded pattern version.: 45986
    Up2Dates applied...........: 2 (see below)
                                 sys-9.005-9.006-15.5.2.tgz (May 14 19:46)
                                 sys-9.006-9.100-5.16.1.tgz (May 14 19:54)
    Up2Dates available.........: 0
    Factory resets.............: 0
    Timewarps detected.........: 0