glpi / Vigilo / VigiloTestSoftware.php @ a5c9df40
History | View | Annotate | Download (3.44 KB)
1 |
<?php
|
---|---|
2 |
|
3 |
include 'VigiloSoftwareList.php'; |
4 |
|
5 |
class VigiloTestSoftware |
6 |
{ |
7 |
protected $testTable; |
8 |
protected $softwareBase; |
9 |
protected $computer; |
10 |
protected $addedTests; |
11 |
|
12 |
public function __construct($computer) |
13 |
{ |
14 |
$this->computer=$computer; |
15 |
$this->softwareBase = getSoftwareList($this->computer); |
16 |
$this->testTable=array(); |
17 |
$this->addedTests=array(); |
18 |
} |
19 |
|
20 |
public function getTable() |
21 |
{ |
22 |
return $this->testTable; |
23 |
} |
24 |
|
25 |
public function addRelevantTestWith($softwareName) |
26 |
{ |
27 |
$functionArray=$this->softwareBase[$softwareName]; |
28 |
$this->testTable[]=call_user_func_array(array($this,$functionArray[0]), $functionArray[1]); |
29 |
} |
30 |
|
31 |
protected function addNTPTest() |
32 |
{ |
33 |
//TODO : set up arguments
|
34 |
$args=array(); |
35 |
//$address=0;
|
36 |
//$args[]=new VigiloArg('address',$address);
|
37 |
$args[]=new VigiloArg('crit', 0); |
38 |
$args[]=new VigiloArg('warn', 0); |
39 |
return new VigiloTest('NTP', $args); |
40 |
} |
41 |
|
42 |
protected function addNTPqTest() |
43 |
{ |
44 |
//TODO: set up arguments
|
45 |
$args=array(); |
46 |
$args[]=new VigiloArg('crit', 0); |
47 |
$args[]=new VigiloArg('warn', 0); |
48 |
return new VigiloTest('NTPq', $args); |
49 |
} |
50 |
|
51 |
protected function addNTPSyncTest() |
52 |
{ |
53 |
return new VigiloTest('NTPSync'); |
54 |
} |
55 |
|
56 |
protected function addHTTPTest() |
57 |
{ |
58 |
return new VigiloTest('HTTP'); |
59 |
} |
60 |
|
61 |
protected function addMemcachedTest($computer) |
62 |
{ |
63 |
$args=array(); |
64 |
$args[]=new VigiloArg('port', 11211);//TODO: set up arguments |
65 |
return new VigiloTest('Memcached', $args); |
66 |
} |
67 |
|
68 |
protected function addNagiosTest() |
69 |
{ |
70 |
return new VigiloTest('Nagios'); |
71 |
} |
72 |
|
73 |
protected function addPGSQLTest($computer) |
74 |
{ |
75 |
//TODO: set up arguments
|
76 |
//$args=array();
|
77 |
//$args[]=new VigiloArg('database',NULL);
|
78 |
//$args[]=new VigiloArg('port',NULL);
|
79 |
//$args[]=new VigiloArg('user',NULL);
|
80 |
//return new VigiloTest('PostgreSQLConnection',$args);
|
81 |
} |
82 |
|
83 |
protected function addProxyTest() |
84 |
{ |
85 |
//TODO: set up arguments
|
86 |
//$args=array();
|
87 |
/*$args[]=new VigiloArg('auth',NULL);
|
88 |
$args[]=new VigiloArg('port',NULL);
|
89 |
$args[]=new VigiloArg('url',NULL);*/
|
90 |
//return new VigiloTest('Proxy',$args);
|
91 |
} |
92 |
|
93 |
protected function addRRDcachedTest($computer) |
94 |
{ |
95 |
//TODO: set up arguments
|
96 |
//$path=
|
97 |
//$args=array();
|
98 |
//$args[]=new VigiloArg('crit',0);
|
99 |
//$args[]=new VigiloArg('path',$path);
|
100 |
//$args[]=new VigiloArg('warn',0);
|
101 |
//return new VigiloTest('RRDcached',$args);
|
102 |
} |
103 |
|
104 |
protected function addSSHTest() |
105 |
{ |
106 |
return new VigiloTest('SSH'); |
107 |
} |
108 |
|
109 |
protected function addVigiloConnectorTest($type) |
110 |
{ |
111 |
$args=array(); |
112 |
$args[]=new VigiloArg('type', $type); |
113 |
return new VigiloTest('VigiloConnector', $args); |
114 |
} |
115 |
|
116 |
protected function addVigiloCorrelatorTest() |
117 |
{ |
118 |
//TODO :set up arguments
|
119 |
//$args=array();
|
120 |
//$args[]=new VigiloArg('rules',NULL);
|
121 |
//$args[]=new VigiloArg('servicename',NULL);
|
122 |
//return new VigiloTest('VigiloCorrelator',$args);
|
123 |
} |
124 |
|
125 |
protected function TestService($computer) |
126 |
{ |
127 |
//TODO: set up arguments
|
128 |
//$args=array();
|
129 |
//$args[]=new VigiloArg('svcname',NULL);
|
130 |
//return new VigiloTest('Service',$args);
|
131 |
} |
132 |
|
133 |
public function __toString() |
134 |
{ |
135 |
return $this->child; |
136 |
} |
137 |
} |