agent
Module to manage Agent classes.
Description:
This module:
- Processes a variety of information from agents
- Posts the data using HTTP to a server listed in the configuration file
Agent Objects
class Agent()
Agent class for daemons.
__init__
def __init__(parent, child=None, config=None)
Initialize the class.
Arguments:
parent- Name of parent daemonchild- Name of child daemonconfig- ConfigCore object
Returns:
None
name
def name()
Return agent name.
Arguments:
None
Returns:
value- Name of agent
query
def query()
Create placeholder method. Do not delete.
Arguments:
None
Returns:
None
_AgentRun Objects
class _AgentRun()
Class that defines basic run function for AgentDaemons.
__init__
def __init__(agent)
Initialize the class.
Arguments:
agent- agent object
Returns:
None
run
def run()
Start Polling.
Arguments:
None
Returns:
None
AgentDaemon Objects
class AgentDaemon(_AgentRun, Daemon)
Class that manages base agent daemonization.
__init__
def __init__(agent)
Initialize the class.
Arguments:
agent- agent object
Returns:
None
GracefulAgentDaemon Objects
class GracefulAgentDaemon(_AgentRun, GracefulDaemon)
Class that manages graceful agent daemonization.
__init__
def __init__(agent, timeout=30)
Initialize the class.
Arguments:
agent- agent objecttimeout- agent timeout
Returns:
None
AgentCLI Objects
class AgentCLI()
Class that manages the agent CLI.
Arguments:
None
Returns:
None
__init__
def __init__(graceful=False)
Initialize the class.
Arguments:
graceful- True if graceful restart is required
Returns:
None
process
def process(additional_help=None)
Return all the CLI options.
Arguments:
additional_help- CLI additional help string for argparse
Returns:
args- Namespace() containing all of our CLI arguments as objects- filename: Path to the configuration file
control
def control(agent, timeout=60)
Control the agent from the CLI.
Arguments:
agent- Agent objecttimeout- Agent timeout
Returns:
None
AgentAPI Objects
class AgentAPI(Agent)
Applcication API agent that serves web pages.
Arguments:
None
Returns:
None
__init__
def __init__(parent, child, app, config=None)
Initialize the class.
Arguments:
parent- Name of parent daemonchild- Name of child daemonapp- Flask Appconfig- ConfigCore object
Returns:
None
query
def query()
Query all remote targets for data.
Arguments:
None
Returns:
None
_StandaloneApplication Objects
class _StandaloneApplication(BaseApplication)
Class to integrate the Gunicorn WSGI with the Flask application.
Modified from: http://docs.gunicorn.org/en/latest/custom.html
__init__
def __init__(app, parent, options=None)
Initialize the class.
Arguments:
app- Flask application object of type Flask(name)parent- Name of parent process that is invoking the APIoptions- Gunicorn CLI options
Returns:
None
load_config
def load_config()
Load the configuration.
Arguments:
None
Returns:
None
load
def load()
Run the Flask application throught the Gunicorn WSGI.
Arguments:
None
Returns:
self.application- Flask application object
configuration
switchmap classes that manage various configurations.
_Config Objects
class _Config()
Class gathers all configuration information.
__init__
def __init__()
Intialize the class.
Arguments:
None
Returns:
None
ConfigCore Objects
class ConfigCore(_Config)
Class gathers all configuration information.
__init__
def __init__()
Intialize the class.
Arguments:
None
Returns:
None
agent_subprocesses
def agent_subprocesses()
Get agent_subprocesses.
Arguments:
None
Returns:
result- result
api_log_file
def api_log_file(daemon)
Get api_log_file.
Arguments:
daemon- Name of API daemon
Returns:
result- result