Passed
Push — master ( f4c14e...6af608 )
by Patrick
02:05
created

HandlerController::indexAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 13
rs 10
1
<?php
2
3
namespace Icinga\Module\TrapDirector\Controllers;
4
5
use Icinga\Web\Url;
6
7
use Exception;
8
9
use Icinga\Module\Trapdirector\TrapsController;
10
11
12
//use Icinga\Web\Form as Form;
13
/** Rules management
14
15
*/
16
class HandlerController extends TrapsController
17
{
18
19
	/** index : list existing rules 
20
	*/
21
	public function indexAction()
22
	{	
23
		$this->checkReadPermission();
24
		$this->prepareTabs()->activate('status');
25
26
		$db = $this->getDb();
27
		$this->getHandlerListTable()->setConnection($db);
28
		$this->getHandlerListTable()->setMibloader($this->getMIB());
29
		// Apply pagination limits 
30
		$this->view->table=$this->applyPaginationLimits($this->getHandlerListTable(),$this->getModuleConfig()->itemListDisplay());		
31
		
32
		// Set Filter
33
		$this->view->filterEditor = $this->getHandlerListTable()->getFilterEditor($this->getRequest());		
34
	
35
		//$this->displayExitError('Handler/indexAction','Not implemented');
36
	}
37
38
	/** test_rule : test a rule
39
	 */
40
	public function testruleAction()
41
	{
42
	    $this->checkReadPermission();
43
	    $this->getTabs()->add('get',array(
44
	        'active'	=> true,
45
	        'label'		=> $this->translate('Test Rule'),
46
	        'url'		=> Url::fromRequest()
47
	    ));
48
	    
49
	    //$db = $this->getDb();
50
51
	    if ($this->params->get('rule') !== null) 
52
	    {
53
	        $this->view->rule= $this->params->get('rule');
54
	    }
55
	    else
56
	    {
57
	        $this->view->rule='';
58
	    }
59
	}
60
	
61
	/**
62
	 * Setup default veiw values for add action
63
	 */
64
	private function add_setup_vars()
65
	{
66
	    // variables to send to view
67
	    $this->view->hostlist=array(); // host list to input datalist
68
	    $this->view->hostname=''; // Host name in input text
69
	    $this->view->serviceGet=false; // Set to true to get list of service if only one host set
70
	    $this->view->serviceSet=null; // Select service in services select (must have serviceGet=true).
71
	    $this->view->mainoid=''; // Trap OID
72
	    $this->view->mib=''; // Trap mib
73
	    $this->view->name=''; // Trap name
74
	    $this->view->trapListForMIB=array(); // Trap list if mib exists for trap
75
	    $this->view->objectList=array(); // objects sent with trap
76
	    $this->view->display=''; // Initial display
77
	    $this->view->rule=''; // rule display
78
	    $this->view->revertOK=''; // revert OK in seconds
79
	    $this->view->hostid=-1; // normally set by javascript serviceGet()
80
	    $this->view->ruleid=-1; // Rule id in DB for update & delete
81
	    $this->view->setToUpdate=false; // set form as update form
82
	    $this->view->setRuleMatch=-1; // set action on rule match (default nothing)
83
	    $this->view->setRuleNoMatch=-1; // set action on rule no match (default nothing)
84
	    
85
	    $this->view->selectGroup=false; // Select by group if true
86
	    $this->view->hostgroupid=-1; // host group id
87
	    $this->view->serviceGroupGet=false; // Get list of service for group (set serviceSet to select one)
88
	    
89
	    $this->view->modifier=null;
90
	    $this->view->modified=null;
91
	}
92
	
93
	/**
94
	 * Setup new handler display from existing trap
95
	 * @param integer $trapid : trap id in DB
96
	 */
97
	private function add_from_existing($trapid)
98
	{
99
	    /********** Setup from existing trap ***************/
100
	    // Get the full trap info
101
	    $trapDetail=$this->getTrapDetail($trapid);
102
	    
103
	    $hostfilter=$trapDetail->source_ip;
104
	    
105
	    // Get host
106
	    try
107
	    {
108
	        $hosts=$this->getHostByIP($hostfilter);
109
	    }
110
	    catch (Exception $e)
111
	    {
112
	        $this->displayExitError('Add handler : get host by IP/Name ',$e->getMessage());
113
	    }
114
	    
115
	    
116
	    // if one unique host found -> put id text input
117
	    if (count($hosts)==1) {
118
	        $this->view->hostname=$hosts[0]->name;
119
	        //$hostid=$hosts[0]->id;
120
	        // Tell JS to get services when page is loaded
121
	        $this->view->serviceGet=true;
122
	        
123
	    }
124
	    else
125
	    {
126
	        foreach($hosts as $key=>$val)
127
	        {
128
	            array_push($this->view->hostlist,$hosts[$key]->name);
129
	        }
130
	    }
131
	    
132
	    // set up trap oid and objects received by the trap
133
	    
134
	    $this->view->mainoid=$trapDetail->trap_oid;
135
	    if ($trapDetail->trap_name_mib != null)
136
	    {
137
	        $this->view->mib=$trapDetail->trap_name_mib;
138
	        $this->view->name=$trapDetail->trap_name;
139
	        $this->view->trapListForMIB=$this->getMIB()
140
	        ->getTrapList($trapDetail->trap_name_mib);
141
	    }
142
	    
143
	    // Get all objects that can be in trap from MIB
144
	    $allObjects=$this->getMIB()->getObjectList($trapDetail->trap_oid);
145
	    // Get all objects in current Trap
146
	    $currentTrapObjects=$this->getTrapobjects($trapid);
147
	    $oid_index=1;
148
	    foreach ($currentTrapObjects as $key => $val)
149
	    {
150
	        $currentObjectType='Unknown';
151
	        $currentObjectTypeEnum='Unknown';
152
	        if (isset($allObjects[$val->oid]['type']))
153
	        {
154
	            $currentObjectType=$allObjects[$val->oid]['type'];
155
	            $currentObjectTypeEnum=$allObjects[$val->oid]['type_enum'];
156
	        }
157
	        $currentObject=array(
158
	            $oid_index,
159
	            $val->oid,
160
	            $val->oid_name_mib,
161
	            $val->oid_name,
162
	            $val->value,
163
	            $currentObjectType,
164
	            $currentObjectTypeEnum
165
	        );
166
	        $oid_index++;
167
	        array_push($this->view->objectList,$currentObject);
168
	        // set currrent object to null in allObjects
169
	        if (isset($allObjects[$val->oid]))
170
	        {
171
	            $allObjects[$val->oid]=null;
172
	        }
173
	    }
174
	    if ($allObjects!=null) // in case trap doesn't have objects or is not resolved
175
	    {
176
	        foreach ($allObjects as $key => $val)
177
	        {
178
	            if ($val==null) { continue; }
179
	            array_push($this->view->objectList, array(
180
	                $oid_index,
181
	                $key,
182
	                $allObjects[$key]['mib'],
183
	                $allObjects[$key]['name'],
184
	                '',
185
	                $allObjects[$key]['type'],
186
	                $allObjects[$key]['type_enum']
187
	            ));
188
	            $oid_index++;
189
	        }
190
	    }
191
	    
192
	    // Add a simple display
193
	    $this->view->display='Trap '.$trapDetail->trap_name.' received';
194
	    $this->view->create_basic_rule=true;
195
	}
196
197
	/**
198
	 * Check if host & service still exists or set warning message
199
	 * @param object $ruleDetail 
200
	 */
201
	private function add_check_host_exists($ruleDetail)
202
	{
203
	    // Check if hostname still exists
204
	    $host_get=$this->getHostByName($this->view->hostname);
205
	    
206
	    if (count($host_get)==0)
207
	    {
208
	        $this->view->warning_message='Host '.$this->view->hostname. ' doesn\'t exists anymore';
209
	        $this->view->serviceGet=false;
210
	    }
211
	    else
212
	    {
213
	        // Tell JS to get services when page is loaded
214
	        $this->view->serviceGet=true;
215
	        // get service id for form to set :
216
	        $serviceID=$this->getServiceIDByName($this->view->hostname,$ruleDetail->service_name);
217
	        if (count($serviceID) ==0)
218
	        {
219
	            $this->view->warning_message=' Service '.$ruleDetail->service_name. ' doesn\'t exists anymore';
220
	        }
221
	        else
222
	        {
223
	            $this->view->serviceSet=$serviceID[0]->id;
224
	        }
225
	    }
226
	}
227
228
	/**
229
	 * Check if hostgroup & service still exists or set warning message
230
	 * @param object $ruleDetail
231
	 */
232
	private function add_check_hostgroup_exists($ruleDetail)
233
	{
234
	    // Check if groupe exists
235
	    $group_get=$this->getHostGroupByName($this->view->hostgroupname);
236
	    if (count($group_get)==0)
237
	    {
238
	        $this->view->warning_message='HostGroup '.$this->view->hostgroupname. ' doesn\'t exists anymore';
239
	        $this->view->serviceGroupGet=false;
240
	    }
241
	    else
242
	    {
243
	        $grpServices=$this->getServicesByHostGroupid($group_get[0]->id);
244
	        $foundGrpService=0;
245
	        foreach ($grpServices as $grpService)
246
	        {
247
	            if ($grpService[0] == $ruleDetail->service_name)
248
	            {
249
	                $foundGrpService=1;
250
	                $this->view->serviceSet=$ruleDetail->service_name;
251
	            }
252
	        }
253
	        
254
	        // Tell JS to get services when page is loaded
255
	        $this->view->serviceGroupGet=true;
256
	        if ($foundGrpService==0)
257
	        {
258
	            $this->view->warning_message.=' Service '.$ruleDetail->service_name. ' doesn\'t exists anymore';
259
	        }
260
	    }
261
	}
262
	
263
	/**
264
	 * Create object list array with all OIDs in rule & display
265
	 * Replace in rule & display by $<n>$
266
	 * @param string $display
267
	 * @param string $rule
268
	 * @return array
269
	 */
270
	private function add_create_trap_object_list(&$display, &$rule)
271
	{
272
	    $curObjectList=array();
273
	    $index=1;
274
	    // check in display & rule for : OID(<oid>)
275
	    $matches=array();
276
	    while ( preg_match('/_OID\(([\.0-9]+)\)/',$display,$matches) ||
277
	        preg_match('/_OID\(([\.0-9]+)\)/',$rule,$matches))
278
	    {
279
	        $curOid=$matches[1];
280
	        if (($object=$this->getMIB()->translateOID($curOid)) != null)
281
	        {
282
	            array_push($curObjectList, array(
283
	                $index,
284
	                $curOid,
285
	                $object['mib'],
286
	                $object['name'],
287
	                '',
288
	                $object['type'],
289
	                $object['type_enum']
290
	            ));
291
	        }
292
	        else
293
	        {
294
	            array_push($curObjectList, array(
295
	                $index,
296
	                $curOid,
297
	                'not found',
298
	                'not found',
299
	                '',
300
	                'not found'
301
	            ));
302
	        }
303
	        $display=preg_replace('/_OID\('.$curOid.'\)/','\$'.$index.'\$',$display);
304
	        $rule=preg_replace('/_OID\('.$curOid.'\)/','\$'.$index.'\$',$rule);
305
	        $index++;
306
	    }
307
	    return $curObjectList;
308
	}
309
	
310
	/** Add a handler  
311
	*	Get params fromid : setup from existing trap (id of trap table)
312
	*	Get param ruleid : edit from existing handler (id of rule table)
313
	*/
314
	public function addAction()
315
	{
316
		$this->checkConfigPermission();
317
		// set up tab
318
		$this->getTabs()->add('get',array(
319
			'active'	=> true,
320
			'label'		=> $this->translate('Add handler'),
321
			'url'		=> Url::fromRequest()
322
		));
323
324
		$this->add_setup_vars(); // setup default $this->view variables.
325
		
326
		// Get Mib List from DB
327
		$this->view->mibList=$this->getMIB()->getMIBList();
328
		
329
		//$this->view->trapvalues=false; // Set to true to display 'value' colum in objects
330
		
331
		if (($trapid = $this->params->get('fromid')) !== null) {
332
		    /********** Setup from existing trap ***************/
333
            $this->add_from_existing($trapid);
334
			return;
335
		}
336
		
337
		
338
		if ($this->params->get('ruleid') !== null) {
339
			/************* Rule editing ***************/
340
			$ruleid=$this->params->get('ruleid');
341
			$this->view->ruleid=$ruleid;
342
			$this->view->setToUpdate=true;
343
344
			// Get rule info from DB
345
			$ruleDetail=$this->getRuleDetail($ruleid);
346
			$this->view->hostname=$ruleDetail->host_name;
347
			$this->view->revertOK=$ruleDetail->revert_ok;
348
			$this->view->setRuleMatch=$ruleDetail->action_match;
349
			$this->view->setRuleNoMatch=$ruleDetail->action_nomatch;
350
			$this->view->hostgroupname=$ruleDetail->host_group_name;
351
			$this->view->modified=gmdate("Y-m-d\TH:i:s\Z",$ruleDetail->modified);
352
			$this->view->modifier=$ruleDetail->modifier;
353
			
354
			// Warning message if host/service don't exists anymore
355
			$this->view->warning_message='';
356
			if ($this->view->hostname != null)
357
			{
358
			    $this->view->selectGroup=false;
359
			    // Check if hostname still exists
360
			    $this->add_check_host_exists($ruleDetail);
0 ignored issues
show
Bug introduced by
$ruleDetail of type array is incompatible with the type object expected by parameter $ruleDetail of Icinga\Module\TrapDirect...add_check_host_exists(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

360
			    $this->add_check_host_exists(/** @scrutinizer ignore-type */ $ruleDetail);
Loading history...
361
			}
362
			else
363
			{
364
			    $this->view->selectGroup=true;
365
			    $this->add_check_hostgroup_exists($ruleDetail); //  Check if groupe exists				
0 ignored issues
show
Bug introduced by
$ruleDetail of type array is incompatible with the type object expected by parameter $ruleDetail of Icinga\Module\TrapDirect...heck_hostgroup_exists(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

365
			    $this->add_check_hostgroup_exists(/** @scrutinizer ignore-type */ $ruleDetail); //  Check if groupe exists				
Loading history...
366
			}
367
			
368
			$this->view->mainoid=$ruleDetail->trap_oid;
369
			$oidName=$this->getMIB()->translateOID($ruleDetail->trap_oid);
370
			if ($oidName != null)  // oid is found in mibs
371
			{
372
				$this->view->mib=$oidName['mib']; 
373
				$this->view->name=$oidName['name'];
374
				$this->view->trapListForMIB=$this->getMIB()
375
					->getTrapList($oidName['mib']);				
376
			}
377
			// Create object list with : display & rules references (OID) and complete with all objects if found
378
			$display=$ruleDetail->display;
379
			$rule=$ruleDetail->rule;
380
			
381
			// Create object list array with all OIDs in rule & display
382
			$curObjectList=$this->add_create_trap_object_list($display, $rule);
383
			
384
			// set display
385
			$this->view->display=$display;
386
			$this->view->rule=$rule;
387
			
388
			$this->view->objectList=$curObjectList; 			
389
		}
390
	}
391
	
392
	/** Validate form and output message to user  
393
	*	@param in postdata 
394
	* 	@return string status : OK / <Message>
395
	**/
396
	protected function handlerformAction()
397
	{
398
		$postData=$this->getRequest()->getPost();
399
		//print_r($postData ).'<br>';
400
	
401
		$params=array(
402
			// id (also db) => 	array('post' => post id, 'val' => default val, 'db' => send to table)
403
			'hostgroup'		=>	array('post' => 'hostgroup','db'=>false),
404
			'db_rule'		=>	array('post' => 'db_rule','db'=>false),
405
			'hostid'		=>	array('post' => 'hostid','db'=>false),
406
			'host_name'		=>	array('post' => 'hostname','val' => null,'db'=>true),
407
			'host_group_name'=>	array('post' => null,'val' => null,'db'=>true),
408
			'serviceid'		=>	array('post' => 'serviceid','db'=>false),
409
			'service_name'	=>	array('post' => 'serviceName','db'=>true),
410
			'trap_oid'		=>	array('post' => 'oid','db'=>true),
411
			'revert_ok'		=>	array('post' => 'revertOK','val' => 0,'db'=>true),
412
			'display'		=>	array('post' => 'display','val' => '','db'=>true),
413
			'rule'			=>	array('post' => 'rule','val' => '','db'=>true),			
414
			'action_match'	=>	array('post' => 'ruleMatch','val' => -1,'db'=>true),
415
			'action_nomatch'=>	array('post' => 'ruleNoMatch','val' => -1,'db'=>true),					
416
			'ip4'			=>	array('post' => null,'val' => null,'db'=>true),
417
			'ip6'			=>	array('post' => null,'val' => null,'db'=>true),
418
			'action_form'	=>	array('post' => 'action_form','db'=>false)
419
		);
420
		
421
		if (isset($postData[$params['action_form']['post']]) 
422
			&& $postData[$params['action_form']['post']] == 'delete' )
423
		{
424
			try
425
			{
426
				$this->deleteRule($postData[$params['db_rule']['post']]);
427
			}
428
			catch (Exception $e)
429
			{
430
				$this->_helper->json(array('status'=>$e->getMessage()));
431
				return;
432
			}
433
			//$this->Module()->
434
			$this->_helper->json(array(
435
				'status'=>'OK',
436
			    'redirect'=>'trapdirector/handler'
437
			      
438
			));
439
		}		
440
		foreach (array_keys($params) as $key)
441
		{
442
			if ($params[$key]['post']==null) continue; // data not sent in post vars
443
			if (! isset($postData[$params[$key]['post']]))
444
			{
445
				// should not happen as the js checks data
446
				$this->_helper->json(array('status'=>'No ' . $key));
447
			}
448
			else
449
			{
450
				$data=$postData[$params[$key]['post']];
451
				if ($data!=null && $data !="")
452
				{
453
					$params[$key]['val']=$postData[$params[$key]['post']];
454
				}
455
			}
456
		}
457
458
		try 
459
		{
460
			$isHostGroup=($params['hostgroup']['val'] == 1)?true:false;
461
			if (! $isHostGroup ) 
462
			{  // checks if selection by host 
463
				$hostAddr=$this->getHostInfoByID($params['hostid']['val']);
464
				$params['ip4']['val']=$hostAddr->ip4;
465
				$params['ip6']['val']=$hostAddr->ip6;
466
				$checkHostName=$hostAddr->name;
467
				if ($params['host_name']['val'] != $checkHostName) 
468
				{
469
					$this->_helper->json(array('status'=>"Invalid host id : Please re enter host name"));
470
					return;
471
				}
472
				$serviceName=$this->getObjectNameByid($params['serviceid']['val']);
0 ignored issues
show
Bug introduced by
$params['serviceid']['val'] of type false|string is incompatible with the type integer expected by parameter $id of Icinga\Module\Trapdirect...er::getObjectNameByid(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

472
				$serviceName=$this->getObjectNameByid(/** @scrutinizer ignore-type */ $params['serviceid']['val']);
Loading history...
473
				if ($params['service_name']['val'] != $serviceName->name2)
474
				{
475
					$this->_helper->json(array('status'=>"Invalid service id : Please re enter service"));
476
					return;
477
				}
478
			}
479
			else
480
			{
481
				$object=$this->getObjectNameByid($params['hostid']['val']);
482
				if ($params['host_name']['val'] != $object->name1)
483
				{
484
					$this->_helper->json(array('status'=>"Invalid object group id : Please re enter service"));
485
					return;					
486
				}
487
				// Put param in correct column (group_name)
488
				$params['host_group_name']['val'] = $params['host_name']['val'];
489
				$params['host_name']['val']=null;
490
			}
491
			$dbparams=array();
492
			foreach ($params as $key=>$val)
493
			{
494
				if ($val['db']==true )
495
				{
496
					$dbparams[$key] = $val['val'];
497
				}
498
			}
499
			// echo '<br>';	print_r($dbparams);echo '<br>';
500
			if ($params['db_rule']['val'] == -1 ) 
501
			{
502
				$ruleID=$this->addHandlerRule($dbparams);
503
			}
504
			else
505
			{
506
				$this->updateHandlerRule($dbparams,$params['db_rule']['val']);
507
				$ruleID=$params['db_rule']['val'];
508
			}
509
		}
510
		catch (Exception $e)
511
		{
512
			$this->_helper->json(array('status'=>$e->getMessage()));
513
			return;
514
		}
515
		$this->_helper->json(array('status'=>'OK', 'id' => $ruleID));
516
		
517
	}
518
519
	/** Get trap detail by trapid. 
520
	*	@param integer $trapid : id of trap in received table
521
	*	@return array (objects)
522
	*/
523
	protected function getTrapDetail($trapid) 
524
	{
525
		if (!preg_match('/^[0-9]+$/',$trapid)) { throw new Exception('Invalid id');  }
526
		$queryArray=$this->getModuleConfig()->trapDetailQuery();
527
		
528
		$db = $this->getDb()->getConnection();
529
		// ***************  Get main data
530
		// extract columns and titles;
531
		$elmts=NULL;
532
		foreach ($queryArray as $key => $val) {
533
			$elmts[$key]=$val[1];
534
		}
535
		try
536
		{		
537
			$query = $db->select()
538
				->from($this->getModuleConfig()->getTrapTableName(),$elmts)
539
				->where('id=?',$trapid);
540
			$trapDetail=$db->fetchRow($query);
541
			if ( $trapDetail == null ) throw new Exception('No traps was found with id = '.$trapid);
542
		}
543
		catch (Exception $e)
544
		{
545
			$this->displayExitError('Add handler : get trap detail returning : '.print_r($trapDetail,true),$e->getMessage());
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $trapDetail does not seem to be defined for all execution paths leading up to this point.
Loading history...
546
			return;
547
		}
548
549
		return $trapDetail;
550
551
	}
552
553
	/** Get trap objects
554
	*	@param integer $trapid : trap id
555
	* 	@return array : full column in db of trap id
556
	*/
557
	protected function getTrapobjects($trapid)
558
	{	
559
		if (!preg_match('/^[0-9]+$/',$trapid)) { throw new Exception('Invalid id');  }
560
		$queryArrayData=$this->getModuleConfig()->trapDataDetailQuery();
561
		
562
		$db = $this->getDb()->getConnection();
563
		// ***************  Get object data
564
		// extract columns and titles;
565
		$data_elmts=NULL;
566
		foreach ($queryArrayData as $key => $val) {
567
			$data_elmts[$key]=$val[1];
568
		}
569
		try
570
		{		
571
			$query = $db->select()
572
				->from($this->moduleConfig->getTrapDataTableName(),$data_elmts)
573
				->where('trap_id=?',$trapid);
574
			$trapDetail=$db->fetchAll($query);
575
			// if ( $trapDetail == null ) throw new Exception('No traps was found with id = '.$trapid);
576
		}
577
		catch (Exception $e)
578
		{
579
			$this->displayExitError('Add handler : get trap data detail : ',$e->getMessage());
580
			return array();
581
		}
582
583
		return $trapDetail;
584
	}
585
586
	/** Get rule detail by ruleid.
587
	*	@param integer $ruleid int id of rule in rule table
588
	*	@return array : column objects in db
589
	*/
590
	protected function getRuleDetail($ruleid) 
591
	{
592
		if (!preg_match('/^[0-9]+$/',$ruleid)) { throw new Exception('Invalid id');  }
593
		$queryArray=$this->getModuleConfig()->ruleDetailQuery();
594
		
595
		$db = $this->getDb()->getConnection();
596
		// ***************  Get main data
597
		try
598
		{		
599
			$query = $db->select()
600
				->from($this->getModuleConfig()->getTrapRuleName(),$queryArray)
601
				->where('id=?',$ruleid);
602
			$ruleDetail=$db->fetchRow($query);
603
			if ( $ruleDetail == null ) throw new Exception('No rule was found with id = '.$ruleid);
604
		}
605
		catch (Exception $e)
606
		{
607
			$this->displayExitError('Update handler : get rule detail',$e->getMessage());
608
			return array();
609
		}
610
611
		return $ruleDetail;
612
613
	}
614
615
	/** Setup tabs for rules 
616
	*/
617
	protected function prepareTabs()
618
	{
619
		return $this->getTabs()->add('status', array(
620
			'label' => $this->translate('Traps'),
621
			'url'   => $this->getModuleConfig()->urlPath() . '/handler')
622
		);
623
	} 
624
	
625
}