Example #1
0
def log_started(event):
    """
    Log system started event
    """
    InteractionLog(timestamp=event.timestamp,
                   expire=event.timestamp +
                   datetime.timedelta(seconds=TTL_REBOOT),
                   object=event.managed_object.id,
                   user=None,
                   op=InteractionLog.OP_STARTED,
                   text="System started").save()
Example #2
0
def log_reboot(event):
    """
    Log reboot event
    """
    InteractionLog(timestamp=event.timestamp,
                   expire=event.timestamp +
                   datetime.timedelta(seconds=TTL_REBOOT),
                   object=event.managed_object.id,
                   user=event.vars.get("user"),
                   op=InteractionLog.OP_REBOOT,
                   text="System rebooted").save()
Example #3
0
def log_logout(event):
    """
    Log logout event
    """
    InteractionLog(timestamp=event.timestamp,
                   expire=event.timestamp +
                   datetime.timedelta(seconds=TTL_LOGIN),
                   object=event.managed_object.id,
                   user=event.vars.get("user"),
                   op=InteractionLog.OP_LOGOUT,
                   text="User logged out").save()
Example #4
0
def log_cmd(event):
    """
    Log CLI command
    """
    InteractionLog(timestamp=event.timestamp,
                   expire=event.timestamp +
                   datetime.timedelta(seconds=TTL_COMMAND),
                   object=event.managed_object.id,
                   user=event.vars.get("user"),
                   op=InteractionLog.OP_COMMAND,
                   text=event.vars.get("command")).save()
Example #5
0
def log_config_changed(event):
    """
    Log config changed event
    """
    InteractionLog(timestamp=event.timestamp,
                   expire=event.timestamp +
                   datetime.timedelta(seconds=TTL_CONFIG),
                   object=event.managed_object.id,
                   user=event.vars.get("user"),
                   op=InteractionLog.OP_CONFIG_CHANGED,
                   text="Config changed").save()
Example #6
0
def log_halted(event):
    """
    Log system halted event
    """
    InteractionLog(
        timestamp=event.timestamp,
        expire=event.timestamp + datetime.timedelta(seconds=TTL_REBOOT),
        object=event.managed_object.id,
        user=event.vars.get("user"),
        op=InteractionLog.OP_HALTED,
        text="System halted",
    ).save()