- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Retrieve list of alarm descriptions in C#
How do I do it? It seems like such a simple thing yet I'm struggling (I can do other things like get VMs, DC's, etc but I am still learning...). I can get the alarm ID's, just having trouble with the descriptions.
Can someone please point me in the right direction?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How are you retrieving the alarms?
One method is to use the AlarmManger and the GetAlarm() method - http://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc_50%2Fvim.alarm.Alar... which will return you an array of Alarms. If you loop through each one, you will see that you can retrieve the description for the alarm which is extended in the AlarmSpec http://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc_50%2Fvim.alarm.Alar...
(e.g. alarm->info->AlarmSpec->description)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Once you have a list of mObj for the Alarms, then retrieve AlarmInfo from the mObj for each Alarm using 'info' property. AlarmInfo inherits the 'description' property from AlarmSpec.
I can dig out some code if you like ![]()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the responses guys, Here is the code I've got so far, any ideas why its not working?:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you want to get a list of descriptions for all alarms currently defined, then you first need to get a reference to the AlarmManager from the ServiceContent obtained from your connection to vCenter.
The use GetAlarm on the AlarmManager to get an array of ManagedObject IDs for all the alarms.
Then loop through this list of mObj, to obtain the AlarmInfo (using info) using a property collector function. Info.Description will be the description for each alarm.
What are you trying to do with Alarms?
If its import and export I have that covered - see link below ![]()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you have any perl api script to get the list of alarm (VM alarm) with description ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please give a complete answer with code sample ....