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.