How do I get a history of vCenter alarms over the last day/month/year?


You can use the following script to list all alerts from the last 24 hours where the alarm state has changed from Green > Yellow, as well as Yellow > Red.

Quite handy if you need an overview of the important events (even if they’ve since been resolved) from the last day.  You can easily view events from the last week by changing the adddays(-1) to a -7.  Alternatively, adddays(-1) could be replaced by addmonths(-1) or addyears(-1) for an even greater amount of history (assuming your vCenter logs go back that far).  Just remember to always use negative numbers to reference the past.

Install PowerCLI and run from there.  You can omit the -user and -password switches if you use the SSO service for passthrough authentication.


Leave a Reply

Your email address will not be published. Required fields are marked *