# Path: collectors/etc/mapr_metrics_conf.py
# def enabled():
# def get_config():
# 
# Path: collectors/lib/utils.py
# PY3 = sys.version_info[0] > 2
# USER = "nobody"
# def drop_privileges(user=USER):
# def is_sockfile(path):
# def err(msg):
#     def is_numeric(value):
#     def is_numeric(value):


import datetime
import sys
import platform
import sys
import time
import re
  import requests
from datetime import timedelta
from string import Template
from collectors.etc import mapr_metrics_conf
from collectors.lib import utils
  from collectors.etc import mapr_metrics_conf
      params = { 'nodes': nodename, 'start': ms_start, 'end': ms_end }

      try:
        all_metrics = get_metrics(self.webserver_url, self.username, self.password, params)
        self.failed_attempts = 0
      except requests.exceptions.ConnectionError as error:
        self.failed_attempts += 1
        utils.err("Error connecting to %s, have experienced %d errors so far." % (self.webserver_url, self.failed_attempts))
        if self.failed_attempts > 5:
          print >>sys.stderr, "Failed 5 times, exiting."
          return 13
        continue

      if len(all_metrics) > 0:
        for d in all_metrics[-1:]:
          node = d['NODE']
          timestamp = int(d['TIMESTAMP']) / 1000
          tags = {
            'node': node,
            'cluster': self.cluster_name
          }

          for group in ('DISKS','CPUS','NETWORK'):
            if group in d:
              self.group_metrics(group, self.last_values, d, tags=tags)
          try:
            self.send_gauge('mapr.memory.used', int(d['MEMORYUSED']) * (1024*1024), timestamp, tags=tags)
          except KeyError as e:
            utils.err('%s not in metrics data.' % e)


# Path: collectors/etc/mapr_metrics_conf.py
# def enabled():
# def get_config():
# 
# Path: collectors/lib/utils.py
# PY3 = sys.version_info[0] > 2
# USER = "nobody"
# def drop_privileges(user=USER):
# def is_sockfile(path):
# def err(msg):
#     def is_numeric(value):
#     def is_numeric(value):


# Path: collectors/0/mapr_metrics.py
import datetime
import sys
import platform
import sys
import time
import re
  import requests
from datetime import timedelta
from string import Template
from collectors.etc import mapr_metrics_conf
from collectors.lib import utils
  from collectors.etc import mapr_metrics_conf

      params = { 'nodes': nodename, 'start': ms_start, 'end': ms_end }

      try:
        all_metrics = get_metrics(self.webserver_url, self.username, self.password, params)
        self.failed_attempts = 0
      except requests.exceptions.ConnectionError as error:
        self.failed_attempts += 1
        utils.err("Error connecting to %s, have experienced %d errors so far." % (self.webserver_url, self.failed_attempts))
        if self.failed_attempts > 5:
          print >>sys.stderr, "Failed 5 times, exiting."
          return 13
        continue

      if len(all_metrics) > 0:
        for d in all_metrics[-1:]:
          node = d['NODE']
          timestamp = int(d['TIMESTAMP']) / 1000
          tags = {
            'node': node,
            'cluster': self.cluster_name
          }

          for group in ('DISKS','CPUS','NETWORK'):
            if group in d:
              self.group_metrics(group, self.last_values, d, tags=tags)
          try:
            self.send_gauge('mapr.memory.used', int(d['MEMORYUSED']) * (1024*1024), timestamp, tags=tags)
          except KeyError as e:
            utils.err('%s not in metrics data.' % e)


          try: