Skip to content

profile

Profile Zeek processes to ensure they are running and installed properly.

To import...

from dynamite_nsm.services.zeek import profile as zeek_profile

ProcessProfiler

__init__(self) special

Get information about the Zeek service

Source code in dynamite_nsm/services/zeek/profile.py
def __init__(self):
    """
    Get information about the Zeek service
    """
    self.env_dict = utilities.get_environment_file_dict()
    self.zeek_home = self.env_dict.get('ZEEK_HOME')
    self.zeek_scripts = self.env_dict.get('ZEEK_SCRIPTS')

    profile.BaseProcessProfiler.__init__(self,
                                         install_directory=self.zeek_home,
                                         config_directory=self.zeek_scripts,
                                         required_install_files=['bin', 'etc'],
                                         required_config_files=['site'])

is_attached_to_network(self)

Determine if Zeek is bound to one or more network interfaces

Returns:

Type Description
bool

True, if attached to one or more network interfaces

Source code in dynamite_nsm/services/zeek/profile.py
def is_attached_to_network(self) -> bool:
    """Determine if Zeek is bound to one or more network interfaces
    Returns:
        True, if attached to one or more network interfaces

    """
    return any(self.get_attached_interfaces())

is_running(self)

Determine of Zeek is running

Returns:

Type Description
bool

True, if running

Source code in dynamite_nsm/services/zeek/profile.py
def is_running(self) -> bool:
    """
    Determine of Zeek is running
    Returns:
        True, if running
    """
    if self.zeek_home:
        try:
            return zeek_process.ProcessManager().status()['running']
        except KeyError:
            return zeek_process.ProcessManager().status()['RUNNING']
    return False