1
|
|
|
<?php |
2
|
|
|
// |
3
|
|
|
// This code and all components (c) Copyright 2006 - 2018, Wowza Media Systems, LLC. All rights reserved. |
4
|
|
|
// This code is licensed pursuant to the Wowza Public License version 1.0, available at www.wowza.com/legal. |
5
|
|
|
// |
6
|
|
|
|
7
|
|
|
namespace Com\Wowza; |
8
|
|
|
|
9
|
|
|
use Com\Wowza\Entities\Application\Helpers\Settings; |
10
|
|
|
|
11
|
|
|
class Statistics extends Wowza |
12
|
|
|
{ |
13
|
|
|
public function __construct(Settings $settings) |
14
|
|
|
{ |
15
|
|
|
parent::__construct($settings); |
16
|
|
|
} |
17
|
|
|
|
18
|
|
|
public function getApplicationStatistics(Application $application) |
19
|
|
|
{ |
20
|
|
|
$this->restURI = $application->getRestURI() . '/monitoring/current'; |
21
|
|
|
|
22
|
|
|
return $this->sendRequest($this->preparePropertiesForRequest(self::class), [], self::VERB_GET); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
public function getApplicationStatisticsHistory(Application $application) |
26
|
|
|
{ |
27
|
|
|
$this->restURI = $application->getRestURI() . '/monitoring/historic'; |
28
|
|
|
|
29
|
|
|
return $this->sendRequest($this->preparePropertiesForRequest(self::class), [], self::VERB_GET); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function getIncomingApplicationStatistics(Application $application, $streamName, $appInstance = '_definst_') |
33
|
|
|
{ |
34
|
|
|
$this->restURI = $application->getRestURI() . "/instances/{$appInstance}/incomingstreams/{$streamName}/monitoring/current"; |
35
|
|
|
|
36
|
|
|
return $this->sendRequest($this->preparePropertiesForRequest(self::class), [], self::VERB_GET); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function getServerStatistics(Server $server) |
40
|
|
|
{ |
41
|
|
|
$this->restURI = $server->getRestURI() . '/monitoring/historic'; |
42
|
|
|
|
43
|
|
|
return $this->sendRequest($this->preparePropertiesForRequest(self::class), [], self::VERB_GET); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Get current host hardware stats |
48
|
|
|
* |
49
|
|
|
* @param \Com\Wowza\Server $server Server instance |
50
|
|
|
* |
51
|
|
|
* @return false|mixed[] |
52
|
|
|
*/ |
53
|
|
|
public function getServerStatisticsCurrent(Server $server) |
54
|
|
|
{ |
55
|
|
|
$restURI = explode('/servers/', $server->getRestURI()); |
56
|
|
|
$this->restURI = $restURI[0] . '/machine/monitoring/current'; |
57
|
|
|
|
58
|
|
|
return $this->sendRequest($this->preparePropertiesForRequest(self::class), [], self::VERB_GET); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|