-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample.php
More file actions
37 lines (27 loc) · 767 Bytes
/
Copy pathsample.php
File metadata and controls
37 lines (27 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
require 'vendor/autoload.php';
use Signiant\VictorOps\Notifier;
use Signiant\VictorOps\Messages\CustomMessage;
$routingKey = 'mykey';
$REST_URL= 'my VO REST URL';
$VictorOpsConfig = ['routing_key' => $routingKey, 'endpoint_url' => $REST_URL];
$VOendpointOK = true;
try
{
$voEndpoint = new Notifier($VictorOpsConfig);
} catch (MissingEndpointURLException $e)
{
echo "caught exception: . " . $e->getMessage() . "\n";
$VOendpointOK = false;
}
if ($VOendpointOK)
{
// Setup the message. Only the level is mandatory
$msgLevel = "INFO";
$voMsg = new CustomMessage($msgLevel);
$voMsg->stateMessage('The answer is 42');
$voMsg->entityId('system123');
$voMsg->entityDisplayName('HAL 9000');
$voEndpoint->send($voMsg);
}
?>