Exemplo n.º 1
0
from bbm.jmx import start_jmx_collector
from bbm.jvm import jvm_collector
from bbm.tomcat import tomcat_collector
from bbm.c3p0 import c3p0_collector

#from threading  import Thread
#
#def tester():
#  print >>sys.stderr, "timeout"
#  return True
#
##t = Thread(target=enqueue_process, args=(q, "tail", ["--lines","0","-f", "/var/log/syslog"],1000, tester))
#t.daemon = True # thread dies with the program
#t.start()

signal.signal(signal.SIGCHLD, signal.SIG_IGN)


def renamer(v):
    return v


q = start_jmx_collector(1, "6031", jvm_collector)

while True:
    line = q.get()
    if line != QUEUE_FINISHED:
        print >> sys.stdout, line
    else:
        break
Exemplo n.º 2
0
from bbm.tomcat import tomcat_collector

signal.signal(signal.SIGCHLD, signal.SIG_IGN)


# The radiosite uses an embdedded tomcat with the webapp name set to "Tomcat", we';;
# rewrite the webapp name to "radiosite"
def renamer(v):
    if v.metric.startswith("tomcat."):
        v.tags = map(
            lambda t: "webapp=radiosite"
            if t.startswith("webapp=") else t, v.tags)
    return v


# Find the pid of the bbm-radio-site server
pgrep = subprocess.check_output([
    "/usr/bin/pgrep", "-f", "-u", "bbm-radio-site",
    "/usr/share/bbm-radio-site/radio-site.war"
])
jpid = pgrep.rstrip("\n")
if jpid == "":
    sys.exit(1)

# We can change over to hte bbm-radio-site user for security
utils.drop_privileges(user="******")

RunCollector(start_jmx_collector(15, jpid, jvm_collector + tomcat_collector,
                                 renamer),
             extraTags=["application=radiosite"])
Exemplo n.º 3
0
#!/usr/bin/python

import signal
import sys
import subprocess
from collectors.lib import utils
from bbm import RunCollector
from bbm.jmx import start_jmx_collector

# These are the jmx handlers we'll be using.
from bbm.jvm import jvm_collector

signal.signal(signal.SIGCHLD, signal.SIG_IGN)

# Find the pid of the bbm-core-api server
pgrep = subprocess.check_output([
    "/usr/bin/pgrep", "-f", "-u", "bbm-search",
    "/usr/share/bbm-search/bbm-search-all.jar"
])
jpid = pgrep.rstrip("\n")
if jpid == "":
    sys.exit(1)

# We can change over to hte bbm-core-api user for secturity
utils.drop_privileges(user="******")

RunCollector(start_jmx_collector(15, jpid, jvm_collector),
             extraTags=["application=search"])
Exemplo n.º 4
0
#!/usr/bin/python

import signal
import sys
import subprocess
from collectors.lib  import utils
from bbm import RunCollector
from bbm.jmx import start_jmx_collector

# These are the jmx handlers we'll be using.
from bbm.jvm import jvm_collector

signal.signal(signal.SIGCHLD, signal.SIG_IGN)

# Find the pid of the bbm-core-api server
pgrep = subprocess.check_output(["/usr/bin/pgrep","-f","-u", "bbm-search", "/usr/share/bbm-search/bbm-search-all.jar"])
jpid = pgrep.rstrip("\n")
if jpid == "":
   sys.exit(1)

# We can change over to hte bbm-core-api user for secturity
utils.drop_privileges(user="******")

RunCollector(start_jmx_collector(15, jpid, jvm_collector), extraTags=["application=search"])

Exemplo n.º 5
0
import sys
import subprocess
from collectors.lib  import utils
from bbm import RunCollector
from bbm.jmx import start_jmx_collector

# These are the jmx handlers we'll be using.
from bbm.jvm import jvm_collector
from bbm.tomcat import tomcat_collector

signal.signal(signal.SIGCHLD, signal.SIG_IGN)

# The radiosite uses an embdedded tomcat with the webapp name set to "Tomcat", we';;
# rewrite the webapp name to "radiosite"
def renamer(v):
    if v.metric.startswith("tomcat."):
        v.tags = map(lambda t : "webapp=radiosite" if t.startswith("webapp=") else t , v.tags)
    return v

# Find the pid of the bbm-radio-site server
pgrep = subprocess.check_output(["/usr/bin/pgrep","-f","-u", "bbm-radio-site", "/usr/share/bbm-radio-site/radio-site.war"])
jpid = pgrep.rstrip("\n")
if jpid == "":
   sys.exit(1)

# We can change over to hte bbm-radio-site user for security
utils.drop_privileges(user="******")

RunCollector(start_jmx_collector(15, jpid, jvm_collector + tomcat_collector, renamer), extraTags=["application=radiosite"])

Exemplo n.º 6
0
            v.metric = v.metric[:-1 * len("QueueSize")] + "size"

        if v.metric == "MemoryUsagePortion":
            v.metric = "memory_portion"

        if v.metric == "CursorMemoryUsage":
            v.metric = "cursor_memory_usage"

        if v.metric == "MaxPageSize":
            v.metric = "page_size.max"

        if v.metric.endswith("Time"):
            m = v.metric[:-1 * len("time")]
            if m.startswith("Min"):
                m = m[len("Min"):].lower() + "_time.min"
            if m.startswith("Max"):
                m = m[len("Max"):].lower() + "_time.max"
            if m.startswith("Average"):
                m = m[len("Average"):].lower() + "_time.average"
            v.metric = m

        v.metric = "activemq.%s.%s" % (metrictype, v.metric)

    return v

activemq_collector = [JMXPattern("Type=Broker", "Count$|Usage$|Limit$"), # Broker specific stats
                       JMXPattern(",Type=Queue", "Count$|Usage$|Limit$|Portion$|Time$|Size$")] # Queue specific stats

RunCollector(start_jmx_collector(15, jpid, jvm_collector + activemq_collector, rewriter), extraTags=["application=activemq"])

Exemplo n.º 7
0
from bbm.jmx import start_jmx_collector
from bbm.jvm import jvm_collector
from bbm.tomcat import tomcat_collector
from bbm.c3p0 import c3p0_collector


#from threading  import Thread
#
#def tester():
#  print >>sys.stderr, "timeout"
#  return True
#
##t = Thread(target=enqueue_process, args=(q, "tail", ["--lines","0","-f", "/var/log/syslog"],1000, tester))
#t.daemon = True # thread dies with the program
#t.start()

signal.signal(signal.SIGCHLD, signal.SIG_IGN)

def renamer(v):
    return v

q = start_jmx_collector(1, "6031", jvm_collector)

while True:
  line = q.get()
  if line != QUEUE_FINISHED:
    print >>sys.stdout, line
  else:
    break

Exemplo n.º 8
0
        v.tags = [
            "store=" + x[len("type="):] for x in v.tags
            if x.startswith("type=")
        ]
        if v.metric.startswith("numberOfCallsTo"):
            op = v.metric[len("numberOfCallsTo"):].lower()
            v.metric = "voldemort.calls"
            v.tags = v.tags + ["op=" + op]
            return v
        if v.metric.endswith("CompletionTimeInMs"):
            op = v.metric[len("average"):-1 *
                          len("CompletionTimeInMs")].lower()
            v.metric = "voldemort.avgTime"
            v.tags = v.tags + ["op=" + op]
            return v
        if v.metric.endswith("averageOperationTimeInMs"):
            op = "all"
            v.metric = "voldemort.avgTime"
            v.tags = v.tags + ["op=" + op]
            return v
    return v


voldemort_collector = [
    JMXPattern("voldemort.store.stats", 'numberOfCalls|InMs$')
]

RunCollector(start_jmx_collector(15, jpid, jvm_collector + voldemort_collector,
                                 rewriter),
             extraTags=["application=voldemort"])
Exemplo n.º 9
0
#!/usr/bin/python

import signal
import sys
import subprocess
from collectors.lib  import utils
from bbm import RunCollector
from bbm.jmx import start_jmx_collector

# These are the jmx handlers we'll be using.
from bbm.jvm import jvm_collector
from bbm.jetty import jetty_collector

signal.signal(signal.SIGCHLD, signal.SIG_IGN)

# Find the pid of the tomcat server
pgrep = subprocess.check_output(["/usr/bin/pgrep","-u", "bbm-events-api", "-f", "/etc/bbm/bbm-events-api.yml"])
jpid = pgrep.rstrip("\n") 
if jpid == "":
   sys.exit(1)

# We can change over to tomcat7 user for secturity
utils.drop_privileges(user="******")

RunCollector(start_jmx_collector(15, jpid, jvm_collector + jetty_collector), extraTags=["application=events-api"])

Exemplo n.º 10
0
        if v.metric == "CursorMemoryUsage":
            v.metric = "cursor_memory_usage"

        if v.metric == "MaxPageSize":
            v.metric = "page_size.max"

        if v.metric.endswith("Time"):
            m = v.metric[:-1 * len("time")]
            if m.startswith("Min"):
                m = m[len("Min"):].lower() + "_time.min"
            if m.startswith("Max"):
                m = m[len("Max"):].lower() + "_time.max"
            if m.startswith("Average"):
                m = m[len("Average"):].lower() + "_time.average"
            v.metric = m

        v.metric = "activemq.%s.%s" % (metrictype, v.metric)

    return v


activemq_collector = [
    JMXPattern("Type=Broker", "Count$|Usage$|Limit$"),  # Broker specific stats
    JMXPattern(",Type=Queue", "Count$|Usage$|Limit$|Portion$|Time$|Size$")
]  # Queue specific stats

RunCollector(start_jmx_collector(15, jpid, jvm_collector + activemq_collector,
                                 rewriter),
             extraTags=["application=activemq"])
Exemplo n.º 11
0
#!/usr/bin/python

import signal
import sys
import subprocess
from collectors.lib  import utils
from bbm import RunCollector
from bbm.jmx import start_jmx_collector

# These are the jmx handlers we'll be using.
from bbm.jvm import jvm_collector
from bbm.tomcat import tomcat_collector

signal.signal(signal.SIGCHLD, signal.SIG_IGN)

# Find the pid of the tomcat server
pgrep = subprocess.check_output(["/usr/bin/pgrep","-u", "tomcat7", "java"])
jpid = pgrep.rstrip("\n") 
if jpid == "":
   sys.exit(1)

# We can change over to tomcat7 user for secturity
utils.drop_privileges(user="******")

RunCollector(start_jmx_collector(15, jpid, jvm_collector + tomcat_collector), extraTags=["application=tomcat7"])