GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ApacheMonitoring::getUnit()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
namespace CloudWatchScript\Plugins;
3
4
use CloudWatchScript\AbstractMonitoring;
5
6
/**
7
 * Check Solr using ping URL.
8
 * Add and configure the folliwong lines to the config file
9
 * "Apache" : {
10
 *         "name" : "Name of metric and alarm",
11
 *         "maxProcess": 100,
12
 *         "namespace": "Metric/Namespace",
13
 *         "description": "Description"
14
 * }
15
 */
16
class ApacheMonitoring extends AbstractMonitoring
17
{
18
    private $maxApacheProcess;
19
20
    /**
21
     * @param array $config
22
     * @param String $name
23
     */
24
    public function __construct($config, $name)
25
    {
26
        parent::__construct($config, $name);
27
        $this->maxApacheProcess = $this->config->maxProcess;
28
    }
29
30
    /**
31
     * @return integer Number of apache processus
32
     */
33
    public function getMetric()
34
    {
35
        exec('ps aux | grep apache', $output);
36
        return count($output);
37
38
    }
39
    /**
40
     * @return string "None"
41
     */
42
    public function getUnit()
43
    {
44
        return "None";
45
    }
46
47
    /**
48
     * @return array Alarm min and max for number of apache process
49
     */
50
    public function getAlarms()
51
    {
52
        return array(
53
                array("ComparisonOperator" => "LessThanOrEqualToThreshold",
54
                        "Threshold" => 0,
55
                        "Name" => $this->name . " shutdown"),
56
                array("ComparisonOperator" => "GreaterThanThreshold",
57
                        "Threshold" => $this->maxApacheProcess,
58
                        "Name" => $this->name . " max process")
59
        );
60
    }
61
}
62