Monday, May 9, 2016

Vcenter Alarms ps1

#Connect to vCenter Server;
$vCenter="p111vc01.st.com"
$username="st\admin.rb"
$password=""
Connect-VIServer -Server $vCenter -Protocol https -User $username -Password $password -WarningAction SilentlyContinue | Out-Null

#Set Notification emails here;
$MailTo= "core@s$.com"

#define alarms to be set;
$actalarm1 ="Cannot connect to storage"
$actalarm2 ="Cannot find vSphere HA master agent"
$actalarm3 ="Datastore capability alarm"
$actalarm4 ="Datastore cluster is out of space"
$actalarm5 ="Datastore is in multiple datacenters"
$actalarm6 ="Datastore usage on disk"
$actalarm7 ="Exit standby error"
$actalarm8 ="Health status changed alarm"
$actalarm9 ="Health status monitoring"
$actalarm10 ="Host Baseboard Management Controller status"
$actalarm11 ="Host battery status"
$actalarm12 ="Host connection and power state"
$actalarm13 ="Host connection failure"
$actalarm14 ="Host cpu usage"
$actalarm15 ="Host error"
$actalarm16 ="Host hardware fan status"
$actalarm17 ="Host hardware power status"
$actalarm18 ="Host hardware system board status"
$actalarm19 ="Host hardware temperature status"
$actalarm20 ="Host hardware voltage"
$actalarm21 ="Host IPMI System Event Log status"
$actalarm22 ="Host memory status"
$actalarm23 ="Host memory usage"
$actalarm24 ="Host processor status"
$actalarm25 ="Host service console swap rates"
$actalarm26 ="Host storage status"
$actalarm27 ="Insufficient vSphere HA failover resources"
$actalarm28 ="License capacity monitoring"
$actalarm29 ="License error"
$actalarm30 ="License inventory monitoring"
$actalarm31 ="License user threshold monitoring"
$actalarm32 ="Migration error"
$actalarm33 ="Network connectivity lost"
$actalarm34 ="Network uplink redundancy degraded"
$actalarm35 ="Network uplink redundancy lost"
$actalarm36 ="No compatible host for Secondary VM"
$actalarm37 ="Pre-4.1 host connected to SIOC-enabled datastore"
$actalarm38 ="SRM Consistency Group Violation"
$actalarm39 ="Status of other host hardware objects"
$actalarm40 ="Storage DRS is not supported on Host."
$actalarm41 ="Storage DRS recommendation"
$actalarm42 ="The host license edition is not compatible with the vCenter Server license edition."
$actalarm43 ="Thin-provisioned volume capacity threshold exceeded."
$actalarm44 ="Timed out starting Secondary VM"
$actalarm45 ="Unmanaged workload detected on SIOC-enabled datastore"
$actalarm46 ="Virtual machine Consolidation Needed status"
$actalarm47 ="Virtual machine cpu usage"
$actalarm48 ="Virtual machine error"
$actalarm49 ="Virtual machine Fault Tolerance state changed"
$actalarm50 ="Virtual Machine Fault Tolerance vLockStep interval Status Changed"
$actalarm51 ="Virtual machine memory usage"
$actalarm52 ="VMKernel NIC not configured correctly"
$actalarm53 ="vSphere Distributed Switch MTU matched status"
$actalarm54 ="vSphere Distributed Switch MTU supported status"
$actalarm55 ="vSphere Distributed Switch teaming matched status"
$actalarm56 ="vSphere Distributed Switch vlan trunked status"
$actalarm57 ="vSphere HA failover in progress"
$actalarm58 ="vSphere HA host status"
$actalarm59 ="vSphere HA virtual machine failover failed"
$actalarm60 ="vSphere HA virtual machine monitoring action"
$actalarm61 ="vSphere HA virtual machine monitoring error"


# Delete Trigger;
Get-AlarmDefinition -Name “$actAlarm1", “$actAlarm2", “$actAlarm3", “$actAlarm4", “$actAlarm5", “$actAlarm6", “$actAlarm7", “$actAlarm8", “$actAlarm9", “$actAlarm10", “$actAlarm11", “$actAlarm12", “$actAlarm13", “$actAlarm14", “$actAlarm15", “$actAlarm16", “$actAlarm17", “$actAlarm18", “$actAlarm19", “$actAlarm20", “$actAlarm21", “$actAlarm22", “$actAlarm23", “$actAlarm24", “$actAlarm25", “$actAlarm26", “$actAlarm27", “$actAlarm28", “$actAlarm29", “$actAlarm30", “$actAlarm31", “$actAlarm32", “$actAlarm33", “$actAlarm34", “$actAlarm35", “$actAlarm36", “$actAlarm37", “$actAlarm38", “$actAlarm39",“$actAlarm40",“$actAlarm41",“$actAlarm42",“$actAlarm43",“$actAlarm44",“$actAlarm45",“$actAlarm46",“$actAlarm47",“$actAlarm48",“$actAlarm49",“$actAlarm50",“$actAlarm51",“$actAlarm52",“$actAlarm53",“$actAlarm54",“$actAlarm55",“$actAlarm56",“$actAlarm57",“$actAlarm58",“$actAlarm59",“$actAlarm60",“$actAlarm61" | Get-AlarmAction | Remove-AlarmAction -Confirm:$false

# Create Trigger;
Get-AlarmDefinition -Name “$actAlarm1", “$actAlarm2", “$actAlarm3", “$actAlarm4", “$actAlarm5", “$actAlarm6", “$actAlarm7", “$actAlarm8", “$actAlarm9", “$actAlarm10", “$actAlarm11", “$actAlarm12", “$actAlarm13", “$actAlarm14", “$actAlarm15", “$actAlarm16", “$actAlarm17", “$actAlarm18", “$actAlarm19", “$actAlarm20", “$actAlarm21", “$actAlarm22", “$actAlarm23", “$actAlarm24", “$actAlarm25", “$actAlarm26", “$actAlarm27", “$actAlarm28", “$actAlarm29", “$actAlarm30", “$actAlarm31", “$actAlarm32", “$actAlarm33", “$actAlarm34", “$actAlarm35", “$actAlarm36", “$actAlarm37", “$actAlarm38", “$actAlarm39",“$actAlarm40",“$actAlarm41",“$actAlarm42",“$actAlarm43",“$actAlarm44",“$actAlarm45",“$actAlarm46",“$actAlarm47",“$actAlarm48",“$actAlarm49",“$actAlarm50",“$actAlarm51",“$actAlarm52",“$actAlarm53",“$actAlarm54",“$actAlarm55",“$actAlarm56",“$actAlarm57",“$actAlarm58",“$actAlarm59",“$actAlarm60",“$actAlarm61" | New-AlarmAction -Email -To "$MailTo"

Get-AlarmDefinition -Name “$actAlarm1", “$actAlarm2", “$actAlarm3", “$actAlarm4", “$actAlarm5", “$actAlarm6", “$actAlarm7", “$actAlarm8", “$actAlarm9", “$actAlarm10", “$actAlarm11", “$actAlarm12", “$actAlarm13", “$actAlarm14", “$actAlarm15", “$actAlarm16", “$actAlarm17", “$actAlarm18", “$actAlarm19", “$actAlarm20", “$actAlarm21", “$actAlarm22", “$actAlarm23", “$actAlarm24", “$actAlarm25", “$actAlarm26", “$actAlarm27", “$actAlarm28", “$actAlarm29", “$actAlarm30", “$actAlarm31", “$actAlarm32", “$actAlarm33", “$actAlarm34", “$actAlarm35", “$actAlarm36", “$actAlarm37", “$actAlarm38", “$actAlarm39",“$actAlarm40",“$actAlarm41",“$actAlarm42",“$actAlarm43",“$actAlarm44",“$actAlarm45",“$actAlarm46",“$actAlarm47",“$actAlarm48",“$actAlarm49",“$actAlarm50",“$actAlarm51",“$actAlarm52",“$actAlarm53",“$actAlarm54",“$actAlarm55",“$actAlarm56",“$actAlarm57",“$actAlarm58",“$actAlarm59",“$actAlarm60",“$actAlarm61" |Get-AlarmAction | New-AlarmActionTrigger -StartStatus "Green" -EndStatus "Yellow"

Get-AlarmDefinition -Name “$actAlarm1", “$actAlarm2", “$actAlarm3", “$actAlarm4", “$actAlarm5", “$actAlarm6", “$actAlarm7", “$actAlarm8", “$actAlarm9", “$actAlarm10", “$actAlarm11", “$actAlarm12", “$actAlarm13", “$actAlarm14", “$actAlarm15", “$actAlarm16", “$actAlarm17", “$actAlarm18", “$actAlarm19", “$actAlarm20", “$actAlarm21", “$actAlarm22", “$actAlarm23", “$actAlarm24", “$actAlarm25", “$actAlarm26", “$actAlarm27", “$actAlarm28", “$actAlarm29", “$actAlarm30", “$actAlarm31", “$actAlarm32", “$actAlarm33", “$actAlarm34", “$actAlarm35", “$actAlarm36", “$actAlarm37", “$actAlarm38", “$actAlarm39",“$actAlarm40",“$actAlarm41",“$actAlarm42",“$actAlarm43",“$actAlarm44",“$actAlarm45",“$actAlarm46",“$actAlarm47",“$actAlarm48",“$actAlarm49",“$actAlarm50",“$actAlarm51",“$actAlarm52",“$actAlarm53",“$actAlarm54",“$actAlarm55",“$actAlarm56",“$actAlarm57",“$actAlarm58",“$actAlarm59",“$actAlarm60",“$actAlarm61" | Get-AlarmAction | New-AlarmActionTrigger -StartStatus "yellow" -EndStatus "green"

Get-AlarmDefinition -Name “$actAlarm1", “$actAlarm2", “$actAlarm3", “$actAlarm4", “$actAlarm5", “$actAlarm6", “$actAlarm7", “$actAlarm8", “$actAlarm9", “$actAlarm10", “$actAlarm11", “$actAlarm12", “$actAlarm13", “$actAlarm14", “$actAlarm15", “$actAlarm16", “$actAlarm17", “$actAlarm18", “$actAlarm19", “$actAlarm20", “$actAlarm21", “$actAlarm22", “$actAlarm23", “$actAlarm24", “$actAlarm25", “$actAlarm26", “$actAlarm27", “$actAlarm28", “$actAlarm29", “$actAlarm30", “$actAlarm31", “$actAlarm32", “$actAlarm33", “$actAlarm34", “$actAlarm35", “$actAlarm36", “$actAlarm37", “$actAlarm38", “$actAlarm39",“$actAlarm40",“$actAlarm41",“$actAlarm42",“$actAlarm43",“$actAlarm44",“$actAlarm45",“$actAlarm46",“$actAlarm47",“$actAlarm48",“$actAlarm49",“$actAlarm50",“$actAlarm51",“$actAlarm52",“$actAlarm53",“$actAlarm54",“$actAlarm55",“$actAlarm56",“$actAlarm57",“$actAlarm58",“$actAlarm59",“$actAlarm60",“$actAlarm61" |Get-AlarmAction | New-AlarmActionTrigger -StartStatus "red" -EndStatus "yellow"


#Disconnect from vCenter
Disconnect-VIServer -Server $vCenter -Force:$true -Confirm:$false

No comments:

Post a Comment

Vmware NSX SSL creation 

Using OpenSSL for NSX Manager SSL import: Creates CSR and 4096 bit KEY Creating NSX 6.4.2 SSL    openssl req -out nsxcert.csr -newkey rsa:40...