Monday, August 25, 2014

Find the ILO IP of a HP ESXi Server through the CLI

Find the ILO IP of a HP ESXi Server through the CLI

cd /opt/hp/tools

./hponcfg -w /tmp/ilo_config.txt

Open /tmp/ilo_config.txt

Wednesday, January 29, 2014


Neatened version of snapshot reporting scrip 

import-module dataontap
$HourlyResultsTooMany= @()
$HourlyResultsTooFew= @()
$HourlyResultsNone= @()

$filers = "filer1,filer2,filer3,filer4,filer5,filer6"
$filers | foreach-object {
    #write-host $_
    connect-nacontroller $_
    $vmvols = get-NaVol | Where-Object { ($_.name -like "*vmnfs*" -or $_.name -like "*vmwaredata*") -and -not ($_.name -like "*m" -or $_.name -like "*m2" -or $_.name -like "*page" -or $_.name -like "*srmph"  -or $_.name -like "*swap" -or $_.name -like "*sw" -or $_.name -like "*vdi*" -or $_.name -like "*NonProd" -or $_.name -like "*filer1syslog"  -or $_.name -like "*filer2vdisys"  -or $_.name -like "*filer40*") }
    $vmvolc = $vmvols | measure-object
    if ($vmvolc.count -gt 0) {
        $vmvols | ForEach-Object {
            $vmsnaps = Get-NaSnapshot $_.name | Where-Object { ($_.name -like "smvi*") -and ($_.name -like "*hourly*") -and ($_.name -notlike "*appsercvr*")} | measure-object
            write-host "volume: " $_.name " Snapshots: " $vmsnaps.count
             if ($vmsnaps.Count -eq 0) {
                   
                      $HourlyResultsNone += New-Object psobject -Property @{
                                           
                                            'Volume' = $_.name
                   
                                       }

                    } 
             if ($vmsnaps.Count -ge 25 ) {
                   
                     $HourlyResultsTooMany += New-Object psobject -Property @{
                            
                                            'Volume' = $_.name
                                            'No Of Snapshots' = $vmsnaps.count
                                            }                   
                       }
             if ($vmsnaps.Count -lt 24 ) {
                   
                     $HourlyResultsTooFew += New-Object psobject -Property @{
                            
                                            'Volume' = $_.name
                                            'No Of Snapshots' = $vmsnaps.count
                                        }
                    }
        }
    }
}
If ( $DailyResultsNone.count -ge 0) {
                    Send-MailMessage -From "someone@companyname.ie" -To "someone@companyname.ie" -Subject 'Hourly Snapshot Alert , Some Volumes do not have any Hourly snapshots' -Body ( $HourlyResultsNone | Out-String )
                     }

If ( $DailyResultsTooFew.count -ge 0) {
                     Send-MailMessage -From "someone@companyname.ie" -To "someone@companyname.ie" -Subject 'Hourly Snapshot Alert , Some Volumes do not have enough Hourly snapshots' -Body ( $HourlyResultsTooFew | Out-String )
                     }
                   
If ( $DailyResultsTooMany.count -ge 0) {
                     Send-MailMessage -From "someone@companyname.ie" -To "someone@companyname.ie" -Subject 'Hourly Snapshot Alert , Some Volumes have too many Hourly snapshots' -Body ( $HourlyResultsTooMany | Out-String )
                     }

Thursday, January 23, 2014

Find volumes without autodelete or autosize enabled

powershell script to loop through each of the filers looking for any VMnfs volume which did not have the autosize enabled and was not able to autogrow


import-module dataontap
$results= @()
$filers = "Filer1","Filer2","Filer3","Filer4","Filer5","Filer6"
$filers | foreach-object {
    write-host $_
    connect-nacontroller $_
    $vmvols = get-NaVol | Where-Object { ($_.name -like "*vmnfs*" -or $_.name -like "*vmwaredata*" -or $_.name -like "*VDI*" ) -and -not ($_.name -like "*m" -or $_.name -like "*m2" -or $_.name -like "*page" -or $_.name -like "*srmph"  -or $_.name -like "*swap" -or $_.name -like "*sw" -or $_.name -like "*vdi*" -or $_.name -like "*NonProd" -or $_.name -like "*filer1vmnfsvolsyslog"  -or $_.name -like "*filer2vmnfsvolvdisys"  -or $_.name -like "*filer3vmnfsvol0*") }
    foreach ($volume in $vmvols) {
        $VolumeName=$volume.name
        $volumeSize=$volume.SizeTotal
        $VolumeSizeAvailable=$volume.SizeAvailable
        $autogrow = Get-NaVolAutosize -name $volume
        $AutogrowEnabled = $autogrow.isenabled
        $SnapshotAutodelete = Get-nasnapshotautodelete $volume
        }

        If  (($AutogrowEnabled -notlike "true" ) -or ($SnapshotAutodelete[4].OptionValue -notlike "on") )
        {

       
        $results += New-Object psobject -Property @{
                                       
                                        'Volume' = $volume
                                        'AutogrowEnabled' = $autogrowEnabled
                                        'SnapshotAutodelete' = $SnapshotAutodelete[4].OptionValue
                                       }
       }
}