Aug 192016
 

So you have faulty disk and these nice guys from HP (sorry, HPE I should say!) asked for adureport. That’s alright, it’s as easy as 1, 2, 3

Repository

Configure repository as described here.

Installation

apt-get install hpacucli

Generate report

hpacucli ctrl all diag file=/tmp/ADUReport.zip

Email report back to HP. You can of course view it first should you want it:

unzip ADUreport.zip 
vim ADUReport.txt

 

Using hpacucli

NB. Did you know, you can do all sorts of funky stuff with hpacucli?

Either run commands to get output that can be feed to monitoring scripts:

/usr/sbin/hpacucli ctrl slot=0 physicaldrive all show status
/usr/sbin/hpacucli ctrl slot=0 logicaldrive all show status
/usr/sbin/hpacucli ctrl slot=0 array all show status

or run it interactively:

/usr/sbin/hpacucli

HP Array Configuration Utility CLI 9.40.12.0
Detecting Controllers...Done.
Type "help" for a list of supported commands.
Type "exit" to close the console.

=>  ctrl all show config

<ommited>
=>  ctrl all show status

Smart Array P400 in Slot 0
   Controller Status: OK
   Cache Status: OK

=>   set target ctrl slot=0

 "controller slot=0"

=>   show

=>   show config detail

Smart Array P400 in Slot 0
   Bus Interface: PCI
   Slot: 2
   Serial Number: xxxxxxxxxxxxxxxx
   Cache Serial Number: xxxxxxxxxxx
   RAID 6 (ADG) Status: Disableds
   Controller Status: OK
   Chassis Slot:
   Hardware Revision: Rev E
   Firmware Version: 5.20
   Rebuild Priority: Medium
   Expand Priority: Medium
   Surface Scan Delay: 15 sec
   Cache Board Present: True
   Cache Status: OK
   Accelerator Ratio: 100% Read / 0% Write
   Drive Write Cache: Disabled
   Total Cache Size: 256 MB
   Battery Pack Count: 0
   SATA NCQ Supported: True

=> physicaldrive all show status

   physicaldrive 1I:1:1 (port 1I:box 1:bay 1, 450 GB): OK
   physicaldrive 1I:1:2 (port 1I:box 1:bay 2, 450 GB): OK
   physicaldrive 1I:1:3 (port 1I:box 1:bay 3, 450 GB): OK
   physicaldrive 1I:1:4 (port 1I:box 1:bay 4, 450 GB): OK
   physicaldrive 1I:1:5 (port 1I:box 1:bay 5, 450 GB): OK
   physicaldrive 1I:1:6 (port 1I:box 1:bay 6, 450 GB): OK
   physicaldrive 1I:1:7 (port 1I:box 1:bay 7, 450 GB): OK
   physicaldrive 1I:1:8 (port 1I:box 1:bay 8, 450 GB): OK
   physicaldrive 1I:1:9 (port 1I:box 1:bay 9, 450 GB): OK
   physicaldrive 1I:1:10 (port 1I:box 1:bay 10, 450 GB): OK
   physicaldrive 1I:1:11 (port 1I:box 1:bay 11, 450 GB, spare): OK
   physicaldrive 1I:1:12 (port 1I:box 1:bay 12, 450 GB, active spare): OK


=> array all show status

array AOK

=> logicaldrive all show status
   logicaldrive 1 (3.7 TB, 5): OK

If you don’t have battery or it takes long to replace it then you should enable no-battery write cache.

ctrl all show detail
hpacucli ctrl slot=0 modify nbwc=enable
hpacucli ctrl slot=0 modify dwc=enable forced
Jul 072016
 

A simple cron job removing old kernels.

You may find yourself in situation where linux kernels accumulated under/boot are starting to fill up disk space. Especially painful on older systems with small /boot partition. No automated solution out of the box on Debian/Ubuntu. Here is a workaround, removing all but two newest kernels:

crontab -l

10 23 * * 1 /root/bin/kernel-cleanup.sh

 

vim /root/bin/kernel-cleanup.sh

#!/bin/bash
echo "---------- Starting autoremove, we get rid of the old kernels eating /boot space"|logger
OLD=$(ls -tr /boot/vmlinuz-* | head -n -2 | cut -d- -f2- | awk '{print "linux-image-" $0}')
if [ -n "$OLD" ]; then
 apt-get -qy remove --purge $OLD
fi

 

Bonus hint – same thing for Centos machines

# we need yum-utils
yum install yum-utils

# add cronjob
crontab -e
0 2 * * Sat root /usr/bin/package-cleanup -y --oldkernels --count=2 |logger

On Centos you can also use *installonly_limit* in /etc/yum.conf

 

installonly_limit Number of packages listed in installonlypkgs to keep installed at the same time. Setting
to 0 disables this feature. Default is '3'. Note that this functionality used to be in the "installonlyn"
plugin, where this option was altered via tokeep. Note that as of version 3.2.24, yum will now look in the
yumdb for a installonly attribute on installed packages. If that attribute is "keep", then they will never
be removed.