Exemple #1
0
        'You must install the python module "psutil" to run on Windows.  Typically, this can be done with'
        "the following command:  pip install psutil")

# [start of 2->TODO]
# Check for suitability.
# This file can be executed as script and imported as module.
if __name__ == "__main__":
    # run as script, can not import __scalyr__.py as part of the package.
    from __scalyr__ import get_install_root, scalyr_init
else:
    # run as package module.
    # Python3 does not allow to import __scalyr__.py file within the same package just by its name. (PEP 328)
    from scalyr_agent.__scalyr__ import get_install_root, scalyr_init
# [end of 2->TOD0]

scalyr_init()

# [start of 2->TODO]
# Check for suitability.
# Important. Import six as any other dependency from "third_party" libraries after "__scalyr__.scalyr_init"
from six.moves import input

# [end of 2->TOD0]t

from scalyr_agent.json_lib import JsonObject
from scalyr_agent.util import RedirectorServer, RedirectorClient, RedirectorError
from scalyr_agent.platform_controller import (
    PlatformController,
    DefaultPaths,
    CannotExecuteAsUser,
    AgentNotRunning,
Exemple #2
0
#                          The number of seconds between calls to the monitor's
#                          gather_sample method.
#
# author: Steven Czerwinski <*****@*****.**>

__author__ = '*****@*****.**'

import signal
import sys
import time

from optparse import OptionParser

from __scalyr__ import scalyr_init

scalyr_init()

import scalyr_agent.scalyr_logging as scalyr_logging
import scalyr_agent.json_lib as json_lib
from scalyr_agent.log_watcher import LogWatcher

from scalyr_agent.monitors_manager import MonitorsManager
from scalyr_agent.scalyr_monitor import BadMonitorConfiguration

from scalyr_agent.configuration import Configuration
from scalyr_agent.platform_controller import PlatformController, DefaultPaths

log = scalyr_logging.getLogger('scalyr_agent.run_monitor')


def run_standalone_monitor(monitor_module, monitor_python_path, monitor_config, monitor_sample_interval,