Bubbly
Enthusiast
Enthusiast

Script Needed: Export the vCenter alarms to CSV or text file and Import the alarms to other vCenter using the same CSV file or text file

Hi,

Could anyone provide the PowerShell/PowerCLI for below requirement:

1)Export the alarms from vCenter to CSV file or text file

2)Import the alarms from CSV file or text file to other vCenter,

0 Kudos
5 Replies
LucD
Leadership
Leadership

0 Kudos
Bubbly
Enthusiast
Enthusiast

Seen the solution but requirement is little different.

We don't need to import all the alerts. only customized alerts.

0 Kudos
LucD
Leadership
Leadership

The functions export/import 1 alarm at a time.

You can use a Where-clause in your code to export/import only those customised alerts.

How can these customised alarms be recognised ?

Is there an indication in the Name or the Description ?


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

0 Kudos
svneswar
Enthusiast
Enthusiast

Hi LucD,

Your scripts are really great and helps us a lot. Thank you.

Actually, I would like to know whether is it possible to catch the alarms info of one vcentre in to a txt file/ CSV file and then use the same txt file/ CSV file to create alarms on another vCenter.

The main problem for the above case, which I identified after going through your scripts is that "While getting the alarm info, we are catching them in PSObject of type alarm or new object of type VMware.Vim.AlarmSpec. But while saving the info in a txt file, only the object type strings will get saved but not the actual alarm info. Moreover, as it would be saved as strings in the CSV/Txt file, we cannot create the alarms on another vCenter by just using that strings". Please correct me if I am wrong.


If there is a possibility to send the the alarm info to a txt file and create the alarms from that txt file on another vCenter, please let us know.

Once again, Thanks a lot for all your time and help.

0 Kudos
LucD
Leadership
Leadership

That is exactly what Angel's functions in the link I provided above will do. The alarm will be exported to a kind of XML file in a deserialised format.

You will have to write the "main" part, where you select the required alarm(s) and then call the export function.

On the 2nd site you read all the files you created in step 1, and then import the alarm.


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

0 Kudos