-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathhealth.php
More file actions
37 lines (31 loc) · 1.19 KB
/
Copy pathhealth.php
File metadata and controls
37 lines (31 loc) · 1.19 KB
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
37
<?php
/**
* Health check for the cluster, please enter your cluster urls.
* I a domain of the last poll-message was not found on any servers, the result will be 404 - message.
* This script can be added to a monitoring tool. It shouldn't be run too often. Daily or hourly should be good.
* Also a threshold can be used in the monitoring tool, like Alert when 5 attempts.
*/
use ascio\Tools as Tools;
use ascio\v2\domains\Request as Request;
require_once(realpath(dirname(__FILE__))."/../../../init.php");
require_once realpath(dirname(__FILE__))."/../../../includes/registrarfunctions.php";
require_once(realpath(dirname(__FILE__))."/lib/Request.php");
$cfg = getRegistrarConfigOptions("ascio");
$request = new Request($cfg);
$pollResult = $request->poll();
if($pollResult->item) {
$orderId = $pollResult->item->OrderId;
} else {
echo "OK\n";
return;
}
$order = $request->getOrder($orderId);
$order->order->TransactionComment = null;
$domainId = Tools::getDomainIdFromOrder($order->order);
if($domainId) {
echo "OK\n";
} else {
$error = "Domain ".$pollResult->item->DomainName. " not found in the WHMCS-Database";
header("HTTP/1.0 404 ".$error);
echo $error."\n";
}