The mock third party library was needed for mock support in py2
runtimes. Since we now only support py36 and later, we can use the
standard lib unittest.mock module instead.
Change-Id: Ib7c9cca06dcfe14440ab9711cc0b76a5b4fe4e1c
This was marked for removal after the Pike release.
Updating Docker file is leftover and will done in a separate change.
Story: 2003180
Task: 23326
Change-Id: I583eab7b3ea2efd5d9bcd3ef433e68b49684e343
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.
Change-Id: I380f25044c8f7b496d485aabf09215468f955818
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
Additionally, temporarily set build-monasca-docker-image as non-voting
due to problems with buggy confluent-kafka 1.4.0 release, which prevents
building the Docker image.
Change-Id: I561ea633a09eb3d7468d2d55aa46d6fb3b2380ff
Story: 2007549
Task: 39390
- Removes the hard-coded magic number of 60 seconds allowing users to
choose the period that they require.
- Standardise on strings for DictOpt dict keys. When loaded from a config
file, the DictOpt keys are parsed as strings, which was conflicting with
the default integer dict keys. This caused the periodic engine to silently
fail to load when configured via a config file.
- Remove unused variable
Story: 2006783
Task: 37313
Change-Id: Ibd61c45fc1ade37022150d34a5b00c56fdf69814
The change introduces the possibility to run the persister with the new
confluent-kafka client. It has to be enabled in the configuration file.
Story: 2003705
Task: 35858
Depends-On: https://review.opendev.org/675297
Change-Id: I8d9e173e9a252712fb285c0676c26334e1f677a7
This change adds an optional, user configurable template which
may be used to format the text contained in Slack notifications.
Story: 2001308
Task: 5859
Change-Id: Id936c3dc8b4f3e2430de20c8b69d0e703b1cf9ef
Erasing distinction between plugins that are an inherent part of the
notification engine and plugins that can be specified via the config file.
Fixing broken tests.
Story: 2003801
Task: 26532
Change-Id: I360cc2ad0782f209606706bf1869570fdae2260d
* Set max line length to 100
* Clean up code for pep8 checks
Change-Id: Ie00dc204f522fb2112f02f4151ec8a15d5523459
Signed-off-by: Jui Chandwaskar <jchandwaskar@op5.com>
In Python3, assertRegexpMatches & assertNotRegexpMatches
are deprecated in favor of assertRegex and assertNotRegex
Change-Id: I52b84fd49bed43902f0a57983710c0fb08649b12
Change upgrades the monasca-notification to leverage
the capabilities of both oslo.log and oslo.conf:
- configuration of logging separated from application settings
- ability to enforce data types for application settings
- ability to use oslo.config-generator capabilities
- automatic configuration parsing done by oslo.cfg
That change will bring it closer to the rest of monasca
components where such transition has happened already.
However, in the rest of monasca, oslo.cfg was partially
or fully implemented whereas monasca-notification has
been relying on YAML based configuration file.
Therefore backward compatybility for such format will
be kept for now.
Story: 2000959
Task: 4093
Task: 4092
Change-Id: Ia75c3b60d0fada854178f21ca5ccb9e6a880f37f
Retrieve the grafana_url field from notification.yaml
and append the query for metric info and timestamp.
Unit tests for method get_link_url,
adjust existing unit tests, python3 tests.
Change-Id: Ie0e98f3df48eb68caad232e5b9293222d7c946c8
Story: 2001052
Task: 4652
This patch fixes 2 issues in slack notification.
First, incoming webhook supports the JSON request, however Slack
API to post a message to chat doesn't support JSON request.
Change to use "data" for posting a message to chat.
Second, incoming webhook returns the response as text.
Change to check the content type of response before parsing it.
Change-Id: Ic81cc1d99496774a16f91569022d5e4fe0aff795
Story: 2001041
Task: 4597
Python3.5 tests were not running because Python3 has not
Queue module (instead have queue module). Commit
does not fix failing tests but gives an insight in what
exactly is failing and allows to fix them in future.
Also applied sixer utility to fix common Py2-Py3 compatybility
issues.
Additionally:
* removed unconstrained mysql and psycopg drivers from tox.ini.
Instead added them to test-requirements to be picked up
by requirements bot. That also allowed to remove 3 tox
environments.
* added removing .testrepository/times.dbm (may cause py3 environment
to fail if present)
Change-Id: I9bcc33dad80fdfbf60d95c4bb0ce7f79f642a414
Remove plugins keyword from possible notifiers. Monasca notification
was throwing a warning: "No notifiers found for plugins" if
plugins section was defined in notification_types.
Change-Id: I7ccacba0624322bf912bbb088ed7c993ed32db02
Add new section to config file with configuration for statsd
host and port. Add modification in notification engines.
According to the monasca-agent change:
https://review.openstack.org/#/c/381417
Change-Id: I6e99bae5e50f3670ae8b4a0c7ac5af3c747bcd68
This patch set modifies lines which are importing objects
instead of modules. As per openstack import guide lines, user should
import modules in a file not objects.
http://docs.openstack.org/developer/hacking/#imports
Change-Id: I3c5c7368fb006f3691d07cef9557c20a42cc5b76
This patch
1. Supports for loading new notification types as plugins.
2) Adds new plugins for HipChat and Slack
3) Insert Notification types during startup
Partially-implements: blueprint notification-engine-plugin
Change-Id: I246ced3fe22a9797a3c8384f7bda166797cfac3a
New periodic notification engine that will take a notification send it, and then
place it back onto the periodic notification topic. Once the alarm associated
with the notification has transitioned to a state that is different from the
original state the notification is removed from the queue.
Change-Id: Ie3103a0ec30abcd8dfc53869b1c3135953aabf3a
This is necessary in some installations to specify a non-default
mysql port (something other than 3306). All of the other monasca
packages allow overriding this in the config file, this change
brings monasca-notification inline with the others.
Change-Id: Ibe6ffca9e5adb13e44594531358e2a8e5da46b9d
Add severity to the subject line
Add up to 10 unique dimension sets in body
Add link and lifecycle state to email body
Change-Id: I85e2e9f2382c6ebadde072967e098e8109f65bfe
We used sqlalchemy.core for execute query for orm.
The configuration of db is based on monasca-api.
The default mode is mysql connection so we can use old configuration.
Change-Id: Iebb4d6dfca6d43298ced407178e7f9673a83a7ca
The test 'test_old_timestamp' was not able to pass in different
timezones due to hardcoded expected datetime
Change `test_alarm_processor.py` permissions
`test_alarm_processor.py` had different permissions than other test
files. While `unittest` module could collect tests in this file,
nosetests could't do it. Nose can collect tests in this file after
permissions change
Change-Id: I2b5791e7b352fbb0c05bc665b4000c412b63f1ef
This will ensure a unique timestamp. Influx V9 will only keep one
entry with the same timestamp
Some of the tests weren't using a numerica timestamp which caused
problems when the code tried to divide the timestamp by 1000
Change-Id: Ie0fefc61abe9a95503fa7611971a21ed2cb56224
When an email notifier is created and the initial smtp connection fails the
self._smtp variable is left set to None. Now we detect that and try to
reconnect.
Change-Id: Ifbc30ee5339722357d86214b4d8c84e64dd703f7
Squished the notification down to one process in preparation for making
multiple engine instances able to talk to the same topic.
Added HA capabilities to the KafkaConsumer object.
Change-Id: Id4799d690c7caf10ae7ba89c2d4e0aeb76c54375
Added more test coverage for email notifications.
Moved notification methods from notification_processor to new types directory.
types/interface.py now automatically records statsd information for configured
types.
Configuration for a type is now optional. Uncofigured types are not able to
send notifications. Notifications that come across for unconfigured types
generate a warning.
Email notification type now explicity exits when unable to connect to an SMTP
server.
Change-Id: I213d815965761736eb3680b5e14206ba7bef7e90
Added a timeout keyword to requests.post that we use to send webhooks. Updated
the tests to verify that the webhook will properly time out.
Change-Id: I27140a8c13afcd8f2e30ea1367f0bd9f4944ba36