Monday, August 25, 2014
After swapping a couple of defective harddisks, i was wondering why i never got a predictive failure from my Areca controller.
The weird thing is: the logging shows warnings:
2014-08-24 23:15:37 IDE Channel #08 Reading Error
2014-08-24 23:15:28 IDE Channel #08 Reading Error
2014-08-24 23:15:19 IDE Channel #08 Reading Error
2014-08-24 23:15:10 IDE Channel #08 Reading Error
However.. the controller doesn’t seem to do anything with the s.m.a.r.t. values.
Here’s a script you might want to use as a base to get your monitoring up and running.
#!/bin/bash
CLI="/path/to/cli32"
NR_OF_PORTS=`$CLI disk info | wc -l`
# subtract 4 to get rid of the formatting and determine the real number of disks
NR_OF_PORTS=`expr $NR_OF_PORTS - 4`
echo "Controller has $NR_OF_PORTS ports"
for (( i=1; i<=$NR_OF_PORTS; i++ ))
do
RELOC_SECT=`$CLI disk smart drv=$i | grep "Reallocated Sector Count" | awk '{print $9}'`
if [ -z "$RELOC_SECT" ]; then
echo "Port $i = No Disk"
else
echo "Port $i = $RELOC_SECT"
fi
done
Friday, July 18, 2014
Quest active directory powershell module has this nice property for user and computer objects: ParentContainer
Microsoft’s native ActiveDirectory module doesn’t.
I’m using this property a lot because it looks much more friendly than the CanonicalName.
Here’s a simple function to achieve the same.
function CanonicalName_to_ParentContainer ($cname)
{
try
{
$lastslash = $cname.lastindexof("/")
$cname.substring(0,$lastslash)
}
catch
{
$cname
}
}
Friday, May 9, 2014
My lifesaver:
create and chmod +x the file:
/etc/grub.d/15_Windows
Add this code:
#! /bin/sh -e
echo "Adding Windows" >&2
cat << EOF
menuentry "Windows" {
set root=(hd0,1)
chainloader +1
}
EOF
for grub2:
grub2-mkconfig -o /boot/grub2/grub2.cfg
or:
grub-mkconfig -o /boot/grub/grub.cfg
Thursday, April 17, 2014
By default, powershell uses your regional settings. So when importing data from external files, a simple get-date or typecast to [DateTime] does not always give the correct value.
With the template below, you can interpret any format.
PS> $timeinfo = '12 07 2012 18 02'
PS> $template = 'HH mm yyyy dd MM'
PS> [DateTime]::ParseExact($timeinfo, $template, $null)
Samstag, 18. Februar 2012 12:07:00
Values can be:
d Day of month 1-31
dd Day of month 01-31
ddd Day of month as abbreviated weekday name
dddd Weekday name
h Hour from 1-12
H Hour from 1-24
hh Hour from 01-12
HH Hour from 01-24
m Minute from 0-59
mm Minute from 00-59
M Month from 1-12
MM Month from 01-12
MMM Abbreviated Month Name
MMMM Month name
s Seconds from 1-60
ss Seconds from 01-60
t A or P (for AM or PM)
tt AM or PM
yy Year as 2-digit
yyyy Year as 4-digit
z Timezone as one digit
zz Timezone as 2-digit
zzz Timezone