Adaptec Raidstatus script for ESXi

As promised in my previous post i made a (Powershell) script which can be automated to run as a scheduled task. The script is build to run once a day. It sends an email if there is an error in the controller or one of the (logical) drive’s. On friday it always sends an email so you will know the script is still working 😉

It’s my first Powershell script so feel free to leave a comment with possible improvements 😉

<#
Script Name         : Adaptac Array Health checker
Version             : 20130419
Author              : Luke Voorn
Description         : Checks the health status of an array trough arcconf provider on ESXi
TODO                :
#>

# -------------------------------------------------------------- #
# Variables
# -------------------------------------------------------------- #

$ESXI_SERVER = "192.168.1.10"
$ESXI_PORT = "5989"
$ESXI_USER = "raidstatus"
$ESXI_PASSWORD = "raidstatuspassword"
$ADAPTEC_CARD = "1"
$ARCCONF_PATH = "C:\Program Files (x86)\Adaptec\RemoteArcconf\arcconf.exe"
[string[]]$MAILTO = "email1@domain.nl", "email2@domain.nl"
$MAILFROM = "email3@domain.nl"
$SMTPSERVER = "192.168.1.20"

# -------------------------------------------------------------- #
# End Variables
# -------------------------------------------------------------- #

$global:SomethingInError="False"

function GetStatusData {
    $ARCCONF_ARG = " SETVMCREDENTIAL $ESXI_SERVER $ESXI_PORT $ESXI_USER $ESXI_PASSWORD"
    Start-Process $ARCCONF_PATH -ArgumentList " $ARCCONF_ARG" -Wait
    $result = &$ARCCONF_PATH getconfig $ADAPTEC_CARD
    return $result
}

function ParseTheData {
    param([string[]]$FunctionInput)
    
    $Count = 0
    $Output = @() #create empty error

    ForEach($s in $FunctionInput) {
        If ($s.Contains("Controller Status") -and $s.Contains("Optimal")){
            $Output + $s
        }
        ElseIf ($s.Contains("Controller Status") -and !$s.Contains("Optimal")){
            $Output + $s
            $global:SomethingInError = "True"
        }


        if ($s.Contains("Status of logical device") -and $s.Contains("Optimal")){
            $Output += $s
        }
        elseif ($s.Contains("Status of logical device") -and !$s.Contains("Optimal")){
            $Output += $s
            $global:SomethingInError = "True"
        }

         if ($s.Contains("Device is a Hard drive") -and $FunctionInput.GetValue($Count +1).Contains("Online")){
            $Output += ($FunctionInput.GetValue($Count -1)) + ($FunctionInput.GetValue($Count +1))
        }
        elseif ($s.Contains("Device is a Hard drive") -and !$FunctionInput.GetValue($Count +1).Contains("Online")){
            $Output += ($FunctionInput.GetValue($Count -1)) + ($FunctionInput.GetValue($Count +1))
            $global:SomethingInError = "True"
        }

        $Count++
    }
    return $Output
}

function MailResults {
        param([string[]]$ResultArray)

        $MAILSUBJECT = ""
        $MAILBODY = ""

        ForEach ($s in $ResultArray){

            $MAILBODY = $MAILBODY + $s
            $MAILBODY = $MAILBODY + [Environment]::NewLine
        }


        if ($global:SomethingInError -eq "True"){
            $MAILSUBJECT = "Adapter in ERROR"

        }
        elseif ((Get-Date).DayOfWeek.value__ -eq 5 -and $global:SomethingInError -eq "False"){
            $MAILSUBJECT = "Adapter OK: weekly status"
        }
        

        ForEach($e in $MAILTO){
            Send-MailMessage -to "$e" -Subject "$MAILSUBJECT" -from "$MAILFROM" -body "$MAILBODY" -SmtpServer "$SMTPSERVER" 
        }

}
$Raw = GetStatusData
$result = ParseTheData -FunctionInput $Raw
MailResults -ResultArray $result

Posted in Powershell, Vmware, Windows | Tagged , , , | 4 Comments

Monitor Adaptec 3405 health on VMware ESXi 5.x

For my work i had to install a supermicro server with ESXi 5.1. This server had a adaptec 3405 raid card which works fine with ESXi 5.x but you can’t see the health status of the array(s) in the VSphere Client. After a lot of messing around with esxi drivers i did not get this to work. There is however a way to monitor the array status and this is done from a guest OS (in my case windows 8), or if you have one, another server.

To get this working you need to follow the following steps:

  • Download cim_vmware_v7_30_18837.zip from adaptec. If you can’t find it, let me know in the comments and i will mail it to you.
  • Extract vmware-esx-provider-arcconf.vib from the zip file. It is located in cim\esxi5_0\cim
  • Install the VIB using esxcli (google it if you don’t know how)
  • Reboot? Not sure if this is needed.
  • Now install remote arcconf also found in the ZIP file. Arcconf is available for linux and windows. I used the windows version.
  • Open an elevated command prompt and run the following commands:

arcconf SETVMCREDENTIAL 192.168.1.1 5989 esxiUser esxiPassword
arcconf getconfig 1

The first command sets the connection info to your ESXi host, 192.168.1.1 is the IP, 5989 is the default TCP port, esxiUser the user and esxiPassword the password. The account needs administrator permissions to make this work. I will try to find out if an read only account is possible.

The second command gets the config/status of the first adapter on the ESXI machine. You can easily write a script to fetch the status and email it using powershell for example. I am going to write such a script and will post it here when finished.

UPDATE: You can find the script here: https://www.tuser.nl/2013/04/19/adaptec-raidstatus-script-for-esxi/
UPDATE 2: Please read the post from Christoph below (thanks!). An additional piece of software is needed to make this work.

The output of the command should be something like this:

Controllers found: 1
----------------------------------------------------------------------
Controller information
----------------------------------------------------------------------
   Controller Status                        : Optimal
   Channel description                      : SAS/SATA
   Controller Model                         : Adaptec 3405
   Controller Serial Number                 : 8C421XXXXXX
   Physical Slot                            : 3
   Temperature                              : 47 C/ 116 F (Normal)
   Installed memory                         : 128 MB
   Copyback                                 : Disabled
   Background consistency check             : Disabled
   Automatic Failover                       : Enabled
   Global task priority                     : High
   Stayawake period                         : Disabled
   Spinup limit internal drives             : 0
   Spinup limit external drives             : 0
   Defunct disk drive count                 : 0
   Logical devices/Failed/Degraded          : 1/0/0
   NCQ status                               : Enabled
   --------------------------------------------------------
   Controller Version Information
   --------------------------------------------------------
   BIOS                                     : 5.2-0 (17342)
   Firmware                                 : 5.2-0 (17342)
   Driver                                   : 1.2-1 (29800)
   Boot Flash                               : 5.2-0 (17342)
   --------------------------------------------------------
   Controller Battery Information
   --------------------------------------------------------
   Status                                   : Charging
   Over temperature                         : No
   Capacity remaining                       : 98 percent
   Time remaining (at current draw)         : 5 days, 10 hours, 48 minutes

----------------------------------------------------------------------
Logical device information
----------------------------------------------------------------------
Logical device number 0
   Logical device name                      : R5
   RAID level                               : 5
   Status of logical device                 : Optimal
   Size                                     : 420290 MB
   Stripe-unit size                         : 256 KB
   Read-cache mode                          : Enabled
   Write-cache mode                         : Enabled (write-back)
   Write-cache setting                      : Enabled (write-back)
   Partitioned                              : No
   Protected by Hot-Spare                   : No
   Bootable                                 : Yes
   Failed stripes                           : No
   Power settings                           : Disabled
   --------------------------------------------------------
   Logical device segment information
   --------------------------------------------------------
   Segment 0                                : Present (Controller:1,Enclosure:0,Slot:0)         BJA0PAXXXXXX
   Segment 1                                : Present (Controller:1,Enclosure:0,Slot:1)         BJA0PAXXXXXX
   Segment 2                                : Present (Controller:1,Enclosure:0,Slot:2)         BJA0PAXXXXXX
   Segment 3                                : Present (Controller:1,Enclosure:0,Slot:3)         BJA0PAXXXXXX

----------------------------------------------------------------------
Physical Device information
----------------------------------------------------------------------
      Device #0
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SAS 3.0 Gb/s
         Reported Channel,Device(T:L)       : 0,0(0:0)
         Reported Location                  : Enclosure 0, Slot 0
         Reported ESD(T:L)                  : 2,0(0:0)
         Vendor                             : FUJITSU
         Model                              : MBA3147RC
         Firmware                           : 0103
         Serial number                      : BJA0PAXXXXXX
         World-wide name                    : 500000E115XXXXXX
         Size                               : 140272 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : None
         S.M.A.R.T.                         : No
         S.M.A.R.T. warnings                : 0
         Power State                        : Unknown
         Supported Power States             : Full rpm
      Device #1
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SAS 3.0 Gb/s
         Reported Channel,Device(T:L)       : 0,1(1:0)
         Reported Location                  : Enclosure 0, Slot 1
         Reported ESD(T:L)                  : 2,0(0:0)
         Vendor                             : FUJITSU
         Model                              : MBA3147RC
         Firmware                           : 0103
         Serial number                      : BJA0PAXXXXXX
         World-wide name                    : 500000E115XXXXXX
         Size                               : 140272 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : None
         S.M.A.R.T.                         : No
         S.M.A.R.T. warnings                : 0
         Power State                        : Unknown
         Supported Power States             : Full rpm
      Device #2
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SAS 3.0 Gb/s
         Reported Channel,Device(T:L)       : 0,2(2:0)
         Reported Location                  : Enclosure 0, Slot 2
         Reported ESD(T:L)                  : 2,0(0:0)
         Vendor                             : FUJITSU
         Model                              : MBA3147RC
         Firmware                           : 0103
         Serial number                      : BJA0PAXXXXXX
         World-wide name                    : 500000E115XXXXXX
         Size                               : 140272 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : None
         S.M.A.R.T.                         : No
         S.M.A.R.T. warnings                : 0
         Power State                        : Unknown
         Supported Power States             : Full rpm
      Device #3
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SAS 3.0 Gb/s
         Reported Channel,Device(T:L)       : 0,3(3:0)
         Reported Location                  : Enclosure 0, Slot 3
         Reported ESD(T:L)                  : 2,0(0:0)
         Vendor                             : FUJITSU
         Model                              : MBA3147RC
         Firmware                           : 0103
         Serial number                      : BJA0PAXXXXXX
         World-wide name                    : 500000E115XXXXXX
         Size                               : 140272 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : None
         S.M.A.R.T.                         : No
         S.M.A.R.T. warnings                : 0
         Power State                        : Unknown
         Supported Power States             : Full rpm
      Device #4
         Device is an Enclosure services device
         Reported Channel,Device(T:L)       : 2,0(0:0)
         Enclosure ID                       : 0
         Type                               : SES2
         Vendor                             : ADAPTEC
         Model                              : Virtual SGPIO
         Firmware                           : 0001
         Status of Enclosure services device
Posted in Vmware, Windows | Tagged , , , , , | 10 Comments

Install HP Color Laserjet CM1312nfi on Windows 7 or Windows 8

Installing this printer is actually quite simple if you know how to do it. It cost me some hours to figure out. The problem with the installer is that whether you choose USB or Network it fails on the step “Connecting device” or the step where you have to plugin the printer using USB. Some things i tried:

  • Every possible version of the full solution package
  • Running as administrator
  • Running in compatibility mode
  • Disable firewall and make sure host-name could be resolved.

The solution is to log in as administrator and not “run as” administrator:

  1. Right-click “Computer” and click “Manage”.
  2. Open “Local Users and Groups” -> “Users”.
  3. Double click on “Administrator” and uncheck “Account is disabled” and click OK.
  4. Right-click “Administrator” and “set password…”

Now log out and log in again with Administrator and run the setup. In my case i had the Compatibility settings set to Vista. Not sure if this is nessecary. Remember to disable the administrator account again if you are done. I have successfully installed the Solution on Windows 8 64bit. I guess this also works for Windows 7.

For printing you can also use the HP Universal Driver for network printing, but if you want to Fax and Scan via network you really need the full solution.

Posted in General, Windows | Tagged , , , , , | Leave a comment

Export blacklist and whitelist from ESVA and import to EFA

If you are migrating from ESVA to EFA you can export and import the black/whitelist with a simple script i wrote. note: This script doesn’t check for double entry’s.

  1. ssh to your ESVA server
  2. wget http://dl.efa-project.org/exportlists.sh
  3. chmod +x exportlists.sh
  4. ./exportlists.sh
  5. There should be a output.sql file in the directory where you executed the script. Copy this to your EFA server. You can use scp for example: scp output.sql efaadmin@<yourEFAhost>:
  6. Now ssh to your EFA machine.
  7. Execute the following command to import the black/whitelist: mysql -u root -p`cat /etc/mysql/EFA.cnf` < output.sql
  8. All done.

*Optional*
By default, the black and whitelist entry’s are added under the root (id=1) account of EFA. If you want them added under another account, just change the @userid variable in the first line of output.sql. To find out the userid:

  1. Login to the EFA webinterface
  2. Go to settings -> accounts
  3. Click on the icon of the desired user
  4. The id can be found in the addressbar, for example http://<EFAhost>/accounts/user/2/. 2 is the userid.

You can get EFA here: http://www.efa-project.org/

Posted in Linux | Tagged , | Leave a comment

SRSS 2008: An error occurred within the report server database on report deployment

When i tried to deploy a edited report, it gave me the following error:

An error occurred within the report server database. This may be due to a connection failure, timeout or low disk condition within the database. 

I tried this via Visual Studio 2008 and via report builder 2.0. Both with the same result. The Report builder however gave me a extra line of error:  (rsReportServerDatabaseError) Get Online Help For more information about this error navigate to the report server on the local server machine, or enable remote errors.  So i decided to turn on remote errors to see what went wrong. After some googling i found the following microsoft page. When i enabled remote errors i tried again via report builder and it gave me the following error:

An error occurred within the report server database. This may be due to a connection failure, timeout or low disk condition within the database. —> Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerStorageException: An error occurred within the report server database. This may be due to a connection failure, timeout or low disk condition within the database. —> System.Data.SqlClient.SqlException: Length of LOB data (244318) to be replicated exceeds configured maximum 65536.
The statement has been terminated.

No idea what LOB data is. But i found how you can increase this value here. I executed the following 2 commands (can take a few minutes)

sp_configure ‘max text repl size’, 2147483647
RECONFIGURE

After this i was be able to deploy my edited reports again 🙂

Posted in SQL Reporting Services | Tagged , , , , | 1 Comment

Regain Root access on Asus TF300T after official update 10.4.2.13

So i downloaded and installed the official 10.4.2.13 update from the Asus website. After this i had no root access anymore (as expected). I found a few manuals which described to regain root access which includes to download a file of 400+ MB. There is a simpler way to regain root access:

  • Install TWRP: http://teamw.in/project/twrp2/97 (use the fasboot method)
  • Boot into TWRP (hold power and volume down, select recovery using volume down and confirm with volume up)
  • Flash SuperSU (0.93-Busybox-1.20.2 in my case)
  • All done

Good Luck!

Posted in Android | Tagged , , , , | Leave a comment

OpenVPN on TF300T after Jelly Bean update

I recently updated my (rooted) Asus Transformer TF300T to the latest Android version which is Android 4.1.1 (Jelly Bean). After updating OpenVPN failed to connect with an error that looked like “ifconfig, external program fork failed”. (I can’t remember the exact error).

So i tried a number of things to make OpenVPN work again:

  • Factory reset.
  • Reinstall BusyBox at every possible location.
  • Tried different BusyBox installers.
  • Reinstall OpenVPN binaries at every possible location.

Then i found a topic where someone was having issues with superuser since he upgraded to Jelly Bean. The solution for him was to flash another version of superuser. When i flashed SuperSU to my tablet OpenVPN was be able to make a connection. I did reinstall busybox bofore trying but i am not sure if this is necessary.

Posted in Android, OpenVPN | Tagged , , , , | 1 Comment

Icarus Go (DRIGL) firmware

If you are looking for a firmware update for your Icarus Go e-reader with a DRIGLxxxxxx serial. You have to visit the following site:

http://www.icarusreader.com/downloads-go

Dont go to icarusreader.com and “downloads->firmware->ICARUS GO (E600BK) FIRMWARE ” because non of those firmwares works with this version of the Icarus GO. I read somewhere that the DRIGK110000-DRIGK999999 firmware should be compatible with DRIGL devices but this is not the case! You won’t brick your e-reader but after the update the screen doesn’t work anymore. You can still reflash the reader with the correct firmware.

Posted in General | Tagged , , , | Leave a comment

Trendline with weighed average percentage from other dataset in SRSS 2008

For a report at my work (at a callcenter) I had to create a chart with a percentage of failed calls per agent per day. This chart also had to contain 1 line which represented the weighed average percentage of failed calls of all the agents. This could not be done with calculated series because the percentage would not be a weighted average.

By the way for those who don’t know what a weighted average means. Imagine you have 2 agents:
Agent 1, 2000 calls, 2% fail
Agent 2, 10 calls, 40% fail
You cannot simply add 2% and 40% and divide it by 2 (21%). The 2% failed calls of agent 1 weighs much more than the 40% failed calls of agent 2 which only did 10 calls. So to get a weighed percentage you have to add the number of total calls and the number of total fails and get a percentage of that. In this example the failed call percentage would be 2.189055%. Dataset 2 calculates the weighed percentage.

So after some trial and error I found a way to accomplish this in SRSS 2008. There are 2 datasets which output the following data:

Dataset 1: input (from date, to date, (agent 1, agent 3, agent 10))
Outlput:

Date Agent % of failed calls
20120701 Agent 1 1
20120701 Agent 2 4
20120701 Agent 3 2
20120702 Agent 1 0
20120702 Agent 2 5
20120702 Agent 3 2
20120703 Agent 1 1
20120703 Agent 2 7
20120703 Agent 3 2

Dataset 2: input (from date, to date)
Output:

Average % of Failed calls
2%

Let’s presume there are 50 agents in database. Dataset 2 returns the average of all these 50 Agents.
Now we create a (line) chart (% of failed calls is called Hangup in this example):

Now to add a line which represents the average value from Dataset do the following:
– Click the + button next to Values
– Choose expression
– Type the following: =Sum(Fields!Hangup.Value, “Dataset2”)
– Click OK

It should look like this now:

So one thing has to be done:
– Right click the new created series and choose series properties
– Choose visibility and choose “Show or hide based on an expression”
– Use the following expression: =IIF(RowNumber(Nothing) = 1, False, True)
– Click ok and go to “Legend”. Here you can enter a custom legend text like “Avarage % of failed calls”
– Click ok and you’re finished!

Good luck!

Posted in SQL Reporting Services | Tagged , , , | Leave a comment

Unable to Uninstall powershell v1.0 for server 2008 upgrade

When i tried to upgrade a windows 2003 server to windows 2008 server, the installation wizard told me i had to remove powershell before i could continue with the upgrade.
– I have searched in add/remove programs to remove it
– I tried to find and remove any of the following updates: KB923845, KB943295, KB925902, KB936059, KB942841,KB926139,KB926140
But without succes. So i was going to try to upgrade powershell to v2.0 and found out that powershell v2.0 is a component of Windows Management Framework which was installed on the server. After uninstalling Windows Management Framework i was able to upgrade my server 🙂

Posted in Windows | Tagged , , , , | Leave a comment