Hello,
I’m having trouble creating a working chart.
I’ve created collector that needs to monitor a specific process every second,
it’s like the Apps collector but I need only one app(process)
after the collector will be updated, i’ll create alarm which will send notifications every time the process started/ended/stuck.
That’s what I’ve done:
from bases.FrameworkServices.SimpleService import SimpleService
CHARTS = {
"darknet_current":
{
"options": ["Darknet Process Monitoring", "Darknet Process", "percentage", "apps", "apps.cpu", "stacked"],
"lines": [
["darknet", 'darknet', 'absolute']
]
}
}
ORDER = [
"darknet_current",
]
class Service(SimpleService):
def __init__(self, configuration=None, name=None):
SimpleService.__init__(self, configuration=configuration, name=name)
self.order = ORDER
self.definitions = CHARTS
self.lower = self.configuration.get('lower', 0)
self.upper = self.configuration.get('upper', 1000)
self.values=dict()
@staticmethod
def check():
return True
process_data=dict()
process_metrics=["cpu"]
def logMe(self,msg):
self.debug(msg)
def calculate_data(self):
for metric in self.process_metrics:
self.process_data[metric]=("cpu")
def get_data(self):
#The data dict is basically all the values to be represented
# The entries are in the format: { "dimension": value}
#And each "dimension" should belong to a chart.
data = dict()
self.populate_data()
data['darknet'] = self.process_data["cpu"]
return data
Maybe you can help?
I’m not sure what I need to write to see the relevant data.
Thank you.