Skip to content

Commit

Permalink
Merge pull request #150 from idealista/develop
Browse files Browse the repository at this point in the history
Release 2.5.1
  • Loading branch information
miguel-chacon authored Sep 19, 2019
2 parents c0f4c8a + 6fae503 commit 200812f
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 21 deletions.
27 changes: 19 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
language: python

python:
- '3.5'
- '3.6'
- '3.7'

install:
- pip install -r requirements.txt

script:
- python -m unittest discover tests

before_deploy:
- python3 -m pip install --upgrade setuptools
deploy:
skip_cleanup: true
provider: pypi
user: idealista
password:
secure: vGEjnrN5N3KlYHA/3LC+uJpW2lr1sZCUahNz0OjycNg/oKB1CZuQx0TuiXF/i8DnqnYpfW+tpFEjSwa2TqJIKhrQFf9yLUblr/Ky9H8VXzyLWI+DN3t3EbCg9QWRGuC7RJm57PZkjfMR6RewHNqpjAlzkRE4kLP7CItJYJNOapXDpUIGccPucubprPs0AGL0roNG8fhs9goyeHD05es6OCS1v1LO9j91mDMno+XH2yNwSFmVHRFbzdZP+jHqx8L4dI+mlOIK2iATW1JTCyGWRHBqfb8w7Pi97r4qWpl76OduFH8b6Ldg5adIFgXFzyTUpZUNmenFLji9FwxXUWTQHCtRWzSx6SfN1ebaaqyCA84+p12pEXXee2xLhw04pWLrHHk22FnleEcL+Us80s50+lWCZz0MiakyTCVE+0YJuW/CT25RNGZvOvtrqyZCXFi2OO2Nu8NIbCKjvehNKpXCFdJLBBJcUAOmNz667ELEs8OTzFqxzJwykkxW+zwvxNc3/T5P1v1q8lUbxml3qSKfzvmyirXH1v0D/GMXuQdDqw3oBdjJb304bSsiWJ0l1YCYRkl7fV9bnO0WboEqJG6HJGX3Pt1GgQIrIu/DnBZOnUiSFwaqH4nh1pyYzEHqTAxPsmIaVtYkTgJOkoZXZLtLv0CefB5jo3SmLF1g3qGDRCc=
on:
tags: true

jobs:
include:
- stage: Deploy to PyPI
script: skip
deploy:
skip_cleanup: true
provider: pypi
user: idealista
password:
secure: vGEjnrN5N3KlYHA/3LC+uJpW2lr1sZCUahNz0OjycNg/oKB1CZuQx0TuiXF/i8DnqnYpfW+tpFEjSwa2TqJIKhrQFf9yLUblr/Ky9H8VXzyLWI+DN3t3EbCg9QWRGuC7RJm57PZkjfMR6RewHNqpjAlzkRE4kLP7CItJYJNOapXDpUIGccPucubprPs0AGL0roNG8fhs9goyeHD05es6OCS1v1LO9j91mDMno+XH2yNwSFmVHRFbzdZP+jHqx8L4dI+mlOIK2iATW1JTCyGWRHBqfb8w7Pi97r4qWpl76OduFH8b6Ldg5adIFgXFzyTUpZUNmenFLji9FwxXUWTQHCtRWzSx6SfN1ebaaqyCA84+p12pEXXee2xLhw04pWLrHHk22FnleEcL+Us80s50+lWCZz0MiakyTCVE+0YJuW/CT25RNGZvOvtrqyZCXFi2OO2Nu8NIbCKjvehNKpXCFdJLBBJcUAOmNz667ELEs8OTzFqxzJwykkxW+zwvxNc3/T5P1v1q8lUbxml3qSKfzvmyirXH1v0D/GMXuQdDqw3oBdjJb304bSsiWJ0l1YCYRkl7fV9bnO0WboEqJG6HJGX3Pt1GgQIrIu/DnBZOnUiSFwaqH4nh1pyYzEHqTAxPsmIaVtYkTgJOkoZXZLtLv0CefB5jo3SmLF1g3qGDRCc=
on:
tags: true
skip_existing: true
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a ch

## [Unreleased](https://github.com/idealista/prom2teams/tree/develop)

## [2.5.1](https://github.com/idealista/prom2teams/tree/2.5.1)
[Full Changelog](https://github.com/idealista/prom2teams/compare/2.5.0...2.5.1)
## Added
- *[#148](https://github.com/idealista/prom2teams/issues/148) Adapt template changes in Alertmanager 0.19* @miguel-chacon
## Fixed
- *[#146](https://github.com/idealista/prom2teams/issues/146) Missing 'job' label* @miguel-chacon
- *[#144](https://github.com/idealista/prom2teams/issues/144) Fix PyPI deploy* @miguel-chacon

## [2.5.0](https://github.com/idealista/prom2teams/tree/2.5.0)
[Full Changelog](https://github.com/idealista/prom2teams/compare/2.4.0...2.5.0)
## Added
Expand Down
3 changes: 2 additions & 1 deletion prom2teams/prometheus/message_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def get_alerts(self, message):
log.debug('JSON received is:\n%s', str(message))
prom_alerts = []

base_labels = ('alertname', 'device', 'fstype', 'instance', 'job', 'mountpoint', 'severity')
base_labels = ('alertname', 'device', 'fstype', 'instance', 'mountpoint', 'severity')
excluded = base_labels + self.exclude_fields

for alert in message['alerts']:
Expand Down Expand Up @@ -53,6 +53,7 @@ class AlertSchema(Schema):
startsAt = fields.DateTime()
endsAt = fields.DateTime()
generatorURL = fields.Str()
fingerprint = fields.Str()


class LabelSchema(Schema):
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ flask-restplus==0.12.1
marshmallow==3.0.0rc6
jinja2==2.10.1
Flask==1.0.2
pyyaml==3.12
pyyaml==3.13
uwsgi==2.0.16
prometheus_flask_exporter==0.9.0
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


setup(name='prom2teams',
version='2.5.0',
version='2.5.1',
description='Project that redirects Prometheus Alert Manager '
'notifications to Microsoft Teams',
long_description=readme,
Expand Down
4 changes: 2 additions & 2 deletions tests/data/jsons/all_ok.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"device": "rootfs",
"fstype": "rootfs",
"instance": "cs30.evilcorp",
"job": "fsociety",
"mountpoint": "/",
"severity": "severe"
},
Expand All @@ -19,7 +18,8 @@
},
"startsAt": "2017-05-09T07:01:37.803000Z",
"endsAt": "2017-05-09T07:08:37.818278Z",
"generatorURL": "my.prometheusserver.url"
"generatorURL": "my.prometheusserver.url",
"fingerprint": "dd19ae3d4e06ac55"
}
],
"externalURL": "my.prometheusalertmanager.url",
Expand Down
3 changes: 2 additions & 1 deletion tests/data/jsons/all_ok_extra_labels.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
},
"startsAt": "2017-05-09T07:01:37.803000Z",
"endsAt": "2017-05-09T07:08:37.818278Z",
"generatorURL": "my.prometheusserver.url"
"generatorURL": "my.prometheusserver.url",
"fingerprint": "dd19ae3d4e06ac55"
}
],
"externalURL": "my.prometheusalertmanager.url",
Expand Down
8 changes: 4 additions & 4 deletions tests/data/jsons/all_ok_multiple.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"device": "rootfs",
"fstype": "rootfs",
"instance": "cs30.evilcorp",
"job": "fsociety",
"mountpoint": "/",
"severity": "severe"
},
Expand All @@ -19,7 +18,8 @@
},
"startsAt": "2017-05-09T07:01:37.803000000Z",
"endsAt": "2017-05-09T07:08:37.818Z",
"generatorURL": "my.prometheusserver.url"
"generatorURL": "my.prometheusserver.url",
"fingerprint": "dd19ae3d4e06ac55"
},
{
"status": "resolved",
Expand All @@ -28,7 +28,6 @@
"device": "rootfs",
"fstype": "rootfs",
"instance": "cs31.evilcorp",
"job": "fsociety",
"mountpoint": "/",
"severity": "critical"
},
Expand All @@ -38,7 +37,8 @@
},
"startsAt": "2017-05-09T07:01:37.803000Z",
"endsAt": "2017-05-09T07:08:37.81827Z",
"generatorURL": "my.prometheusserver.url"
"generatorURL": "my.prometheusserver.url",
"fingerprint": "dd19ae3d4e06ac55"
}
],
"externalURL": "my.prometheusalertmanager.url",
Expand Down
4 changes: 4 additions & 0 deletions tests/data/jsons/teams_alarm_all_ok_extra_labels.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
"name": "Status",
"value": "resolved"
},
{
"name": "job",
"value": "fsociety"
},
{
"name": "prometheus",
"value": "keep"
Expand Down
3 changes: 2 additions & 1 deletion tests/data/jsons/with_common_items.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
},
"startsAt": "2019-01-28T20:26:23.868893Z",
"endsAt": "2019-01-28T20:27:23.868893Z",
"generatorURL": "http://ot-mon-prometheus-operator-prometheus.monitoring:9090/graph?g0.expr=100+%2A+sum+by%28container_name%2C+pod_name%2C+namespace%29+%28increase%28container_cpu_cfs_throttled_periods_total%5B5m%5D%29%29+%2F+sum+by%28container_name%2C+pod_name%2C+namespace%29+%28increase%28container_cpu_cfs_periods_total%5B5m%5D%29%29+%3E+25\u0026g0.tab=1"
"generatorURL": "http://ot-mon-prometheus-operator-prometheus.monitoring:9090/graph?g0.expr=100+%2A+sum+by%28container_name%2C+pod_name%2C+namespace%29+%28increase%28container_cpu_cfs_throttled_periods_total%5B5m%5D%29%29+%2F+sum+by%28container_name%2C+pod_name%2C+namespace%29+%28increase%28container_cpu_cfs_periods_total%5B5m%5D%29%29+%3E+25\u0026g0.tab=1",
"fingerprint": "dd19ae3d4e06ac55"
}
],
"groupLabels": {},
Expand Down
3 changes: 2 additions & 1 deletion tests/data/jsons/without_instance_field.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
},
"startsAt": "2017-05-09T07:01:37.803000Z",
"endsAt": "2017-05-09T07:08:37.818278Z",
"generatorURL": "my.prometheusserver.url"
"generatorURL": "my.prometheusserver.url",
"fingerprint": "dd19ae3d4e06ac55"
}
],
"externalURL": "my.prometheusalertmanager.url",
Expand Down
3 changes: 2 additions & 1 deletion tests/data/jsons/without_mandatory_field.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
},
"startsAt": "2017-05-09T07:01:37.803000Z",
"endsAt": "2017-05-09T07:08:37.818278Z",
"generatorURL": "my.prometheusserver.url"
"generatorURL": "my.prometheusserver.url",
"fingerprint": "dd19ae3d4e06ac55"
}
],
"externalURL": "my.prometheusalertmanager.url",
Expand Down

0 comments on commit 200812f

Please sign in to comment.