Custom ZendHQ Monitoring Events
Custom Monitoring Events
Custom events are ZendHQ monitoring events that can be generated in the PHP script.
The zendhq
PHP extension implements two functions that can be used to generate custom events in the PHP script: monitor_custom_event()
and monitor_custom_event_ex()
(and the aliases zend_monitor_custom_event()
and zend_monitor_custom_event_ex()
, for compatibility with Zend Server).
monitor_custom_event
The monitor_custom_event()
function generates a monitoring event that matches a monitoring rule with the name "Custom Event". For this function to work, there must be a monitoring rule of the type "custom" with the name "Custom Event".
monitor_custom_event( string $type, string $text, mixed $userData = null, int $userSeverity = -2 ) : ?bool
type
The type argument is an arbitrary text added to the custom event, for example, class name.
text
The text argument is an arbitrary text added to the custom event, for example, a description of the event.
userData
The optional userData argument is a PHP variable, whose value is added to the custom event (see PHP values for details how PHP values are stored in JSON documents);
userSeverity
The optional userSeverity argument is the severity of the event and can have one of the following values:
Value | Severity |
---|---|
-1 | Notice |
0 | Warning |
1 | Critical |
The event severity given in the userSeverity argument overwrites the severity value specified in the monitoring rule. If an invalid value, such as -2, is given, then the severity from the monitoring rule of the type "custom" with the name "Custom Event" is used.
monitor_custom_event_ex
The monitor_custom_event_ex()
function is similar to the monitor_custom_event()
, but it allows specifying the name of the monitoring rule. For this function to work, there must be a monitoring rule of the type "custom" with the specified name.
monitor_custom_event_ex( string $type, string $text, string $ruleName, mixed $userData = null ) : ?bool
type
The type argument is an arbitrary text added to the custom event, for example, class name.
text
The text argument is an arbitrary text added to the custom event, for example, a description of the event.
ruleName
The ruleName argument specifies the name of the monitoring rule.
userData
The optional userData argument is a PHP variable, whose value is added to the custom event (see PHP values for details how PHP values are stored in JSON documents);