Network Management

last person joined: 17 hours ago 

Keep an informative eye on your network with HPE Aruba Networking network management solutions

AMP-Tip: 8.2.6 AMPCLI: Enter Commands #2: disk usage checking and clean up

This thread has been viewed 30 times
  • 1.  AMP-Tip: 8.2.6 AMPCLI: Enter Commands #2: disk usage checking and clean up

    EMPLOYEE
    Posted Mar 28, 2018 05:41 PM

    Is your disk getting full?  Did you get an alert from your disk usage trigger?  If so, here's tips on how to get to the bottom of things filling up your disk:

     

    Login to your CLI with your 'ampadmin' user account and load the Enter Commands (option 11):

    AirWave Management Platform 8.2.6 on airwave.lab.com
    1 Upload File
    2 Download File
    3 Delete File
    4 Backup
    5 Restore
    6 Support
    7 Upgrade
    8 Advanced
    9 Security
    10 Custom Commands
    11 Enter Commands
    q >> Quit
    Your choice: 11

    Running Enter Commands

    Type 'help' for the list of commands.
    $

     

    Check the disk usage:

    $ df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/mapper/VolGroup00-LogVol00
    55G 23G 30G 43% /
    tmpfs 3.9G 4.0K 3.9G 1% /dev/shm
    /dev/sda2 93M 41M 48M 46% /boot
    /dev/sda1 200M 260K 200M 1% /boot/efi
    tmpfs 64M 524K 64M 1% /var/lib/pgsql/pg_stats_temp

     

    This example isn't great since there's nothing wrong w/ 43% usage of /, but we can still walk-through the next steps for clearing space.

     

    ### Manually clearing space ###

     

    First list the files, there's a few options on the listing:

    $ ?ls
    ls [file ...] - List contents of CLI user directory
    Both ls and rm can use shell meta character patterns with *, ?, and []

     

    $ ls
    AMP-8.2.3-amp_upgrade 61,067 bytes 2018-03-28 01:45:34
    AMP-8.2.3-x86_64-cvs.tar.gz 2,035,887,273 bytes 2018-03-28 11:17:33
    AMP-8.2.4-amp_upgrade 61,067 bytes 2018-03-26 01:43:15
    AMP-8.2.4-x86_64-cvs.tar.gz 2,035,872,787 bytes 2018-03-26 10:49:20
    AMP-8.2.5-amp_upgrade 61,067 bytes 2018-03-21 01:45:30
    AMP-8.2.5-x86_64-cvs.tar.gz 2,035,865,216 bytes 2018-03-21 11:00:39
    AMP-8.2.6-x86_64.ova 4,529,889,792 bytes 2018-03-28 12:02:50
    nightly_data001.tar.gz 56,274,373 bytes 2018-03-28 04:20:30
    nightly_data002.tar.gz 53,494,161 bytes 2018-03-27 04:19:56
    nightly_data003.tar.gz 51,591,714 bytes 2018-03-26 04:19:53
    nightly_data004.tar.gz 51,351,857 bytes 2018-03-25 04:19:43
    pre-upgrade-8.2.4-data.tar.gz 51,591,714 bytes 2018-03-26 04:19:53
    pre-upgrade-8.2.5-data.tar.gz 56,274,373 bytes 2018-03-28 04:20:30
    airwave.lab.com.csr 976 bytes 2018-03-22 10:36:21
    visualrf_backup_airwave.lab.com.zip 242,494 bytes 2018-03-28 04:20:27

     

    If the list gets too long, you don't have the entire ls package you'd have normally on a root shell, but you can at least get some wildcards:

    $ ls *gz

    AMP-8.2.3-x86_64-cvs.tar.gz 2,035,887,273 bytes 2018-03-28 11:17:33
    AMP-8.2.4-x86_64-cvs.tar.gz 2,035,872,787 bytes 2018-03-26 10:49:20
    AMP-8.2.5-x86_64-cvs.tar.gz 2,035,865,216 bytes 2018-03-21 11:00:39
    nightly_data001.tar.gz 56,274,373 bytes 2018-03-28 04:20:30
    nightly_data002.tar.gz 53,494,161 bytes 2018-03-27 04:19:56
    nightly_data003.tar.gz 51,591,714 bytes 2018-03-26 04:19:53
    nightly_data004.tar.gz 51,351,857 bytes 2018-03-25 04:19:43
    pre-upgrade-8.2.4-data.tar.gz 51,591,714 bytes 2018-03-26 04:19:53
    pre-upgrade-8.2.5-data.tar.gz 56,274,373 bytes 2018-03-28 04:20:30

    $ ls night*

    nightly_data001.tar.gz 56,274,373 bytes 2018-03-28 04:20:30
    nightly_data002.tar.gz 53,494,161 bytes 2018-03-27 04:19:56
    nightly_data003.tar.gz 51,591,714 bytes 2018-03-26 04:19:53
    nightly_data004.tar.gz 51,351,857 bytes 2018-03-25 04:19:43

    $ ls *8*

    AMP-8.2.3-amp_upgrade 61,067 bytes 2018-03-28 01:45:34
    AMP-8.2.3-x86_64-cvs.tar.gz 2,035,887,273 bytes 2018-03-28 11:17:33
    AMP-8.2.4-amp_upgrade 61,067 bytes 2018-03-26 01:43:15
    AMP-8.2.4-x86_64-cvs.tar.gz 2,035,872,787 bytes 2018-03-26 10:49:20
    AMP-8.2.5-amp_upgrade 61,067 bytes 2018-03-21 01:45:30
    AMP-8.2.5-x86_64-cvs.tar.gz 2,035,865,216 bytes 2018-03-21 11:00:39
    AMP-8.2.6-x86_64.ova 4,529,889,792 bytes 2018-03-28 12:02:50

    pre-upgrade-8.2.4-data.tar.gz 51,591,714 bytes 2018-03-26 04:19:53
    pre-upgrade-8.2.5-data.tar.gz 56,274,373 bytes 2018-03-28 04:20:30

     

    Then I can use the same logic to delete files:

    Delete single file:

    $ rm AMP-8.2.6-x86_64.ova
    Remove AMP-8.2.6-x86_64.ova? y

     

    Delete multiple files:

    $ rm pre*

    Remove pre-upgrade-8.2.4-data.tar.gz? y

    Remove pre-upgrade-8.2.5-data.tar.gz? y

     

    This delete action will follow the nightly backup file symlinks to their location in /var/airwave-backup to delete both symlink and the actual backup file.

     

    ### Cleanup script ###

     

    Note that the individual cleaning steps only work against the files that are in /var/ampcli/user which is the landing directory for the ampadmin user.  Here's another target you can use that will look at files elsewhere in the system:

    $ ?clean
    cleanup - Delete files that are no longer needed.
    This includes log files, old source files, pre upgrade backups, etc.
    You will confirm the deletions and will have the option to see the list.

     

    $ cleanup
    There are 232,512,461 bytes of files to clean up.
    Show files, Delete them, or Quit? (sdQ)  s
    /var/log/nightly_maintenance_profile.6
    /var/log/messages.3.gz
    /var/log/httpd/error_log.2018-03-26.gz
    /var/log/httpd/error_log.2018-03-27.gz
    /var/log/httpd/access_log.2018-03-26.gz
    /var/log/httpd/error_log.2018-03-28.gz
    /var/log/httpd/access_log.2018-03-27.gz
    /var/log/httpd/access_log.2018-03-28.gz
    /var/log/jitterentropy.log.2.gz
    /var/log/secure.3.gz
    /var/log/nightly_maintenance_profile.3
    /var/log/audit/audit.log.4
    /var/log/audit/audit.log.2
    /var/log/audit/audit.log.3
    /var/log/pgsql.2.gz
    /var/log/postgres_connect.2.gz
    /var/log/messages.2.gz
    /var/log/visualrf/visualrf_msg.log.8
    /var/log/visualrf/visualrf_msg.log.17
    /var/log/visualrf/visualrf_msg.log.3
    /var/log/visualrf/visualrf_msg.log.16
    /var/log/visualrf/visualrf_msg.log.20
    /var/log/visualrf/visualrf_msg.log.18
    /var/log/visualrf/visualrf_msg.log.19
    /var/log/visualrf/visualrf_msg.log.9
    ...

     

    The script is looking at log files in /var/log, old pre-upgrade backups in /var/airwave-backup, and AMP upgrade packages in /root.

     

    So back at the prompt - after reviewing the list of files, proceed to delete or you can quit the cleanup tool.  If you choose to delete, it'll perform the deletions and then quit back to the enter commands menu prompt.  If you quit, then nothing will be deleted:

    Show files, Delete them, or Quit? (sdQ) d
    All cleaned up.

    $

     

    Once you cleanup those files, the cleanup check should report nothing to clean:

    $ cleanup
    Nothing to clean up. All is tidy.

     

    ######

     

     

    If you're still finding that your disk is filling up beyond what you can clean from the AMPCLI, then a support case should be opened for support to look into it.  We purposely did not expose other directories since with the AMPCLI in place, the /var/ampcli/user directory is the main location for movable AMP files.  If you have pre-existing scripts that were outputting files to a different folder, you should make sure those scripts are outputting to the /var/ampcli/user directory in the post-AMPCLI world.