Skip to content

profile

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

To import...

from dynamite_nsm.services.filebeat import profile as filebeat_profile

ProcessProfiler

__init__(self) special

Get information about the Filebeat service

Source code in dynamite_nsm/services/filebeat/profile.py
def __init__(self):
    """
    Get information about the Filebeat service
    """
    self.env_file = os.path.join(const.CONFIG_PATH, 'environment')
    self.env_dict = utilities.get_environment_file_dict()
    self.filebeat_home = self.env_dict.get('FILEBEAT_HOME')

    profile.BaseProcessProfiler.__init__(self,
                                         install_directory=self.filebeat_home,
                                         config_directory=self.filebeat_home,
                                         required_install_files=['filebeat', 'filebeat.yml']
                                         )

is_running(self)

Determine of Filebeat is running

Returns:

Type Description
bool

True, if running

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