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.
  • UTM 220

    09:22am  up  12:04,  1 user,  load average: 1.81, 1.42, 1.31

    SwapTotal: 1027.6 MB
    SwapUsed:   489.6 MB
    ========================================
    MB      %       PID     process
    148.2   14.4    4751    httpproxy
    83.6    8.1     5368    snort_inline
    76.1    7.4     3801    mdw.plx
    22.4    2.2     3421    confd.plx
    18.6    1.8     4252    zebra
    18.0    1.8     4256    bgpd
    16.1    1.6     5155    smtpd.bin
    15.8    1.5     3178    confd.plx
    14.5    1.4     4885    smtpd.bin
    9.3     0.9     3330    aua.bin
    7.9     0.8     3580    notifier.plx
    6.2     0.6     3866    selfmonng.plx
    5.3     0.5     5151    red_server.plc
    4.8     0.5     3846    selfmonng.plx
    3.5     0.3     6292    red_server.plc
  • Thx @Anonymous.

    Here is one example from an UTM 120 HA Cluster.
    It is stiking, that I have seen this problem only on HA cluster with 9.005-6


    SwapTotal: 1024.0 MB
    SwapUsed:   1086.5 MB
    ========================================
    MB      %       PID     process
    511.3   49.9    5074    httpproxy
    243.7   23.8    5832    snort_inline
    61.2    6.0     5216    afcd
    40.8    4.0     4078    mdw.plx
    30.8    3.0     6910    confd.plx
    26.3    2.6     14338   index.plx
    21.8    2.1     3428    confd.plx
    17.7    1.7     3063    confd.plx
    17.1    1.7     16812   awed
    15.7    1.5     13510   smtpd.bin
    14.2    1.4     13504   smtpd.bin
    13.1    1.3     8104    awed
    7.9     0.8     3425    notifier.plx
    7.6     0.7     7788    confd-sync
    7.3     0.7     3221    aua.bin
    6.3     0.6     4141    selfmonng.plx
    4.5     0.4     4122    selfmonng.plx
    2.6     0.3     3061    haveged
    2.6     0.3     5026    ctasd
    2.5     0.2     4657    named
    2.0     0.2     3148    sysmond
    1.9     0.2     3094    confd-qrunner.p
    1.9     0.2     7856    ha_proxy
    1.9     0.2     7855    ha_proxy
    ...


    Nice greetings
  • at William:
    I would say, we have NO PROBLEM with our UTM 120 (Full Guard).
    Please read carefully befor you answer!

    I think you know the costs of the UTM 220 or 320.
    Of course there are many other security-appliance in the web with the same price at the UTM120 and also could nearly the same for about 25 user!

    (sorry about my english. it's not my first language)
    regards peter
  • Thx @Anonymous.

    Here is one example from an UTM 120 HA Cluster.
    It is stiking, that I have seen this problem only on HA cluster with 9.005-6



    Nice greetings


    That's cool, your utm use more swap as it has!
  • That's cool, your utm use more swap as it has!


    That's right.
    The other HA cluster looks exactly the same.

    Nice greetings
  • My results:
    Edit: http proxy with dual scan and https scanning and ad-sso (even if it's not in the list...). No ips in use. But we have the cron-based-httpproxy-autorestart in place.

    SwapTotal: 1024.0 MB
    SwapUsed:   253.1 MB
    ========================================
    MB      %       PID     process
    22.4    2.2     5141    screenmgr.plx
    21.2    2.1     17102   index.plx
    16.0    1.6     3422    confd.plx
    14.7    1.4     5787    afcd
    12.9    1.3     3206    confd.plx
    11.9    1.2     8549    awed
    11.9    1.2     8551    awed
    11.9    1.2     8479    awed
    11.5    1.1     7613    smtpd.bin
    11.4    1.1     7815    smtpd.bin
    9.3     0.9     4187    mdw.plx
    8.7     0.8     7817    awed
    8.0     0.8     7321    confd-sync
    6.5     0.6     3360    aua.bin
    5.9     0.6     4255    selfmonng.plx
    5.9     0.6     3581    notifier.plx
    4.9     0.5     13300   httpd
    4.6     0.4     5139    httpd
    4.6     0.4     2236    httpd
    4.6     0.4     5084    httpd
    3.7     0.4     8199    red_server.plc
    2.8     0.3     4232    selfmonng.plx
    2.1     0.2     31618   red_server.plc
    2.1     0.2     7520    red_server.plc
    1.9     0.2     6924    ha_proxy
    1.9     0.2     6925    ha_proxy
    1.9     0.2     3275    sysmond
    1.8     0.2     9432    slon_control
    1.4     0.1     3237    confd-qrunner.p
    1.3     0.1     5018    named
    1.2     0.1     7665    dns-resolver.pl
    0.8     0.1     5055    httpd
    0.8     0.1     5058    httpd
    0.7     0.1     24144   httpd
    0.7     0.1     5181    ctasd
    0.7     0.1     24154   httpd
    0.6     0.1     9626    postgres
    0.6     0.1     9594    postgres
    0.5     0.0     9643    postgres
    0.5     0.0     3137    irqd
    0.5     0.0     9623    postgres
    0.5     0.0     7947    winbindd
    0.5     0.0     9651    postgres
    0.5     0.0     9617    postgres
    0.5     0.0     9654    postgres
    0.5     0.0     9649    postgres
    0.5     0.0     9653    postgres
    0.4     0.0     9658    postgres
    0.4     0.0     8452    winbindd
    0.4     0.0     7833    postgres
    0.4     0.0     10044   postgres
    0.4     0.0     7897    postgres
    0.4     0.0     7783    postgres
    0.4     0.0     8047    winbindd
    0.4     0.0     9652    postgres
    0.4     0.0     9625    postgres
    0.4     0.0     9650    postgres
    0.4     0.0     8453    winbindd
    0.3     0.0     13136   udevd
    0.3     0.0     4129    postgres
    0.3     0.0     13137   udevd
    0.3     0.0     9624    postgres
    0.3     0.0     17104   postgres
    0.3     0.0     4012    postgres
    0.3     0.0     4131    postgres
    0.2     0.0     3102    hald-addon-inpu
    0.2     0.0     6449    pluto
    0.2     0.0     8486    postgres
    0.2     0.0     2357    udevd
    0.2     0.0     3741    postgres
    0.2     0.0     5179    ctasd
    0.2     0.0     7552    DHCPC.sh
    0.2     0.0     4128    postgres
    0.2     0.0     3080    hald
    0.2     0.0     7892    syslog-ng
    0.2     0.0     3711    rrdcached
    0.2     0.0     7955    dhclient
    0.2     0.0     4130    postgres
    0.2     0.0     4934    sshd
    0.2     0.0     3118    hald-addon-acpi
    0.2     0.0     8375    service_monitor
    0.2     0.0     7894    syslog-ng
    0.2     0.0     9818    tlsmgr
    0.1     0.0     4248    mingetty
    0.1     0.0     4246    mingetty
    0.1     0.0     2816    acpid
    0.1     0.0     9546    slon
    0.1     0.0     4249    mingetty
    0.1     0.0     6734    _pluto_adns
    0.1     0.0     9639    slon
    0.1     0.0     4919    cron
    0.1     0.0     7895    ulogd
    0.1     0.0     3361    logger
    0.1     0.0     3165    haveged
    0.1     0.0     5135    frox
    0.1     0.0     2831    dbus-daemon
    0.1     0.0     9547    slon
    0.1     0.0     7977    qmgr
    0.1     0.0     1       init
    0.1     0.0     7782    hotspotd
    0.1     0.0     4245    mingetty
    0.1     0.0     4250    mingetty
    0.1     0.0     3151    lcm-162
    0.1     0.0     4247    mingetty
    0.1     0.0     6447    starter
    0.1     0.0     3634    atd
    0.1     0.0     9611    slon


    asg320:/tmp # free -m
                 total       used       free     shared    buffers     cached
    Mem:          3926       3512        413          0        211       1876
    -/+ buffers/cache:       1424       2501
    Swap:         1023        176        847


    asg320:/tmp # uptime
     23:07pm  up 13 days  6:11,  1 user,  load average: 1.38, 0.84, 0.67


    asg320:/tmp # version

    Current software version...: 9.006005
    Hardware type..............: 320r5
    Serial number..............: 
    Installation image.........: 9.003-16.1
    Installation type..........: ssi
    Installed pattern version..: 44707
    Downloaded pattern version.: 44707
    Up2Dates applied...........: 6 (see below)
                                 sys-9.003-9.004-15.29.1.tgz (Nov 29 12:31)
                                 sys-9.004-9.004-29.33.1.tgz (Nov 29 13:33)
                                 sys-9.004-9.004-33.34.1.tgz (Mar  9 09:31)
                                 sys-9.004-9.005-29.15.2.tgz (Mar  9 09:33)
                                 sys-9.005-9.005-15.16.1.tgz (Mar  9 09:33)
                                 sys-9.005-9.006-15.5.2.tgz (Apr  5 16:53)
    Up2Dates available.........: 0
    Factory resets.............: 1
    Timewarps detected.........: 0
  • Can the guys with the httpproxy as the top swap consumer please check which AV scanning mode is enabled? Single/Dual and if single, which engine.
  • From a customer's new UTM 120.  Single scan Avira
    osfa:/root # ./swap-usage.pl
    .....................................................................................................................................
    SwapTotal: 1024.0 MB
    SwapUsed:   579.0 MB
    ========================================
    MB      %       PID     process
    189.7   18.5    4528    httpproxy
    170.9   16.7    5477    snort_inline
    60.0    5.9     4622    afcd
    48.0    4.7     3695    mdw.plx
    18.0    1.8     3456    confd.plx
    15.8    1.5     3085    confd.plx
    13.0    1.3     4961    smtpd.bin
    12.9    1.3     4739    smtpd.bin
    6.2     0.6     3762    selfmonng.plx
    6.2     0.6     4855    epp_client.plx
    6.0     0.6     3443    notifier.plx
    5.3     0.5     3243    aua.bin
    3.6     0.4     3741    selfmonng.plx
    2.0     0.2     3169    sysmond
    1.7     0.2     4111    named
    1.4     0.1     4094    dns-resolver.pl
    1.4     0.1     3116    confd-qrunner.p
    1.2     0.1     5544    dhcpd
    0.9     0.1     4360    httpd
    0.9     0.1     4301    httpd
    0.9     0.1     4513    ctipd.bin
    0.7     0.1     4480    ctasd
    0.7     0.1     13476   httpd
    0.6     0.1     9924    httpd
    0.6     0.1     5176    pluto
    0.6     0.1     4393    postgres
    0.6     0.1     4243    postgres
    0.5     0.0     4359    postgres
    0.4     0.0     2271    udevd
    0.4     0.0     2961    hald
    0.4     0.0     3759    udevd
    0.4     0.0     5052    postgres
    0.4     0.0     5122    udevd
    0.3     0.0     3455    rrdcached
    0.3     0.0     4922    master
    0.3     0.0     3638    postgres
    0.3     0.0     3637    postgres
    0.3     0.0     5693    qmgr
    0.3     0.0     3636    postgres
    0.3     0.0     2672    syslog-ng
    0.3     0.0     3018    irqd
    0.2     0.0     3635    postgres
    0.2     0.0     4475    ctasd
    0.2     0.0     4203    sshd
    0.2     0.0     2671    syslog-ng
    0.2     0.0     2983    hald-addon-inpu
    0.2     0.0     4454    frox
    0.2     0.0     2710    dbus-daemon
    0.2     0.0     13881   postgres
    0.2     0.0     4390    pop3proxy
    0.2     0.0     2962    hald-runner
    0.2     0.0     5174    starter
    0.2     0.0     2999    hald-addon-acpi
    0.2     0.0     29291   postgres
    0.2     0.0     3623    postgres
    0.2     0.0     2998    hald-addon-cpuf
    0.1     0.0     3754    mingetty
    0.1     0.0     3102    confd-queuer
    0.1     0.0     4182    cron
    0.1     0.0     4234    hotspotd
    0.1     0.0     3753    mingetty
    0.1     0.0     3497    atd
    0.1     0.0     3757    mingetty
    0.1     0.0     3755    mingetty
    0.1     0.0     4356    ulogd
    0.1     0.0     5128    openl2tpd
    0.1     0.0     5466    _pluto_adns
    0.1     0.0     2688    acpid
    0.1     0.0     3244    logger
    0.1     0.0     3756    mingetty
    0.1     0.0     3081    haveged
    osfa:/root # free -m
                 total       used       free     shared    buffers     cached
    Mem:          2000       1939         60          0         51        856
    -/+ buffers/cache:       1031        969
    Swap:         1023        558        465
    osfa:/root # uptime
     14:18pm  up 6 days 20:14,  1 user,  load average: 1.26, 1.05, 0.92
    osfa:/root # version

    Current software version...: 9.006005
    Hardware type..............: 120r5
    Serial number..............: A1705A8ED3AB894
    Installation image.........: 9.003-16.1
    Installation type..........: ssi
    Installed pattern version..: 44703
    Downloaded pattern version.: 44703
    Up2Dates applied...........: 4 (see below)
                                 sys-9.003-9.004-15.33.1.tgz (Dec  7 04:03)
                                 sys-9.004-9.004-33.34.1.tgz (Jan  9 05:00)
                                 sys-9.005-9.005-15.16.1.tgz (Mar  4 19:14)
                                 sys-9.005-9.006-15.5.2.tgz (Apr 11 18:03)
    Up2Dates available.........: 0
    Factory resets.............: 0
    Timewarps detected.........: 0

    Cheers - Bob
  • The following has been modified based on BarryG's post #17 below.
    ----------------------------------------------------------------------------
    I have put this script up on our website so anyone can use it. Login as root and then copy and paste the following blocks of commands (yes, each one all at once).
    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


    Before you run this, look at http://www.mediasoftusa.com/swapusage in your browser to confirm that some hacker hasn't modified it.
     
    Cheers - Bob
  • Thanks to BAlfson, with your help it's now very easy to grab these stats !

    a new shot of the same ASG320 HA:


    SwapTotal: 1024.0 MB
    SwapUsed:   420.3 MB
    ========================================
    MB      %       PID     process
    125.8   12.3    6813    snort_inline
    52.3    5.1     5787    afcd
    50.4    4.9     5711    httpproxy
    46.0    4.5     7548    snort_inline
    23.8    2.3     3513    confd.plx
    17.7    1.7     28339   index.plx
    16.4    1.6     23249   confd.plx
    15.3    1.5     5659    screenmgr.plx
    13.3    1.3     16289   confd.plx
    12.9    1.3     16196   confd.plx
    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.6     0.4     3508    notifier.plx
    2.6     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       7607        349          0        236       3935
    -/+ buffers/cache:       3436       4521
    Swap:         1023        371        652
     astaro:/tmp # uptime
     15:51pm  up 13 days 13:47,  1 user,  load average: 2.66, 3.67, 3.42
     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..: 44732
    Downloaded pattern version.: 44732
    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