Table of Contents
- 📦 Class \notificationhandler
- 🔶 Properties
-
🔷 Methods
- 🔹 public __construct()
- 🔹 public deleteApp()
- 🔹 public getAppLastResult()
- 🔹 public getAppNotificationdata()
- 🔹 public getAppResult()
- 🔹 public getLogdata()
- 🔹 public getMessageReplacements()
- 🔹 public getPlugins()
- 🔹 public getReplacedMessage()
- 🔹 public isSleeptime()
- 🔹 public loadLogdata()
- 🔹 public notify()
- 🔹 public setApp()
📦 Class \notificationhandler
/**
* ____________________________________________________________________________
*
* _____ _____ __ _____ _ _
* | | | | ___ ___ ___| |___ ___|_| |_ ___ ___
* |- -| | | | |__ | .'| . | . | | | | . | | | _| . | _|
* |_____|_|_|_|_____| |__,| _| _|_|_|_|___|_|_|_|_| |___|_|
* |_| |_|
*
* ___ ___ ___ _ _ ___ ___
* |_ -| -_| _| | | -_| _|
* |___|___|_| \_/|___|_|
*
* ____________________________________________________________________________
*
* notificationhandler
*
* @author hahn
*
* 2024-07-17 axel.hahn@unibe.ch php 8 only: use typed variables
* 2024-11-06 axel.hahn@unibe.ch update html email output
*/
🔶 Properties
(none)
🔷 Methods
🔹 public __construct()
init
Return: boolean *
Parameters: 1
Parameter | Type | Description |
---|---|---|
<optional> array $aOptions = [] | array |
options array with the keys - {string} lang language of the GUI - {string} serverurl base url of the web app to build an url to an app specific page - {string} notifications appmionitor config settings in notification settings (for sleeptime and messages) |
🔹 public deleteApp()
Delete application: this method triggers deletion of its notification data and last result cache.
Return: bool
Parameters: 1
Parameter | Type | Description |
---|---|---|
<required> string $sAppId | string |
app id |
🔹 public getAppLastResult()
Get 2nd last resultset of an application
Return: array *
Parameters: 0
🔹 public getAppNotificationdata()
Get array with notification data of an app taken from check result meta -> notifications merged with server config
Return: array
Parameters: 1
Parameter | Type | Description |
---|---|---|
<optional> string $sType = ‘’ | string |
optional: type email |
🔹 public getAppResult()
Get current result from cache using a shared cache object with appmonitor-server class
Return: array
Parameters: 0
🔹 public getLogdata()
Get current log data and filter them
Return: array
Parameters: 3
Parameter | Type | Description |
---|---|---|
<optional> array $aFilter = [] | array |
filter with possible keys timestamp |
<optional> int $iLimit = 0 | int |
set a maximum of log entries |
<optional> bool $bRsort = true | bool |
flag to reverse sort logs; default is true (=newest entry first) |
🔹 public getMessageReplacements()
Helper function: get the array with all current replacements in message texts with key = placeholder and value = replacement
Return: array
Parameters: 0
🔹 public getPlugins()
Get an array with notification plugins It is a list of basenames in the plugin directory server/plugins/notification/.php Additionally its functions will be included to be used in sendAllNotifications
Return: array
Parameters: 0
🔹 public getReplacedMessage()
Helper function: generate message text frem template based on type of change, its template and the values of check data
Return: string
Parameters: 1
Parameter | Type | Description |
---|---|---|
<required> $sMessageId | one * |
one of changetype-[N].logmessage |
🔹 public isSleeptime()
Check if a defined sleep time was reached. It returns false if no sleep time is defined. It returns the 1st matching regex if a match was found.
Return: string|bool
Parameters: 0
🔹 public loadLogdata()
Read all sored logdata
Return: array
Parameters: 0
🔹 public notify()
Detect if a notification is needed. It returns false if a sleep time was detected. Othwerwise it returns true.
Return: bool
Parameters: 0
🔹 public setApp()
Set application with its current check result
Return: bool
Parameters: 1
Parameter | Type | Description |
---|---|---|
<required> string $sAppId | string |
application id |
Generated with Axels PHP class doc parser.