-
Notifications
You must be signed in to change notification settings - Fork 311
New sample for appliance Health #177
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
Conversation
@aspurohit, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
@aspurohit, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
@aspurohit, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
@aspurohit, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
""" | ||
|
||
__author__ = 'VMware, Inc.' | ||
__copyright__ = 'Copyright 2017 VMware, Inc. All rights reserved.' |
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.
Copy right year
|
||
class HealthMessages(object): | ||
""" | ||
Demonstrates getting Health messages for various health items |
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.
Can you explain what are health items?
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.
Demonstrates getting Health messages for memory, storage and cpu
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.
Please check if this change is taken care?
args = sample_util.process_cli_args(parser.parse_args()) | ||
self.item = args.item | ||
|
||
# Connect to vAPI services |
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.
FIx this indentation
|
||
def run(self): | ||
message_list = self.health_client.messages(self.item) | ||
notification_message = Notification() |
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.
This is not required I guess
if not message_list: | ||
print("No health alarms for : " + self.item) | ||
else: | ||
for notification_message in message_list: |
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.
for message in message_list
print("No health alarms for : " + self.item) | ||
else: | ||
for notification_message in message_list: | ||
print("Alert time : {}".format(notification_message.time)) |
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.
message.time
for notification_message in message_list: | ||
print("Alert time : {}".format(notification_message.time)) | ||
print("Alert message Id: " + notification_message.id) | ||
local_message = notification_message.message |
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.
message.message
print("Alert time : {}".format(notification_message.time)) | ||
print("Alert message Id: " + notification_message.id) | ||
local_message = notification_message.message | ||
def_message = local_message.default_message |
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.
Make variable name def_message more descriptive
@aspurohit, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
|
||
class HealthMessages(object): | ||
""" | ||
Demonstrates getting Health messages for various health items |
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.
Demonstrates getting Health messages for memory, storage and cpu
|
||
def run(self): | ||
message_list = self.health_client.messages(self.item) | ||
message = Notification() |
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.
This is not required
def run(self): | ||
message_list = self.health_client.messages(self.item) | ||
message = Notification() | ||
msg = LocalizableMessage() |
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.
this is also not required
|
||
from samples.vsphere.common import sample_cli | ||
from samples.vsphere.common import sample_util | ||
from samples.vsphere.common import vapiconnect |
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.
All three imports can be combined
from samples.vsphere.common import (sample_cli, sample_util, vapiconnect)
@aspurohit, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
@aspurohit, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
@aspurohit, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
|
||
class HealthMessages(object): | ||
""" | ||
Demonstrates getting Health messages for various health items |
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.
Please check if this change is taken care?
@aspurohit, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
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
Hi @tianhao64 , Please review
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.
Couple of minor issues.
@aspurohit, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
updated Health appliance sample cleaned up health appliance sample Signed-off-by: aspurohit <[email protected]> Removed unused objects Signed-off-by: aspurohit <[email protected]> modified as per sample_template_basic updated as per review comments updated the sample as per review comments updated the sample as per import standards
Adding new sample to appliance .Sample demonstrates getting Health messages for various health items .Retrieves Health messages details from vCenter and prints the data.