Skip to content
Snippets Groups Projects
Commit a6074cf1 authored by jurgenhaas's avatar jurgenhaas
Browse files

customer/bitegra/mobimo/drupal#240 Implement support for an optional project...

customer/bitegra/mobimo/drupal#240 Implement support for an optional project ID when sending alert from fluentd to alerta
parent a05dceaa
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,7 @@ class Alerta: ...@@ -28,6 +28,7 @@ class Alerta:
self.parser.add_argument('webhook', help='Alerta webhook') self.parser.add_argument('webhook', help='Alerta webhook')
self.parser.add_argument('apikey', help='Alerta API key') self.parser.add_argument('apikey', help='Alerta API key')
self.parser.add_argument('payload', help='Json string or filename') self.parser.add_argument('payload', help='Json string or filename')
self.parser.add_argument('--pid', help='Project ID')
self.args, self.extras = self.parser.parse_known_args() self.args, self.extras = self.parser.parse_known_args()
if os.path.isfile(self.args.payload): if os.path.isfile(self.args.payload):
...@@ -52,6 +53,8 @@ class Alerta: ...@@ -52,6 +53,8 @@ class Alerta:
'value': '', 'value': '',
'rawData': '', 'rawData': '',
} }
if 'pid' in self.args:
values['tags'].append('gitlab_project_id:%s' % self.args.pid)
return values return values
@staticmethod @staticmethod
......
...@@ -196,7 +196,7 @@ ...@@ -196,7 +196,7 @@
<match alerta> <match alerta>
@type exec @type exec
command /usr/local/bin/alertalerta.py {{ inventory_hostname }} {{ netdata_alerta_environment|default("production") }} {{ netdata_alerta_webhook }} {{ netdata_alerta_apikey }} command /usr/local/bin/alertalerta.py{% if netdata_alerta_project_id is defined %} --pid={{ netdata_alerta_project_id }}{% endif %} {{ inventory_hostname }} {{ netdata_alerta_environment|default("production") }} {{ netdata_alerta_webhook }} {{ netdata_alerta_apikey }}
<buffer> <buffer>
@type file @type file
path /var/log/td-agent/buffer/alerta.*.buffer path /var/log/td-agent/buffer/alerta.*.buffer
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment