\WatchDog
Flexible system monitoring aka WatchDog implementation
Synopsis
class WatchDog
{
- // constants
- const PARAM_EX = 'NO_REQUIRED_TASK_PARAM_';
- const PARAMFMT_EX = 'WRONG_FORMAT_TASK_PARAM_';
- const SETTINGS_EX = 'NO_SETTINGS_LOADED';
- const PID_NAME = 'WATCHDOG';
- // members
- protected array $taskData = ;
- protected array $oldResults = ;
- protected array $curResults = ;
- protected array $settings = ;
- protected $sms = '';
- protected $email = '';
- protected $onePunch = '';
- protected $telegram = '';
- protected $processMgr = '';
- // methods
- public void __construct()
- public array getSettings()
- protected void loadOldResults()
- protected void loadTasks()
- protected void loadSettings()
- protected void initSMS()
- protected void initEmail()
- protected void initOnePunch()
- protected void initTelegram()
- protected void initStarDust()
- public array sendSMS()
- protected void sendEmail()
- protected string safeEscapeString()
- protected void setOldValue()
- protected void setCurValue()
- protected mixed doAction()
- protected string getOldValue()
- protected string checkCondition()
- public void processTask()
Constants
Name | Value |
---|---|
PARAM_EX | 'NO_REQUIRED_TASK_PARAM_' |
PARAMFMT_EX | 'WRONG_FORMAT_TASK_PARAM_' |
SETTINGS_EX | 'NO_SETTINGS_LOADED' |
PID_NAME | 'WATCHDOG' |
Members
protected
- $curResults
—
array
Contains current watchdog run tasks results - $email
—
System Email object placeholder - $oldResults
—
array
Contains old results returned by watchdog tasks - $onePunch
—
One-Punch object placeholder - $processMgr
—
Contains stardust process manager instance - $settings
—
array
Contains watchdog configuration as key=>value - $sms
—
System SMS object placeholder - $taskData
—
array
Contains watchdog tasks data - $telegram
—
System Telegram object placeholder
Methods
protected
- checkCondition() — Checks condition for selected task
- doAction() — Execute some action for task
- getOldValue() — gets oldresult from some task id
- initEmail() — Inits system email queue object
- initOnePunch() — Inits onepunch object
- initSMS() — Inits system SMS queue object
- initStarDust() — Inits process manager
- initTelegram() — Inits system telegram messages queue object
- loadOldResults() — Loads all previous tasks execution results into private property oldResults
- loadSettings() — Gets watchdog settings from database and load it into settings property
- loadTasks() — Loads an active task list from database and pushes it into private property taskData
- safeEscapeString() — ugly hack to dirty input data filtering with multiple DB links
- sendEmail() — sends email notification
- setCurValue() — Updates current run task results
- setOldValue() — Updates previous poll data in database
public
- __construct()
- getSettings() — Returns current watchdog settings
- processTask() — Main task processing subroutine
- sendSMS() — stores sms for deffered sending via senddog