Rearranging and adding file structure for Debian packaging.

This commit is contained in:
gary-hessler
2014-02-28 10:19:02 -07:00
parent 8601c8ddf9
commit 660a2ecabe
515 changed files with 10226 additions and 259 deletions

6
debian/changelog vendored Normal file
View File

@@ -0,0 +1,6 @@
sommon (0.0.1) precise; urgency=low
* Initial commit
-- Gary Hessler <Gary.Hessler@hp.com> Thursday, 27 Feb 2014 16:12:44 -0600

1
debian/compat vendored Normal file
View File

@@ -0,0 +1 @@
7

17
debian/control vendored Normal file
View File

@@ -0,0 +1,17 @@
Source: monagent
Section: python
Priority: optional
Maintainer: Gary Hessler, <gary.hessler@hp.com>
Build-Depends: debhelper (>= 7),
python (>= 2.6.6-3~),
python-setuptools
Standards-Version: 3.9.3
X-Python-Version: >= 2.6
Package:monagent
Architecture: all
Section: python
Depends: ${misc:Depends}, ${python:Depends}, nose==1.3.0, python-memcached, pyyaml, simplejson, psutil, pylint
Description: Monitoring Agent. Used to send metrics from the host system
to a centralized collection point

4
debian/copyright vendored Normal file
View File

@@ -0,0 +1,4 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Files: *
Copyright: 2014, HP
License: Apache Software License 2.0

4
debian/rules vendored Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/make -f
%:
dh $@ --with python2

7
dependencies.txt Normal file
View File

@@ -0,0 +1,7 @@
pep8
nose
python-memcached
pyyaml
simplejson
psutil
pylint

1
monagent/__init__.py Normal file
View File

@@ -0,0 +1 @@
__author__ = 'gary'

View File

@@ -11,7 +11,7 @@
'''
# set up logging before importing any other components
from config import get_version, initialize_logging; initialize_logging('collector')
from monagent.config import get_version, initialize_logging; initialize_logging('collector')
import os; os.umask(022)
@@ -30,14 +30,14 @@ if int(sys.version_info[1]) <= 3:
sys.exit(2)
# Custom modules
from checks.collector import Collector
from checks.check_status import CollectorStatus
from config import get_config, get_system_stats, get_parsed_args, load_check_directory, get_confd_path, check_yaml, get_logging_config
from daemon import Daemon, AgentSupervisor
from emitter import http_emitter
from emitter import maas_http_emitter
from util import Watchdog, PidFile, EC2, get_os
from jmxfetch import JMXFetch
from monagent.checks.collector import Collector
from monagent.checks.check_status import CollectorStatus
from monagent.config import get_config, get_system_stats, get_parsed_args, load_check_directory, get_confd_path, check_yaml, get_logging_config
from monagent.daemon import Daemon, AgentSupervisor
from monagent.emitter import http_emitter
from monagent.emitter import maas_http_emitter
from monagent.util import Watchdog, PidFile, EC2, get_os
from monagent.jmxfetch import JMXFetch
# Constants
@@ -270,9 +270,9 @@ def main():
elif 'check' == command:
check_name = args[1]
try:
import checks.collector
import monagent.checks.collector
# Try the old-style check first
print getattr(checks.collector, check_name)(log).check(agentConfig)
print getattr(monagent.checks.collector, check_name)(log).check(agentConfig)
except Exception:
# If not an old-style check, try checks.d
checks = load_check_directory(agentConfig)
@@ -308,7 +308,7 @@ def main():
"http://yaml-online-parser.appspot.com/")
elif 'jmx' == command:
from jmxfetch import JMX_LIST_COMMANDS, JMXFetch
from monagent.jmxfetch import JMX_LIST_COMMANDS, JMXFetch
if len(args) < 2 or args[1] not in JMX_LIST_COMMANDS:
print "You have to specify one of the following command %s" % JMX_LIST_COMMANDS

View File

@@ -1,6 +1,8 @@
import logging
from time import time
from checks.metric_types import MetricTypes
from monagent.checks.metric_types import MetricTypes
log = logging.getLogger(__name__)

View File

@@ -0,0 +1 @@
__author__ = 'gary'

View File

@@ -1,6 +1,6 @@
import urllib2
from util import headers
from monagent.util import headers
from checks import AgentCheck
from checks.utils import add_basic_auth

View File

@@ -1,9 +1,9 @@
from checks import AgentCheck
from fnmatch import fnmatch
import os
import time
from util import namedtuple
from checks import AgentCheck
from monagent.util import namedtuple
CFUNC_TO_AGGR = {
'AVERAGE': 'avg',

View File

@@ -1,8 +1,9 @@
import urllib2
from util import json, headers
from monagent.util import json, headers
from checks import AgentCheck
class CouchDb(AgentCheck):
"""Extracts stats from CouchDB via its REST API
http://wiki.apache.org/couchdb/Runtime_Statistics

View File

@@ -1,10 +1,11 @@
import urllib2
import re
from util import json, headers
from monagent.util import json, headers
from checks import AgentCheck
from checks.utils import add_basic_auth
#Constants
COUCHBASE_STATS_PATH = '/pools/nodes'

View File

@@ -3,7 +3,7 @@ from os import stat, walk
from os.path import abspath, exists, join
import time
from checks import AgentCheck
from monagent.checks import AgentCheck
class DirectoryCheck(AgentCheck):

View File

@@ -5,10 +5,11 @@ import time
import urlparse
import urllib2
from util import json, headers
from monagent.util import json, headers
from checks import AgentCheck
from checks.utils import add_basic_auth
HEALTH_URL = "/_cluster/health?pretty=true"
STATS_URL = "/_cluster/nodes/stats?all=true"
NODES_URL = "/_cluster/nodes?network=true"

View File

@@ -1,4 +1,4 @@
from checks import AgentCheck
from monagent.checks import AgentCheck
class Gearman(AgentCheck):

View File

@@ -5,8 +5,6 @@ http://gunicorn.org/
"""
# stdlib
import os
import sys
import time
# 3p
@@ -16,7 +14,7 @@ except ImportError:
psutil = None
# project
from checks import AgentCheck
from monagent.checks import AgentCheck
class GUnicornCheck(AgentCheck):

View File

@@ -1,16 +1,11 @@
import urlparse
import urllib2
import socket
import time
from checks import AgentCheck
from util import json, headers
import time
try:
from collections import defaultdict
except ImportError:
from compat.defaultdict import defaultdict
STATS_URL = "/;csv;norefresh"
EVENT_TYPE = SOURCE_TYPE_NAME = 'haproxy'

View File

@@ -1,4 +1,4 @@
from checks import AgentCheck
from monagent.checks import AgentCheck
class HDFSCheck(AgentCheck):

View File

@@ -1,9 +1,10 @@
from checks.services_checks import ServicesCheck, Status, EventType
from util import headers
import socket
import time
from checks.services_checks import ServicesCheck, Status, EventType
from checks.libs.httplib2 import Http, HttpLib2Error
class HTTPCheck(ServicesCheck):
def _load_conf(self, instance):

View File

@@ -6,7 +6,7 @@ try:
except Exception:
wmi = None
from checks import AgentCheck
from monagent.checks import AgentCheck
class IIS(AgentCheck):
METRICS = [

View File

@@ -4,9 +4,7 @@ import time
try:
from collections import defaultdict
except ImportError:
from compat.defaultdict import defaultdict
from datetime import datetime
from glob import glob
try:
@@ -17,8 +15,8 @@ except ImportError:
except ImportError:
pass
from util import get_hostname
from checks import AgentCheck
from monagent.util import get_hostname
from monagent.checks import AgentCheck
class Skip(Exception):

View File

@@ -1,11 +1,11 @@
import re
import urllib2
try:
from collections import defaultdict
except ImportError:
from compat.defaultdict import defaultdict
from checks import AgentCheck
from monagent.checks import AgentCheck
db_stats = re.compile(r'^db_(\d)+$')
whitespace = re.compile(r'\s')

View File

@@ -1,6 +1,6 @@
import urllib2
from util import headers
from monagent.util import headers
from checks import AgentCheck
from checks.utils import add_basic_auth

View File

@@ -1,4 +1,4 @@
from checks import *
from monagent.checks import *
# Reference: http://code.sixapart.com/svn/memcached/trunk/server/doc/protocol.txt
# Name Type Meaning

View File

@@ -3,7 +3,8 @@ import types
import time
from checks import AgentCheck
from util import get_hostname
from monagent.util import get_hostname
# When running with pymongo < 2.0
# Not the full spec for mongo URIs -- just extract username and password

View File

@@ -4,7 +4,8 @@ import sys
import re
import traceback
from checks import AgentCheck
from monagent.checks import AgentCheck
GAUGE = "gauge"
RATE = "rate"

View File

@@ -3,14 +3,12 @@ Collects network metrics.
"""
# stdlib
import platform
import subprocess
import sys
import re
# project
from checks import AgentCheck
from util import Platform
from monagent.checks import AgentCheck
from monagent.util import Platform
class Network(AgentCheck):

View File

@@ -1,10 +1,11 @@
import re
import urllib2
from util import headers
from monagent.util import headers
from checks import AgentCheck
from checks.utils import add_basic_auth
class Nginx(AgentCheck):
"""Tracks basic nginx metrics via the status module
* number of connections

View File

@@ -1,6 +1,6 @@
import os
from checks import AgentCheck
from monagent.checks import AgentCheck
class PostfixCheck(AgentCheck):
"""This check provides metrics on the number of messages in a given postfix queue

View File

@@ -1,4 +1,4 @@
from checks import AgentCheck, CheckException
from monagent.checks import AgentCheck, CheckException
class PostgreSql(AgentCheck):
"""Collects per-database, and optionally per-relation metrics

View File

@@ -1,6 +1,6 @@
from checks import AgentCheck
from util import Platform
import time
from monagent.checks import AgentCheck
from monagent.util import Platform
class ProcessCheck(AgentCheck):

View File

@@ -3,7 +3,8 @@ import urlparse
import time
from checks import AgentCheck
from util import json
from monagent.util import json
EVENT_TYPE = SOURCE_TYPE_NAME = 'rabbitmq'
QUEUE_TYPE = 'queues'

View File

@@ -3,7 +3,9 @@ Redis checks
'''
import re
import time
from checks import AgentCheck
from monagent.checks import AgentCheck
class Redis(AgentCheck):
db_key_pattern = re.compile(r'^db\d+')

View File

@@ -1,11 +1,10 @@
import time
import socket
from checks import AgentCheck
from util import md5
from util import json
from monagent.util import md5
from monagent.util import json
from checks.libs.httplib2 import Http, HttpLib2Error
import socket
class Riak(AgentCheck):

View File

@@ -1,9 +1,11 @@
'''
Check the performance counters from SQL Server
'''
from checks import AgentCheck
import traceback
from monagent.checks import AgentCheck
ALL_INSTANCES = 'ALL'
VALID_METRIC_TYPES = ('gauge', 'rate', 'histogram')

View File

@@ -1,7 +1,9 @@
from checks.services_checks import ServicesCheck, Status, EventType
import socket
import time
from monagent.checks.services_checks import ServicesCheck, Status, EventType
class BadConfException(Exception): pass
class TCPCheck(ServicesCheck):

View File

@@ -2,7 +2,8 @@ import xml.parsers.expat # python 2.4 compatible
import re
import subprocess
from checks import AgentCheck
from monagent.checks import AgentCheck
class Varnish(AgentCheck):
# XML parsing bits, a.k.a. Kafka in Code

View File

@@ -1,14 +1,14 @@
'''
Monitor the Windows Event Log
'''
from datetime import datetime, timedelta
from datetime import datetime
import calendar
try:
import wmi
except Exception:
wmi = None
from checks import AgentCheck
from monagent.checks import AgentCheck
SOURCE_TYPE_NAME = 'event viewer'
EVENT_TYPE = 'win32_log_event'

View File

@@ -10,7 +10,7 @@ try:
except Exception:
wmi = None
from checks import AgentCheck
from monagent.checks import AgentCheck
UP_METRIC = 'Up'
SEARCH_WILDCARD = '*'

View File

@@ -24,12 +24,14 @@ Tested with Zookeeper versions 3.0.0 to 3.4.5
'''
from checks import AgentCheck
import re
import socket
import struct
from StringIO import StringIO
from monagent.checks import AgentCheck
class Zookeeper(AgentCheck):
version_pattern = re.compile(r'Zookeeper version: ([^.]+)\.([^.]+)\.([^-]+)', flags=re.I)

View File

@@ -6,17 +6,17 @@ The Check class is being deprecated so don't write new checks with it.
import logging
import re
import socket
import time
import types
import os
import sys
import traceback
from pprint import pprint
from util import LaconicFilter, get_os, get_hostname
from config import get_confd_path
from checks import check_status
from monagent import yaml
from monagent.checks import check_status
log = logging.getLogger(__name__)
@@ -120,7 +120,7 @@ class Check(object):
def save_sample(self, metric, value, timestamp=None, tags=None, hostname=None, device_name=None):
"""Save a simple sample, evict old values if needed
"""
from util import cast_metric_val
from monagent.util import cast_metric_val
if timestamp is None:
timestamp = time.time()
@@ -271,7 +271,7 @@ class AgentCheck(object):
:param agentConfig: The global configuration for the agent
:param instances: A list of configuration objects for each instance.
"""
from aggregator import MetricsAggregator
from monagent.aggregator import MetricsAggregator
self.name = name
@@ -496,7 +496,7 @@ class AgentCheck(object):
"""
A method used for testing your check without running the agent.
"""
from util import yaml, yLoader
from monagent.util import yLoader
if path_to_yaml:
check_name = os.path.basename(path_to_yaml).split('.')[0]
try:

View File

@@ -1,5 +1,6 @@
import threading
from checks import Check
from monagent.checks import Check
MAX_THREADS_COUNT = 50

View File

@@ -11,16 +11,14 @@ import pickle
import platform
import sys
import tempfile
import traceback
import time
# project
import config
from compat.defaultdict import defaultdict
from util import get_os, yaml, yLoader
# 3rd party
from checks.libs import ntplib
from monagent import config
from monagent.checks.libs import ntplib
from monagent.compat import defaultdict
STATUS_OK = 'OK'
STATUS_ERROR = 'ERROR'

View File

@@ -1,18 +1,11 @@
# Core modules
import os
import re
import logging
import subprocess
import sys
import time
import datetime
import socket
import modules
from util import get_os, get_uuid, md5, Timer, get_hostname, EC2
from config import get_version, get_system_stats
import checks.system.unix as u
import checks.system.win32 as w32
from checks.agent_metrics import CollectorMetrics
@@ -20,7 +13,7 @@ from checks.ganglia import Ganglia
from checks.nagios import Nagios
from checks.datadog import Dogstreams, DdForwarder
from checks.check_status import CheckStatus, CollectorStatus, EmitterStatus
from resources.processes import Processes as ResProcesses
from monagent.resources.processes import Processes as ResProcesses
log = logging.getLogger(__name__)

View File

@@ -1,5 +1,3 @@
from checks.utils import TailFile
import modules
import os
import sys
import traceback
@@ -8,7 +6,10 @@ import time
from datetime import datetime
from itertools import groupby # >= python 2.4
from checks.utils import TailFile
from checks import LaconicFilter
from monagent import modules
if hasattr('some string', 'partition'):
def partition(s, sep):

View File

@@ -1,7 +1,9 @@
from checks import Check
import socket
from cStringIO import StringIO
from monagent.checks import Check
class Ganglia(Check):
BUFFER = 4096
TIMEOUT = 0.5

View File

@@ -23,7 +23,7 @@
Defines an interface which all Auth handlers need to implement.
"""
from plugin import Plugin
from monagent.checks.libs.boto.plugin import Plugin
class NotReadyToAuthenticate(Exception):
pass

View File

@@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
from connection import CloudFormationConnection
from monagent.checks.libs.boto.cloudformation.connection import CloudFormationConnection
from boto.regioninfo import RegionInfo
RegionData = {

View File

@@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
from identity import OriginAccessIdentity
from monagent.checks.libs.boto.cloudfront.identity import OriginAccessIdentity
def get_oai_value(origin_access_identity):
if isinstance(origin_access_identity, OriginAccessIdentity):

View File

@@ -22,14 +22,12 @@
# IN THE SOFTWARE.
#
import boto
from boto.compat import json
from .optionstatus import OptionStatus
from .optionstatus import IndexFieldStatus
from .optionstatus import ServicePoliciesStatus
from .optionstatus import RankExpressionStatus
from .document import DocumentServiceConnection
from .search import SearchConnection
from .monagent.checks.libs.boto.cloudsearch.optionstatus import OptionStatus
from .monagent.checks.libs.boto.cloudsearch.optionstatus import IndexFieldStatus
from .monagent.checks.libs.boto.cloudsearch.optionstatus import ServicePoliciesStatus
from .monagent.checks.libs.boto.cloudsearch.optionstatus import RankExpressionStatus
from .monagent.checks.libs.boto.cloudsearch.document import DocumentServiceConnection
from .monagent.checks.libs.boto.cloudsearch.search import SearchConnection
def handle_bool(value):
if value in [True, 'true', 'True', 'TRUE', 1]:

View File

@@ -22,8 +22,8 @@
# IN THE SOFTWARE.
#
from .layer1 import Layer1
from .domain import Domain
from .monagent.checks.libs.boto.cloudsearch.layer1 import Layer1
from .monagent.checks.libs.boto.cloudsearch.domain import Domain
class Layer2(object):

View File

@@ -48,7 +48,6 @@ import base64
import errno
import httplib
import os
import Queue
import random
import re
import socket
@@ -60,20 +59,18 @@ import xml.sax
import copy
import auth
import auth_handler
import boto
import boto.utils
import boto.handler
import boto.cacerts
from boto import config, UserAgent
from boto.exception import AWSConnectionError
from boto.exception import BotoClientError
from boto.exception import BotoServerError
from boto.exception import PleaseRetryException
from boto.provider import Provider
from boto.resultset import ResultSet
HAVE_HTTPS_CONNECTION = False
try:
import ssl

View File

@@ -26,7 +26,8 @@ SQS Message class that supports YAML as the body of the message.
This module requires the yaml module.
"""
from boto.sqs.message import Message
import yaml
from monagent import yaml
class YAMLMessage(Message):
"""

View File

@@ -27,7 +27,8 @@ Python types and vice-versa.
import base64
from decimal import (Decimal, DecimalException, Context,
Clamped, Overflow, Inexact, Underflow, Rounded)
from exceptions import DynamoDBNumberError
from monagent.checks.libs.boto.dynamodb.exceptions import DynamoDBNumberError
DYNAMODB_CONTEXT = Context(

Some files were not shown because too many files have changed in this diff Show More