Skip to content

profile

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

To import...

from dynamite_nsm.services.suricata import profile as suricata_profile

ProcessProfiler

__init__(self) special

Get information about the Suricata service

Source code in dynamite_nsm/services/suricata/profile.py
def __init__(self):
    """
    Get information about the Suricata service
    """
    self.env_dict = utilities.get_environment_file_dict()
    self.suricata_home = self.env_dict.get('SURICATA_HOME')
    self.suricata_config = self.env_dict.get('SURICATA_CONFIG')

    profile.BaseProcessProfiler.__init__(self,
                                         install_directory=self.suricata_home,
                                         config_directory=self.suricata_config,
                                         required_install_files=['bin', 'include', 'lib'],
                                         required_config_files=['rules'])

is_running(self)

Determine of Suricata is running

Returns:

Type Description
bool

True, if running

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