include requirements.txt
include test-requirements.txt
include README.rst
-recursive-include osm_mon *.py *.xml *.sh *.yaml
+recursive-include osm_mon *.py *.xml *.sh *.yaml *.json
recursive-include devops-stages *
'threshold': self.threshold,
'statistic': self.statistic,
'metric': self.metric,
- 'tags': self.tags
+ 'tags': self.tags,
+ 'operation': self.operation
}
return alarm
alarm.uuid = data.get('uuid', str(uuid.uuid4()))
alarm.name = data.get('name')
alarm.severity = data.get('severity')
- alarm.threshold = data.get('threshold')
+ alarm.threshold = float(data.get('threshold'))
alarm.statistic = data.get('statistic')
alarm.metric = data.get('metric')
alarm.tags = data.get('tags')
+ alarm.operation = data.get('operation')
return alarm
from osm_mon.core.common_db import CommonDbClient
from osm_mon.core.config import Config
import osm_mon.dashboarder.backends.grafana as grafana
+from osm_mon import __path__ as mon_path
log = logging.getLogger(__name__)
project_id = project['_id']
# Collect Project IDs for periodical dashboard clean-up
osm_resource_uids.append(project_id)
- dashboard_path = '/mon/osm_mon/dashboarder/templates/project_scoped.json'
+ dashboard_path = '{}/dashboarder/templates/project_scoped.json'.format(mon_path)
if project_id not in dashboard_uids:
project_name = project['name']
grafana.create_dashboard(project_id, project_name,
nsrs = self.common_db.get_nsrs()
for nsr in nsrs:
nsr_id = nsr['_id']
- dashboard_path = '/mon/osm_mon/dashboarder/templates/ns_scoped.json'
+ dashboard_path = '{}/dashboarder/templates/ns_scoped.json'.format(mon_path)
# Collect NS IDs for periodical dashboard clean-up
osm_resource_uids.append(nsr_id)
# Check if the NSR's VNFDs contain metrics
def _build_alarm_response(self, alarm: Alarm, status: AlarmStatus):
response = ResponseBuilder()
tags = {}
- for tag in alarm.tags:
- tags[tag.name] = tag.value
+ for name, value in alarm.tags.items():
+ tags[name] = value
now = time.strftime("%d-%m-%Y") + " " + time.strftime("%X")
return response.generate_response(
'notify_alarm',
alarm.uuid = '1'
common_db_client = CommonDbClient(self.config)
common_db_client.create_alarm(alarm)
- create.assert_called_with('alarms', {'tags': {}, 'threshold': 50.0, 'metric': 'metric', 'severity': 'severity',
- 'statistic': 'statistic', 'name': 'name', 'uuid': '1'})
+ create.assert_called_with('alarms', {'tags': {}, 'threshold': 50.0, 'metric': 'metric',
+ 'severity': 'severity', 'statistic': 'statistic',
+ 'name': 'name', 'operation': 'operation', 'uuid': '1'})
@mock.patch.object(dbmongo.DbMongo, "db_connect", mock.Mock())
@mock.patch.object(dbmongo.DbMongo, "del_one")