1 | <?php |
||
10 | class Alert |
||
11 | { |
||
12 | const UNDER_USED = 'under_used'; |
||
13 | const OVER_USED = 'over_used'; |
||
14 | |||
15 | protected $type; |
||
16 | protected $commandName; |
||
17 | protected $commandInput; |
||
18 | protected $cpuUsage; |
||
19 | protected $loadAverage; |
||
20 | protected $runningProcesses; |
||
21 | protected $leftOver = 0; |
||
22 | |||
23 | /** |
||
24 | * Set the alert type to under used |
||
25 | * |
||
26 | * @return Alert self |
||
27 | */ |
||
28 | 21 | public function setUnderUsed() |
|
34 | |||
35 | /** |
||
36 | * Check if the alert is of under used type |
||
37 | * |
||
38 | * @return bool |
||
39 | */ |
||
40 | 30 | public function isUnderUsed() |
|
44 | |||
45 | /** |
||
46 | * Set the alert type to over used |
||
47 | * |
||
48 | * @return Alert self |
||
49 | */ |
||
50 | 18 | public function setOverUsed() |
|
56 | |||
57 | /** |
||
58 | * Check if the alert is of over used type |
||
59 | * |
||
60 | * @return bool |
||
61 | */ |
||
62 | 33 | public function isOverUsed() |
|
66 | |||
67 | /** |
||
68 | * Return the alert type as string |
||
69 | * |
||
70 | * @return string |
||
71 | */ |
||
72 | 21 | public function getType() |
|
76 | |||
77 | /** |
||
78 | * Set the command name |
||
79 | * |
||
80 | * @param string $name |
||
81 | * |
||
82 | * @return Alert self |
||
83 | */ |
||
84 | 45 | public function setCommandName($name) |
|
90 | |||
91 | /** |
||
92 | * Return the command name |
||
93 | * |
||
94 | * @return string |
||
95 | */ |
||
96 | 21 | public function getCommandName() |
|
100 | |||
101 | /** |
||
102 | * Set the command input |
||
103 | * |
||
104 | * @param InputInterface $input |
||
105 | * |
||
106 | * @return Alert self |
||
107 | */ |
||
108 | 45 | public function setCommandInput(InputInterface $input) |
|
114 | |||
115 | /** |
||
116 | * Return the command input |
||
117 | * |
||
118 | * @return InputInterface |
||
119 | */ |
||
120 | 36 | public function getCommandInput() |
|
124 | |||
125 | /** |
||
126 | * Set the server CPU usage at provision time |
||
127 | * |
||
128 | * @param float $usage |
||
129 | * |
||
130 | * @return Alert self |
||
131 | */ |
||
132 | 45 | public function setCpuUsage($usage) |
|
138 | |||
139 | /** |
||
140 | * Return the CPU usage |
||
141 | * |
||
142 | * @return float |
||
143 | */ |
||
144 | 36 | public function getCpuUsage() |
|
148 | |||
149 | /** |
||
150 | * Set the server load average at provision time |
||
151 | * |
||
152 | * @param float $load |
||
153 | * |
||
154 | * @return Alert self |
||
155 | */ |
||
156 | 45 | public function setLoadAverage($load) |
|
162 | |||
163 | /** |
||
164 | * Return the load average |
||
165 | * |
||
166 | * @return float |
||
167 | */ |
||
168 | 36 | public function getLoadAverage() |
|
172 | |||
173 | /** |
||
174 | * Set the number of already running processes of the command |
||
175 | * being provisioned |
||
176 | * |
||
177 | * @param int $count |
||
178 | * |
||
179 | * @return Alert self |
||
180 | */ |
||
181 | 33 | public function setRunningProcesses($count) |
|
187 | |||
188 | /** |
||
189 | * Return the number of processes running for the associated command |
||
190 | * |
||
191 | * @return int |
||
192 | */ |
||
193 | 27 | public function getRunningProcesses() |
|
197 | |||
198 | /** |
||
199 | * Set the number of processes that couldn't be launched |
||
200 | * |
||
201 | * @param int $leftOver |
||
202 | * |
||
203 | * @return Alert self |
||
204 | */ |
||
205 | 45 | public function setLeftOver($leftOver) |
|
211 | |||
212 | /** |
||
213 | * Return the number of processes that couldn't be launched |
||
214 | * |
||
215 | * @return int |
||
216 | */ |
||
217 | 27 | public function getLeftOver() |
|
221 | } |
||
222 |