Highlighted
Enthusiast
Enthusiast

Export Alarms and definitions from VCenter.

Jump to solution

HI LuCD,

I am opening a new thread to export all alarms whether enable or disable in the Venter. I have taken reference from thread Re: Export All Alarms and definitions from VCenter.  but it's not working for me correctly. It's exporting partila number of alarms. I want to export all alarms from vcenter which either enabled or disabled from vcenter. Could you please help me with it.

1 Solution

Accepted Solutions
Highlighted
User Moderator
User Moderator

Let's start with this one

Get-AlarmDefinition -PipelineVariable alarm |

ForEach-Object -Process {

    New-Object -TypeName PSObject -Property ([ordered]@{

        Alarm = $alarm.Name

        Description = $alarm.Description

        Enabled = $alarm.Enabled

        Entity = $alarm.Entity

        Action = (Get-AlarmAction -AlarmDefinition $alarm).ActionType -join ' | '

        'Last Modified' = $alarm.ExtensionData.Info.LastModifiedTime

        'Last Modified By' = $alarm.ExtensionData.Info.LastModifiedUser

    })

} | Export-Csv -Path .\report.csv -NoTypeInformation -UseCulture


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

8 Replies
Highlighted
User Moderator
User Moderator

What do you want to see in the export, besides Name,Description,Entity,Enabled?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Highlighted
VMware Employee
VMware Employee

Moderator: You're already actively engaged in another thread - no need to create your own as well.

Thread locked.

0 Kudos
Highlighted
User Moderator
User Moderator

scott28tt This request is different, the other thread wanted to have all triggers on a separate line.

Thread unlocked


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Highlighted
VMware Employee
VMware Employee
0 Kudos
Highlighted
User Moderator
User Moderator

Let's start with this one

Get-AlarmDefinition -PipelineVariable alarm |

ForEach-Object -Process {

    New-Object -TypeName PSObject -Property ([ordered]@{

        Alarm = $alarm.Name

        Description = $alarm.Description

        Enabled = $alarm.Enabled

        Entity = $alarm.Entity

        Action = (Get-AlarmAction -AlarmDefinition $alarm).ActionType -join ' | '

        'Last Modified' = $alarm.ExtensionData.Info.LastModifiedTime

        'Last Modified By' = $alarm.ExtensionData.Info.LastModifiedUser

    })

} | Export-Csv -Path .\report.csv -NoTypeInformation -UseCulture


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Highlighted
Enthusiast
Enthusiast

Hi LuCd,

Thanks for help. It is working perfectly. Need one more help.

What will be script if i want to export these alarms and import in other vcenter to make them as a standard.

We don't want different vcenter at have different alarm definitions , they all should have same definitions.

Thanks

0 Kudos
Highlighted
User Moderator
User Moderator

Then you could have a look at KB1032660


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Highlighted
Enthusiast
Enthusiast

Thanks LuCD for help

0 Kudos