Commit Graph

134 Commits

Author SHA1 Message Date
Hasan Acar 13121a1059 Making the gates happy
fix: allowlist_externals added to tox

fix: upgrading gevent

fix: pep8 issue fixed for slack_notifier

fix: change env list

Change-Id: Iefc7fdc89a398623aa3515c89240b53a49c10282
2024-03-06 13:42:44 +00:00
Martin Chacon Piza fa2454a3c9 Fix Grafana URL in email notification
- Remove prefix 'dim_' from dimensions in Drilldown Dashboard
- Same was done for Monasca-UI [1]

[1] https://review.opendev.org/c/openstack/monasca-ui/+/782599

Change-Id: I69e3e7db54b995e45810532a1dd940ac8b68921f
2021-06-18 11:06:08 +02:00
Martin Chacon Piza 35a9b57f91 Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found by updated hacking version.

Remove hacking and friends from lower-constraints, they are not needed
there at all.

Align lower-constraints for new pip [1]

Fix flake8 E305 and E117 and set W504 as ignored

[1] http://lists.openstack.org/pipermail/openstack-discuss/2020-December/019285.html

Change-Id: Idae87291f4556eee77d40ab49f0d151435d70875
2021-02-23 17:20:15 +01:00
wangzihao 3b91b33784 Remove six
Remove all six usage.

Change-Id: Ib2f0f6cf3b7f5d9ec20440fb81b09c1c083c67b0
Story: 2008305
Task: 41295
2020-11-20 09:35:23 +00:00
Witek Bedyk f9978670b8 Set legacy_kafka_client_enabled = False on default
We change the default value of kafka.legacy_kafka_client_enabled from
True to False. The use of new Confluent Kafka client is recommended.

Change-Id: Ie6a15474ebc1f04b8555ee44d413c19ee26a9227
Story: 2007924
Task: 40339
2020-07-14 15:37:42 +02:00
Hervé Beraud a49af326e5 Stop to use the __future__ module.
The __future__ module [1] was used in this context to ensure compatibility
between python 2 and python 3.

We previously dropped the support of python 2.7 [2] and now we only support
python 3 so we don't need to continue to use this module and the imports
listed below.

Imports commonly used and their related PEPs:
- `division` is related to PEP 238 [3]
- `print_function` is related to PEP 3105 [4]
- `unicode_literals` is related to PEP 3112 [5]
- `with_statement` is related to PEP 343 [6]
- `absolute_import` is related to PEP 328 [7]

[1] https://docs.python.org/3/library/__future__.html
[2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html
[3] https://www.python.org/dev/peps/pep-0238
[4] https://www.python.org/dev/peps/pep-3105
[5] https://www.python.org/dev/peps/pep-3112
[6] https://www.python.org/dev/peps/pep-0343
[7] https://www.python.org/dev/peps/pep-0328

Change-Id: I2f6071f18c20ee5fb08c977f615ebd82a40715e4
2020-06-02 20:25:19 +02:00
Doug Szumski 0b5b77c974 Remove deprecated YAML config
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
2020-04-23 18:53:27 +02:00
Witek Bedyk db01fe425b Migrate from ujson to simplejson
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
2020-04-18 10:42:39 +02:00
Witek Bedyk 76f86ec612 Declare cli.yaml_config option as not required
YAML configuration support has been deprecated and will be removed. We
don't need this option for starting the service.

Depends-On: https://review.opendev.org/709389
Change-Id: I6d473d54a97abfb91e73c0e47cd7536639bb14e2
Story: 2007318
Task: 38827
2020-02-24 09:57:44 +00:00
Doug Szumski 044b9c7d11 Allow users to set periodic notifications on all notification types
In some cases, users may want to send periodic notifications for
notification types other than webhooks.

Story: 2006837
Task: 37412
Change-Id: Icd1b12f4b1e452f8285b8402f49815dd7f72b1ea
2019-12-11 11:13:25 +00:00
Doug Szumski efc6e28edc Fix periodic notifications for webhooks
- 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
2019-12-11 11:13:17 +00:00
Ghanshyam Mann 484073ee9c Fix the IPv6 address and port parsing
There can be lot of possibility for IPv6 address with port,
for example [::1]:80 or [2001:db8:85a3::8a2e:370]:7334.

Parsing that in more standard way is provided by oslo_uilts.netutils
parse_host_port() method[1].

Story: #2006309
Task: #36030

[1] 1b8bafb391/oslo_utils/netutils.py (L37)

Change-Id: Ie7a3bd3074c02430c754deaebfde6d174563b31e
2019-10-18 14:00:41 +02:00
Zuul d91ceee414 Merge "Use Confluent Kafka client" 2019-09-26 09:51:33 +00:00
Witek Bedyk d47bbae4e8 Use Confluent Kafka client
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
2019-09-19 15:09:23 +02:00
Zuul 8dd38d69b7 Merge "Templates for Slack notifications" 2019-08-07 12:04:51 +00:00
zhangjianweibj 3db7b179ef Fix python3 json loads error
`oslo_serialization.jsonutils.loads` is a more appropriate solution
Task: 36071
Story: 2006285

Change-Id: I8e2775a283b4670a8979541602a3f245c18e5d35
2019-08-03 08:57:14 +08:00
zhangjianweibj 22d7c9bb51 Json loads error
Pyhton version below 3.6,function json.loads() throw decoder error.
3.6 version input option can bytes or bytearray,below 3.6 version
type of bytes not cimpatible.

Task: 35991
Story: 2006285
Change-Id: Ib1dba51a57fdce028a6b20da06201f0597085047
2019-07-30 08:15:10 +08:00
Zuul bcbd8d08de Merge "Fix notification type plugin install loop" 2019-07-03 16:50:44 +00:00
Witek Bedyk fd1c6dfab9 Add default notification plugins to configuration
In the past email, pagerduty and webhook notification plugins had been
hard coded and always enabled. This situation is still reflected in the
deprecated YAML configuration file [1]. These notification method types
are also expected by tempest tests.

This change sets email, pagerduty and webhook as the default list of
enabled notifiers. This corresponds to the old behavior and testing but
can be easily modified by overwriting the list in the configuration
file.

[1] https://opendev.org/openstack/monasca-api/src/branch/master/devstack/files/monasca-notification/notification.yaml#L51-L54

Change-Id: Icb91feaf7821fe014542350125c5011bab530103
Story: 2000959
Task: 35644
2019-07-01 17:46:51 +02:00
Witek Bedyk 0e502cc463 [GateFix] Ignore false positive bandit B105 test failure
Bandit B105 hardcoded_password_string[1] is causing gate failure,
which is false positive.
Added a # nosec comment to skip Bandit testing of that line.

[1] https://bandit.readthedocs.io/en/latest/plugins/b105_hardcoded_password_string.html

Add local bindep.txt to include PostgreSQL dependendencies for testing.

Story: 2006058
Task: 34771

Change-Id: I579754a0e093e192366ad2783bd766473227e761
2019-06-27 17:57:12 +02:00
Isaac Prior df2f1ef228 Fix notification type plugin install loop
The 'insert_configured_plugins' function occasionally gets into an infinite loop.
This patch ensures the loop fails properly after max_retries is met.

Story: 2005540
Task: 30680
Change-Id: I99d7750fac6d0355d182df1612c6a5abbbad7fc6
2019-06-07 16:49:27 +01:00
Doug Szumski 36bf8595c4 Fix loading of notification plugins
Inconsistent naming of plugins can cause an import error. This
commit standardises the naming so that all imports are parsed
correctly.

Story: 2005545
Task: 30689

Change-Id: Ife27fed83d28d47cc99ee07c4a8c0c4dac32c2da
2019-05-16 09:54:05 +00:00
Doug Szumski 39a906b8fb Templates for Slack notifications
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
2019-05-02 09:49:42 +01:00
Doug Szumski 77328b74f4 Add Python Jira module to requirements
The Jira module is now available in global-requirements:
https://review.openstack.org/#/c/562151/

Since the Jira module is now loaded by default, it always
needs to be installed. If a future change prevents loading
of the Jira module unless the Jira plugin is enabled then
this change can be reverted.

Change-Id: I3fea82e681cd49aab5cd6afc29c60302af7b63b7
Story: 2005400
Task: 30394
2019-04-12 11:33:13 +01:00
Zuul 5f21b325ba Merge "Replace notification.conf with monasca-notification.conf" 2019-02-13 15:59:23 +00:00
Zuul 93574c6bf1 Merge "Includes missing configuration options" 2019-02-12 23:14:40 +00:00
Thomas Bechtold 47b807eeb8 Replace notification.conf with monasca-notification.conf
notification.conf is the deprecated path for the configuration file.
The new path is /etc/monasca/monasca-notification.conf .

Note: devstack is still using the deprecated configuration file. This
will be change in another changeset (against openstack/monasca-api).

Change-Id: I9ef1d7149308893544ad4d6fef4f3281da676171
Story: 2004862
Task: 29103
2019-02-01 10:13:25 +00:00
Zuul e6f2f2b6fe Merge "Bug Fix: Parses notifier configuration options" 2019-01-31 18:07:18 +00:00
Charana Nandasena 00cc2527e3 Includes missing configuration options
Includes missing configuration options for notifiers
in generated config file.

Change-Id: I06e6d51bca3b180768bc8c71ff10c9f6e69c5e8b
Story: #2003793
Task: #26506
2019-01-25 11:54:54 +01:00
Charana Nandasena 2bc16e7834 Bug Fix: Parses notifier configuration options
Successfully parses configuration options for enabled notifiers.
IMPORTANT: This requires the built-in notifiers be "enabled"
in the configuration.

This patch is compliant with `https://review.openstack.org/#/c/435136/`
that in summary makes every notifier pluggable as apposed distinguished
built-in and pluggable notifiers.

Change-Id: I818212344268de5e90e72c5493a8632476ba254b
Story: #2003794
Task: #26507
2019-01-25 11:54:54 +01:00
Thomas Bechtold e20131f177 Fix help text for [kafka]url option
The "url" is for the kafka cluster, not the zookeeper cluster.

Change-Id: I29c898b4e39fd25f54572248c0cf8638afcc7f92
2019-01-25 10:46:37 +01:00
Joe Keen 1d680f1739 Make default notifiers pluggable
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
2019-01-17 11:58:45 +01:00
Nguyen Hai Truong c9ef9d9d02 trivial fix: Correct some spelling errors
Small modification to correct spelling mistake.

Change-Id: Ic7f145291dc5829cf6955b8714c87dba96e04bde
2018-11-08 01:08:05 -08:00
Dobroslaw Zybort c8b9b81f61 Py3: Fix encoding of message in RetryEngine
Change-Id: I07b96fb8ed486d620f9911827a1f3182fe0e9b84
2018-09-12 11:45:59 +00:00
Dobroslaw Zybort dca2fa82ef Fix loading yaml file warning in Python 3
Change-Id: I226850967632b87b5a84c053ea6d6d7ad081f9ab
2018-09-07 10:31:48 +02:00
melissaml 700f5223a9 Remove the duplicated word
Change-Id: Ie6b95d0853d48712e6699aa74da6ae948e72c5a6
2018-08-22 12:40:15 +08:00
akhil abb315961e Enable keystone authentication with webhook notification
This commit adds functionality of sending webhook notifications to
various projects that require keystone authentications. For which user
need to set auth credentials in conf under keystone header.
By default it is disabled, which can be enabled in conf.

Change-Id: I3e773af8c3ebe0cf1d57e8fa1351b1e725a9cfa0
Partially-Implements: blueprint add-monasca-push-driver
Story: 2003105
Task: 23220
2018-08-07 22:22:15 +05:30
Martin Chacon Piza cdb2e4398d Make statsd self-monitoring optional
Story: 2001873
Task: 14333

Change-Id: I35eaa298f1153e6b71a5bfe33a894adec6b593a3
2018-05-14 11:52:52 +02:00
Jui Chandwaskar d396753a83 Update pep8 checks
* Set max line length to 100
* Clean up code for pep8 checks

Change-Id: Ie00dc204f522fb2112f02f4151ec8a15d5523459
Signed-off-by: Jui Chandwaskar <jchandwaskar@op5.com>
2018-04-11 14:16:27 +02:00
Tomasz Trębski e1a9b9a96a Integrate with oslo.conf and oslo.log
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
2017-10-20 09:32:11 +02:00
Craig Bryant 5a119df577 Revert Ibd2f64f464af1f501d45c43c0f438f5c74027f6c
Georgia-Anna Farmaki found the import of logging.config to be
required. I see the same thing while testing. I should have
tested instead of just inspecting this code when I approved
Ibd2f64f464af1f501d45c43c0f438f5c74027f6c.

Change-Id: If73576882cf29588d6a4b395b04b3168ff2b84ea
2017-09-05 08:37:47 -06:00
Jenkins fb535756d7 Merge "Added a field 'Grafana Url' in the email" 2017-09-01 09:19:03 +00:00
Jenkins 67bcb4318f Merge "Removed redundant import" 2017-08-30 07:29:29 +00:00
Georgia-Anna Farmaki 347606ac54 Added a field 'Grafana Url' in the email
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
2017-08-28 11:32:14 +02:00
Artur Basiak 1ee321bb05 Make code compatible with Python3.5
Add adjustments:
   - read configuration file in binary mode
   - remove extra encoding
   - check if string is binary class and convert it to
     standard string

Change-Id: I5f73b6b0e8b5592539e07fe66debf917540ce24c
Story: 2001124
Task: 4816
2017-08-10 07:12:26 +02:00
Jenkins 20479d1c1d Merge "Fix slack notification" 2017-08-08 03:55:57 +00:00
Haruki Yamanashi 68a6a8319b Send notification to Jira in custom description
This change makes possible to send notification to Jira
in custom description (e.g. AlarmID)

Change-Id: Ib7f9a438a27f29b17967c31922391d76f8f0092f
2017-07-26 14:24:21 +09:00
Haruki Yamanashi 0b82639af0 Fix typo and add configuration example for Jira
Change-Id: Ic304bfff6258126a439dee58b722c773bcfa8c57
2017-07-26 09:23:58 +09:00
Koji Nakazono 4cfcf0803f Fix slack notification
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
2017-07-25 15:17:19 +09:00
Tomasz Trębski fe78b6d698 Make monasca-notification Py35 compatible
Adjust the monasca-notification to run
under Python3.5

Story: 2000975
Task: 4130

Change-Id: I3bf2725fb2904374d7bae51ebf061a47dcbef0c0
2017-07-18 13:31:41 +02:00