Skip to content
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

Alerting doc changes and sample files #15

Merged
merged 1 commit into from Jan 11, 2017

Conversation

anmolbabu
Copy link
Contributor

Add rest apis + alert watcher + notification management framework
TODO:

  • Add exception handling.
  • Add UTs

Note: Python multiprocessing has been used here instead of greenlet
only to handle blocking calls.

tendrl-bug-id: #10,#11,#12,#14
Signed-off-by: anmolbabu anmolbudugutta@gmail.com

@coveralls
Copy link

Coverage Status

Coverage remained the same at 0.0% when pulling da76b1c on anmolbabu:Tendrl/specifications#40 into 9908e66 on Tendrl:master.

@anmolbabu
Copy link
Contributor Author

TODO(@anmolbabu)

  • Add UTs
  • Add snmp handler
  • Add delivery gurantees

@Tendrl/tendrl-core Please review this WIP patch

@coveralls
Copy link

Coverage Status

Coverage remained the same at 0.0% when pulling ac2bd14 on anmolbabu:Tendrl/specifications#40 into 9908e66 on Tendrl:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 0.0% when pulling 56238ff on anmolbabu:Tendrl/specifications#40 into 9908e66 on Tendrl:master.

except (ConfigNotFound, NotificationDispatchError) as ex:
raise NotificationDispatchError(str(ex))

def get_mail_client(self):
if not self.admin_config:
raise NotificationDispatchError(
"Admin mail configuration is required for dispatching email"
"notification"
" notification"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space required in start?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes because, its a string concatenation of 2 lines "Admin mail configuration is required for dispatching email" and "notification" so if its not " notification", the resultant sentence appears as:
"Admin mail configuration is required for dispatching emailnotification"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok


def run(self):
try:
app.run(host=self.host, port=5001)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the port configurable? If so externalize this as well in configuration. Default could be 5001 if not defined in configurations file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently it is not configurable. Making configurable now...



@to_singleton
class EtcdInterface(object):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not call EtcdManager as you called ApiManager above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

alerts_arr.append(json.loads(child['value']))
if filters is not None:
filtered_alerts = {}
for f in filters:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename f as filter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filter seems to be a keyword in python

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. then its fine

raise NotificationDispatchError(str(ex))

def format_message(self, alert):
return "Subject: [Alert] %s, %s threshold breached\n\n%s" % (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we provide option for formatting message as configurable one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I don't think this needs to be configurable at-least that's not planned as of now

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

)
if (
self.admin_config.get('auth') is not None and
self.admin_config['auth'] == 'ssl'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

define a constant for this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

tendrl-bug-id: Tendrl#10,Tendrl#11,Tendrl#12,Tendrl#14
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
@anmolbabu anmolbabu changed the title [WIP] Add rest apis + alert watcher + notification management framework Alerting doc changes and sample files Jan 6, 2017
@coveralls
Copy link

Coverage Status

Coverage remained the same at 0.0% when pulling e724c23 on anmolbabu:Tendrl/specifications#40 into 9908e66 on Tendrl:master.

@@ -13,11 +13,7 @@ log_level = DEBUG

[alerting]
# Path to log file
log_cfg_path = /etc/tendrl/logging.yaml
log_cfg_path = /etc/tendrl/alerting_logging.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I commented on the other patch, alert configuartion can be in a different file

@r0h4n r0h4n merged commit 6d8ae33 into Tendrl:master Jan 11, 2017
@anmolbabu anmolbabu deleted the Tendrl/specifications#40 branch January 16, 2017 02:37
@anmolbabu anmolbabu restored the Tendrl/specifications#40 branch January 16, 2017 02:37
@anmolbabu anmolbabu deleted the Tendrl/specifications#40 branch January 16, 2017 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants