projects
/
osm
/
MON.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Updated vROPs plugin for using Common plugin consumer"
[osm/MON.git]
/
osm_mon
/
core
/
message_bus
/
common_consumer
diff --git
a/osm_mon/core/message_bus/common_consumer
b/osm_mon/core/message_bus/common_consumer
index
9f261b7
..
0255965
100755
(executable)
--- a/
osm_mon/core/message_bus/common_consumer
+++ b/
osm_mon/core/message_bus/common_consumer
@@
-22,6
+22,7
@@
import json
import logging
import sys
import json
import logging
import sys
+import os
sys.path.append("/root/MON")
sys.path.append("/root/MON")
@@
-34,17
+35,20
@@
log = logging.getLogger(__name__)
from kafka import KafkaConsumer
from kafka.errors import KafkaError
from kafka import KafkaConsumer
from kafka.errors import KafkaError
-from plugins.OpenStack.Aodh import alarming
-from plugins.OpenStack.common import Common
-from plugins.OpenStack.Gnocchi import metrics
+from
osm_mon.
plugins.OpenStack.Aodh import alarming
+from
osm_mon.
plugins.OpenStack.common import Common
+from
osm_mon.
plugins.OpenStack.Gnocchi import metrics
+from osm_mon.plugins.CloudWatch.plugin_alarm import plugin_alarms
+from osm_mon.plugins.CloudWatch.plugin_metric import plugin_metrics
+
+from osm_mon.plugins.vRealiseOps import plugin_receiver
# Initialize servers
server = {'server': 'localhost:9092'}
# Initialize consumers for alarms and metrics
# Initialize servers
server = {'server': 'localhost:9092'}
# Initialize consumers for alarms and metrics
-common_consumer = KafkaConsumer(group_id='osm_mon',
- bootstrap_servers=server['server'])
+common_consumer = KafkaConsumer(bootstrap_servers=server['server'])
# Create OpenStack alarming and metric instances
auth_token = None
# Create OpenStack alarming and metric instances
auth_token = None
@@
-52,6
+56,12
@@
openstack_auth = Common()
openstack_metrics = metrics.Metrics()
openstack_alarms = alarming.Alarming()
openstack_metrics = metrics.Metrics()
openstack_alarms = alarming.Alarming()
+# Create CloudWatch alarm and metric instances
+cloudwatch_alarms = plugin_alarms()
+cloudwatch_metrics = plugin_metrics()
+
+#Create vROps plugin_receiver class instance
+vrops_rcvr = plugin_receiver.PluginReceiver()
def get_vim_type(message):
"""Get the vim type that is required by the message."""
def get_vim_type(message):
"""Get the vim type that is required by the message."""
@@
-72,16
+82,19
@@
try:
if message.topic == "metric_request":
# Check the vim desired by the message
vim_type = get_vim_type(message)
if message.topic == "metric_request":
# Check the vim desired by the message
vim_type = get_vim_type(message)
+
if vim_type == "openstack":
log.info("This message is for the OpenStack plugin.")
openstack_metrics.metric_calls(
message, openstack_auth, auth_token)
if vim_type == "openstack":
log.info("This message is for the OpenStack plugin.")
openstack_metrics.metric_calls(
message, openstack_auth, auth_token)
- elif vim_type == "cloudwatch":
+ elif vim_type == "aws":
+ cloudwatch_metrics.metric_calls(message)
log.info("This message is for the CloudWatch plugin.")
log.info("This message is for the CloudWatch plugin.")
- elif vim_type == "vrops":
- log.info("This message is for the vROPs plugin.")
+ elif vim_type == "vmware":
+ log.info("This metric_request message is for the vROPs plugin.")
+ vrops_rcvr.consume(message)
else:
log.debug("vim_type is misconfigured or unsupported; %s",
else:
log.debug("vim_type is misconfigured or unsupported; %s",
@@
-94,11
+107,13
@@
try:
log.info("This message is for the OpenStack plugin.")
openstack_alarms.alarming(message, openstack_auth, auth_token)
log.info("This message is for the OpenStack plugin.")
openstack_alarms.alarming(message, openstack_auth, auth_token)
- elif vim_type == "cloudwatch":
+ elif vim_type == "aws":
+ cloudwatch_alarms.alarm_calls(message)
log.info("This message is for the CloudWatch plugin.")
log.info("This message is for the CloudWatch plugin.")
- elif vim_type == "vrops":
- log.info("This message is for the vROPs plugin.")
+ elif vim_type == "vmware":
+ log.info("This alarm_request message is for the vROPs plugin.")
+ vrops_rcvr.consume(message)
else:
log.debug("vim_type is misconfigured or unsupported; %s",
else:
log.debug("vim_type is misconfigured or unsupported; %s",
@@
-111,11
+126,13
@@
try:
log.info("This message is for the OpenStack plugin.")
auth_token = openstack_auth._authenticate(message=message)
log.info("This message is for the OpenStack plugin.")
auth_token = openstack_auth._authenticate(message=message)
- elif vim_type == "cloudwatch":
+ elif vim_type == "aws":
+ #TODO Access credentials later
log.info("This message is for the CloudWatch plugin.")
log.info("This message is for the CloudWatch plugin.")
- elif vim_type == "vrops":
- log.info("This message is for the vROPs plugin.")
+ elif vim_type == "vmware":
+ log.info("This access_credentials message is for the vROPs plugin.")
+ vrops_rcvr.consume(message)
else:
log.debug("vim_type is misconfigured or unsupported; %s",
else:
log.debug("vim_type is misconfigured or unsupported; %s",