MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Hatohol. If not, see <http://www.gnu.org/licenses/>. """ from logging import getLogger import os import pika import hap from hatohol.transporter import Transporter from hatohol import hapcommon logger = getLogger("hatohol.rabbitmqconnector:%s" % hapcommon.get_top_file_name()) MAX_BODY_SIZE = 50000 MAX_FRAME_SIZE = 131072 class RabbitMQConnector(Transporter): HAPI_AMQP_PASSWORD_ENV_NAME = "HAPI_AMQP_PASSWORD" def __init__(self): Transporter.__init__(self) self._channel = None self.__connection = None def setup(self, transporter_args): """ @param transporter_args The following keys shall be included.
<http://www.gnu.org/licenses/>. """ import subprocess from logging import getLogger import multiprocessing import datetime import json import re import time import signal from hatohol import hap from hatohol import haplib from hatohol import standardhap from hatohol import hapcommon logger = getLogger("hatohol.hap2_fluentd:%s" % hapcommon.get_top_file_name()) class Hap2FluentdMain(haplib.BaseMainPlugin): # Ex.) 2016-03-03 12:11:17 +0900 hatohol.hoge __re_expected_msg = re.compile( r"^\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d \+\d\d\d\d [^\[]+:") def __init__(self, *args, **kwargs): haplib.BaseMainPlugin.__init__(self) self.__manager = None self.__default_host = "UNKNOWN" self.__default_type = "UNKNOWN" self.__default_status = "UNKNOWN" self.__default_severity = "UNKNOWN"
You should have received a copy of the GNU Lesser General Public License along with Hatohol. If not, see <http://www.gnu.org/licenses/>. """ import sys import imp from logging import getLogger from hatohol import hapcommon DIR_BOTH = 0 DIR_SEND = 1 DIR_RECV = 2 logger = getLogger("hatohol.transporter:%s" % hapcommon.get_top_file_name()) class Transporter: """ An abstract class for transportation of RPC messages for HAPI2. """ def __init__(self): self.__receiver = None @classmethod def define_arguments(cls, parser): """ Define arguments for argparser. @param parser A parser object otabined by argparse.ArgumentParser() """ pass
import time from logging import getLogger import multiprocessing import Queue import json from datetime import datetime from datetime import timedelta import random import copy from hatohol import hap from hatohol import hapcommon from hatohol import transporter from hatohol.rabbitmqconnector import OverCapacity logger = getLogger("hatohol.haplib:%s" % hapcommon.get_top_file_name()) SERVER_PROCEDURES = {"exchangeProfile": True, "getMonitoringServerInfo": True, "getLastInfo": True, "putItems": True, "putHistory": True, "putHosts": True, "putHostGroups": True, "putHostGroupMembership": True, "updateTriggers": True, "updateEvents": True, "updateHostParent": True, "putArmInfo": True} PROCEDURES_DEFS = {
def test_get_top_file_name(self): expect_result = "runpy.pyc" self.assertEquals(hapcommon.get_top_file_name(), expect_result)
<http://www.gnu.org/licenses/>. """ import time import datetime import socket import uuid import json from logging import getLogger from mk_livestatus import Socket from hatohol import hap from hatohol import haplib from hatohol import hapcommon from hatohol import standardhap logger = getLogger("hatohol.hap2_nagios_livestatus:%s" % hapcommon.get_top_file_name()) class Common: STATE_OK = 0 STATE_WARNING = 1 STATE_CRITICAL = 2 STATUS_MAP = {STATE_OK: "OK", STATE_WARNING: "NG", STATE_CRITICAL: "NG"} SEVERITY_MAP = { STATE_OK: "INFO", STATE_WARNING: "WARNING", STATE_CRITICAL: "CRITICAL"} EVENT_TYPE_MAP = { STATE_OK: "GOOD", STATE_WARNING: "BAD", STATE_CRITICAL: "BAD"} DEFAULT_PATH = "/tmp/nagios.sock"
You should have received a copy of the GNU Lesser General Public License along with Hatohol. If not, see <http://www.gnu.org/licenses/>. """ import sys import imp from logging import getLogger from hatohol import hapcommon DIR_BOTH = 0 DIR_SEND = 1 DIR_RECV = 2 logger = getLogger("hatohol.transporter:%s" % hapcommon.get_top_file_name()) class Transporter: """ An abstract class for transportation of RPC messages for HAPI2. """ def __init__(self): self.__receiver = None @classmethod def define_arguments(cls, parser): """ Define arguments for argparser. @param parser A parser object otabined by argparse.ArgumentParser() """
GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Hatohol. If not, see <http://www.gnu.org/licenses/>. """ import time from logging import getLogger from hatohol import hapcommon from hatohol import haplib from hatohol import zabbixapi from hatohol import standardhap logger = getLogger("hatohol.hap2_zabbix_api:%s" % hapcommon.get_top_file_name()) MAX_NUMBER_OF_EVENTS_FROM_ZABBIX = 1000 MAX_NUMBER_OF_EVENTS_OF_HAPI2 = 1000 class ZabbixAPIConductor(object): def __init__(self): self.__api = None self.__trigger_last_info = None self.__component_code = self.get_component_code() def reset(self): self.__api = None def make_sure_token(self): if self.__api is not None:
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Hatohol. If not, see <http://www.gnu.org/licenses/>. """ import urllib2 import json from logging import getLogger from hatohol import hap from hatohol import hapcommon logger = getLogger("hatohol.zabbixapi:%s" % hapcommon.get_top_file_name()) TRIGGER_SEVERITY = { "-1": "ALL", "0": "UNKNOWN", "1": "INFO", "2": "WARNING", "3": "ERROR", "4": "CRITICAL", "5": "EMERGENCY" } TRIGGER_STATUS = {"0": "OK", "1": "NG", "2": "UNKNOWN"} EVENT_TYPE = {"0": "GOOD", "1": "BAD", "2": "UNKNOWN", "3": "NOTIFICATION"} class AuthenticationError(Exception):
You should have received a copy of the GNU Lesser General Public License along with Hatohol. If not, see <http://www.gnu.org/licenses/>. """ from logging import getLogger import os import pika from pika import exceptions import traceback import hap from hatohol.transporter import Transporter from hatohol import hapcommon logger = getLogger("hatohol.rabbitmqconnector:%s" % hapcommon.get_top_file_name()) MAX_BODY_SIZE = 50000 MAX_FRAME_SIZE = 131072 DEFAULT_HEARTBEAT_TIME = 60 class RabbitMQConnector(Transporter): HAPI_AMQP_PASSWORD_ENV_NAME = "HAPI_AMQP_PASSWORD" def __init__(self): Transporter.__init__(self) self._channel = None self.__connection = None self.__transporter_args = None def _connect(self, transporter_args=None): """
License along with Hatohol. If not, see <http://www.gnu.org/licenses/>. """ import argparse from logging import getLogger import signal import os from hatohol import hap from hatohol import haplib from hatohol import transporter from hatohol import hapcommon from hatohol import autotools_vars import logging logger = getLogger("hatohol.standardhap:%s" % hapcommon.get_top_file_name()) class StandardHap: def __init__(self, default_transporter="RabbitMQHapiConnector"): parser = argparse.ArgumentParser(add_help=False) group = parser.add_argument_group("Config") help_msg = """ A configuration file. Other command line arguments override items in the config. file. """ group.add_argument("--config", default=None, help=help_msg) args, remaining_args = parser.parse_known_args() config_path = None if args.config:
License along with Hatohol. If not, see <http://www.gnu.org/licenses/>. """ import urllib2 import json import datetime import cPickle import base64 from logging import getLogger from hatohol import hap from hatohol import haplib from hatohol import standardhap from hatohol import hapcommon logger = getLogger("hatohol.hap2_ceilometer:%s" % hapcommon.get_top_file_name()) class Common: STATUS_MAP = {"ok": "OK", "insufficient data": "UNKNOWN", "alarm": "NG"} STATUS_EVENT_MAP = {"OK": "GOOD", "NG": "BAD", "UNKNOWN": "UNKNOWN"} INITIAL_LAST_INFO = "" def __init__(self): self.close_connection() self.__target_items = frozenset(( "cpu", "cpu_util", "disk.read.requests", "disk.read.requests.rate", "disk.read.bytes",
You should have received a copy of the GNU Lesser General Public License along with Hatohol. If not, see <http://www.gnu.org/licenses/>. """ import MySQLdb import time from logging import getLogger import datetime from hatohol import hap from hatohol import haplib from hatohol import standardhap from hatohol import hapcommon logger = getLogger("hatohol.hap2_nagios_ndoutils:%s" % hapcommon.get_top_file_name()) class Common: STATE_OK = 0 STATE_WARNING = 1 STATE_CRITICAL = 2 STATUS_MAP = {STATE_OK: "OK", STATE_WARNING: "NG", STATE_CRITICAL: "NG"} SEVERITY_MAP = { STATE_OK: "INFO", STATE_WARNING: "WARNING", STATE_CRITICAL: "CRITICAL"} EVENT_TYPE_MAP = { STATE_OK: "GOOD", STATE_WARNING: "BAD", STATE_CRITICAL: "BAD"} DEFAULT_SERVER = "localhost" DEFAULT_PORT = 3306
<http://www.gnu.org/licenses/>. """ import subprocess from logging import getLogger import multiprocessing import datetime import json import re import time import signal from hatohol import hap from hatohol import haplib from hatohol import standardhap from hatohol import hapcommon logger = getLogger("hatohol.hap2_fluentd:%s" % hapcommon.get_top_file_name()) class Hap2FluentdMain(haplib.BaseMainPlugin): # Ex.) 2016-03-03 12:11:17 +0900 hatohol.hoge __re_expected_msg = re.compile( r"^\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d \+\d\d\d\d [^\[]+:") def __init__(self, *args, **kwargs): haplib.BaseMainPlugin.__init__(self) self.__manager = None self.__default_host = "UNKNOWN" self.__default_type = "UNKNOWN" self.__default_status = "UNKNOWN"
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Hatohol. If not, see <http://www.gnu.org/licenses/>. """ import urllib2 import json from logging import getLogger from hatohol import hap from hatohol import hapcommon logger = getLogger("hatohol.zabbixapi:%s" % hapcommon.get_top_file_name()) TRIGGER_SEVERITY = {"-1": "ALL", "0": "UNKNOWN", "1": "INFO", "2": "WARNING", "3": "ERROR", "4": "CRITICAL", "5": "EMERGENCY"} TRIGGER_STATUS = {"0": "OK", "1": "NG", "2": "UNKNOWN"} EVENT_TYPE = {"0": "GOOD", "1": "BAD", "2": "UNKNOWN", "3": "NOTIFICATION"} class AuthenticationError(Exception): def __init__(self, value): self.value = value def __str__(self): return repr(self.value)
import time from logging import getLogger import multiprocessing import Queue import json from datetime import datetime from datetime import timedelta import random import copy import uuid from hatohol import hap from hatohol import hapcommon from hatohol import transporter from hatohol.rabbitmqconnector import OverCapacity logger = getLogger("hatohol.haplib:%s" % hapcommon.get_top_file_name()) SERVER_PROCEDURES = { "exchangeProfile": True, "getMonitoringServerInfo": True, "getLastInfo": True, "putItems": True, "putHistory": True, "putHosts": True, "putHostGroups": True, "putHostGroupMembership": True, "updateTriggers": True, "updateEvents": True, "updateHostParent": True, "putArmInfo": True }