saberx.sabercore.triggers package¶
Submodules¶
saberx.sabercore.triggers.cpuhandler module¶
-
class
saberx.sabercore.triggers.cpuhandler.CPUHandler[source]¶ Bases:
objectClass for evaluatingcputrigger params
-
static
check_loadavg(**kwargs)[source]¶ Method to check loadaverage
This method evaluates the trigger param and descied whether the trigger is fired or not.
Parameters: kwargs (object) – Object containing thresholds and operation Returns: status of the trigger and error string if any Return type: bool, string
-
static
saberx.sabercore.triggers.cputrigger module¶
-
class
saberx.sabercore.triggers.cputrigger.CPUTrigger(**kwargs)[source]¶ Bases:
saberx.sabercore.triggers.triggerbase.TriggerBaseClass for creating CPU trigger
saberx.sabercore.triggers.filehandler module¶
-
class
saberx.sabercore.triggers.filehandler.FileHandler[source]¶ Bases:
object** Class containing file handling methods **
-
static
is_empty(path)[source]¶ Method for checking if given file is empty
Parameters: path (string) – path to the file resource Returns: status, error if any Return type: bool, string
-
static
is_present(path)[source]¶ Method for checking if the given file exists
This method checks whether the given path is valid or not.
Parameters: path (string) – path to the file resource Returns: status, error if any Return type: bool, string
-
static
read_from_head(path, regex, limit)[source]¶ Method to read a file from head and see if pattern exists
This method reads a given file and checks if the given pattern exists in the top ‘n’ lines where n is given as ‘limits’.
Parameters: - path (string) – path to the file resource
- regex (string) – string representing the pattern to search for
- limit (Integer) – Number of lines to query
Returns: status , error
Return type: bool, string
-
static
read_from_tail(path, regex, lines)[source]¶ Method to read a file from end and see if pattern exists
This method reads a given file and checks if the given pattern exists in the last ‘n’ lines where n is given as ‘lines’.
Parameters: - path (string) – path to the file resource
- regex (string) – string representing the pattern to search for
- limit (Integer) – Number of lines to query
Returns: status , error
Return type: bool, string
-
static
saberx.sabercore.triggers.filetrigger module¶
-
class
saberx.sabercore.triggers.filetrigger.FileTrigger(**kwargs)[source]¶ Bases:
saberx.sabercore.triggers.triggerbase.TriggerBaseClass for creating file trigger
saberx.sabercore.triggers.memoryhandler module¶
-
class
saberx.sabercore.triggers.memoryhandler.MemoryHandler[source]¶ Bases:
objectClass for handling memory trigger operation
-
static
check_mem(**kwargs)[source]¶ Method to perform the memory operation
This method accpets the trigger attributes, performs the specified operation and returns the trigger status.
Parameters: kwargs (dict) – Contains all check attributes Returns: trigger status - fire or not Return type: bool
-
static
get_mem_type(check)[source]¶ Method for getting metric type from trigger check
This method accepts the check type and returns the desired method to get the value of the metric specified in type.
Parameters: check (string) – Type of check : virtial | swap Returns: psutl method to get virtual or swap memory values. Return type: psutil method
-
static
saberx.sabercore.triggers.memorytrigger module¶
-
class
saberx.sabercore.triggers.memorytrigger.MemoryTrigger(**kwargs)[source]¶ Bases:
saberx.sabercore.triggers.triggerbase.TriggerBaseClass for creating memory trigger
saberx.sabercore.triggers.processhandler module¶
-
class
saberx.sabercore.triggers.processhandler.ProcessHandler[source]¶ Bases:
object**Class for performing process trigger operation
-
static
check_cmdline(regex)[source]¶ Method for checking if a process exists by cmdline text
This method checks if there is any process whose cmdline arg matches the given pattern
Parameters: regex (string) – String containing regex Returns: status, count, error if any Return type: bool, Integer, String
-
static
check_cmdline_count(regex, count, operator)[source]¶ Method to get the Number of regex filtered processes by cmd and perform the deired operation
Parameters: - regex (string) – Regex to filter processes
- count (string) – Threshold
- operation (string) – Desired operation
Returns: Result, error if any
Return type: bool, string
-
static
check_name(regex)[source]¶ Method for checking if a process exists by name
This method checks if there is any process whose name matches the given pattern
Parameters: regex (string) – String containing regex Returns: status, count, error if any Return type: bool, Integer, String
-
static
check_name_count(regex, count, operator)[source]¶ Method to get the Number of regex filtered processes and perform the deired operation
Parameters: - regex (string) – Regex to filter processes
- count (string) – Threshold
- operation (string) – Desired operation
Returns: Result, error if any
Return type: bool, string
-
static
get_cmdline_count(regex)[source]¶ Method for getting count of process
This method returns the count of processes whose cmdline matches the given regex
Parameters: regex (string) – String containing regex for filtering process cmdline Returns: status, count, error if any Return type: bool, Integer, String
-
static
get_name_count(regex)[source]¶ Method for getting count of process
This method returns the count of processes whose name matches the given regex
Parameters: regex (string) – String containing regex for filtering process names Returns: status, count, error if any Return type: bool, Integer, String
-
static
saberx.sabercore.triggers.processtrigger module¶
-
class
saberx.sabercore.triggers.processtrigger.ProcessTrigger(**kwargs)[source]¶ Bases:
saberx.sabercore.triggers.triggerbase.TriggerBaseClass for creating process trigger
saberx.sabercore.triggers.tcphandler module¶
-
class
saberx.sabercore.triggers.tcphandler.TCPHandler[source]¶ Bases:
objectClass containing TCP handler methods
-
static
check_connection(**kwargs)[source]¶ Method to evaluate the TCP trigger
This method evaulates the TCP trigger. Calls the desired methods to check tcp (normal or ssl) to a host.
Parameters: kwargs (dict) – dict containing host, port, ssl, timeout, attempts, threshold, check_type Returns: status, error if any Return type: bool, error
-
static
saberx.sabercore.triggers.tcptrigger module¶
-
class
saberx.sabercore.triggers.tcptrigger.TCPTrigger(**kwargs)[source]¶ Bases:
saberx.sabercore.triggers.triggerbase.TriggerBaseMethod for initialing memory trigger