-
Notifications
You must be signed in to change notification settings - Fork 915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add vCenter Alarm support #3516
Conversation
fa9fd45
to
e97164b
Compare
EventEx will have an empty FullFormattedMessage field, as the event is not predefined in vCenter.
This command can be used to trigger alarms and test use of EventEx in general.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I built a govc locally from your change, but when I ran the alarm commands with $vm passed, I always get the following error:
$ govc alarms vm-lcm-izrm
govc: 2 objects at path "vm-lcm-izrm": [VirtualMachine:vm-159 VirtualMachine:vm-159]
I don't think this is specific to your change as the error message seems to be coming from the datacenter.go
file here: https://github.com/vmware/govmomi/blob/main/govc/flags/datacenter.go#L177.
Other than that, the change LGTM. Thanks again for adding this support in all components!
Thanks for reviewing and trying it out @dilyar85 ! % govc alarms vm-lcm-oyr0
govc: 2 objects match "vm-lcm-oyr0": [VirtualMachine:vm-174 VirtualMachine:vm-174] (unique inventory path required) You can see with Since you're trying it out, you can see the alarms in action w/ the doc from create: % export GOVC_SHOW_UNRELEASED=true
% govc alarm.create -n "My Alarm" -green my.alarm.success -yellow my.alarm.failure
% govc event.post -i my.alarm.failure vm/folder/vm-name
% govc alarms vm/folder/vm-name |
Yep, it worked perfectly after specifying the VM inventory path: $ govc alarm.create -n "My Alarm" -green my.alarm.success -yellow my.alarm.failure
$ govc event.post -i my.alarm.failure vm/Namespaces/vm-lcm-6hgu25/vm-lcm-oyr0
$ govc alarms vm/Namespaces/vm-lcm-6hgu25/vm-lcm-oyr0
Alarm Name Object Severity Triggered Time Acknowledged Time Acknowledged By
My Alarm VirtualMachine:vm-174 Warning Aug 9 16:35:49 Thanks for improving the error message as well! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
vcsim: add AlarmManager
govc: add alarm commands
api: add alarm package with helpers for AlarmManager and Alarms
govc: add event.post command
fix: govc: output Message field for 'EventEx' types