summaryrefslogtreecommitdiffstats
path: root/frontends/php/include
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/php/include')
-rw-r--r--frontends/php/include/classes/ctable.inc.php4
-rw-r--r--frontends/php/include/defines.inc.php1
-rw-r--r--frontends/php/include/discovery.inc.php26
-rw-r--r--frontends/php/include/forms.inc.php23
-rw-r--r--frontends/php/include/locales/en_gb.inc.php1
5 files changed, 33 insertions, 22 deletions
diff --git a/frontends/php/include/classes/ctable.inc.php b/frontends/php/include/classes/ctable.inc.php
index 72dc2718..1ef4957d 100644
--- a/frontends/php/include/classes/ctable.inc.php
+++ b/frontends/php/include/classes/ctable.inc.php
@@ -63,8 +63,8 @@
}
elseif(is_array($item)){
foreach($item as $el){
- if(strtolower(get_class($el))=='ccol') {
- parent::AddItem($el);
+ if(strtolower(get_class($el))=='ccol') {
+ parent::AddItem($el);
}
else if(!is_null($el)){
parent::AddItem(new CCol($el));
diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php
index 7c5fdd7c..ac018e72 100644
--- a/frontends/php/include/defines.inc.php
+++ b/frontends/php/include/defines.inc.php
@@ -437,6 +437,7 @@
define('SVC_AGENT', 9);
define('SVC_SNMPv1', 10);
define('SVC_SNMPv2', 11);
+ define('SVC_ICMPPING', 12);
define('DHOST_STATUS_ACTIVE', 0);
define('DHOST_STATUS_DISABLED', 1);
diff --git a/frontends/php/include/discovery.inc.php b/frontends/php/include/discovery.inc.php
index 673c9d40..577d983c 100644
--- a/frontends/php/include/discovery.inc.php
+++ b/frontends/php/include/discovery.inc.php
@@ -35,18 +35,19 @@
$port = 0;
switch($type_int){
- case SVC_SSH: $port = 22; break;
- case SVC_LDAP: $port = 389; break;
- case SVC_SMTP: $port = 25; break;
- case SVC_FTP: $port = 21; break;
- case SVC_HTTP: $port = 80; break;
- case SVC_POP: $port = 110; break;
- case SVC_NNTP: $port = 119; break;
- case SVC_IMAP: $port = 143; break;
- case SVC_TCP: $port = 80; break;
- case SVC_AGENT: $port = 10050; break;
- case SVC_SNMPv1:$port = 161; break;
- case SVC_SNMPv2:$port = 161; break;
+ case SVC_SSH: $port = 22; break;
+ case SVC_LDAP: $port = 389; break;
+ case SVC_SMTP: $port = 25; break;
+ case SVC_FTP: $port = 21; break;
+ case SVC_HTTP: $port = 80; break;
+ case SVC_POP: $port = 110; break;
+ case SVC_NNTP: $port = 119; break;
+ case SVC_IMAP: $port = 143; break;
+ case SVC_TCP: $port = 80; break;
+ case SVC_AGENT: $port = 10050; break;
+ case SVC_SNMPv1: $port = 161; break;
+ case SVC_SNMPv2: $port = 161; break;
+ case SVC_ICMPPING: $port = 0; break;
}
return $port;
@@ -66,6 +67,7 @@
$str_type[SVC_AGENT] = S_ZABBIX_AGENT;
$str_type[SVC_SNMPv1] = S_SNMPV1_AGENT;
$str_type[SVC_SNMPv2] = S_SNMPV2_AGENT;
+ $str_type[SVC_ICMPPING] = S_ICMPPING;
if(isset($str_type[$type_int]))
return $str_type[$type_int];
diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php
index 15bcacc6..043fd367 100644
--- a/frontends/php/include/forms.inc.php
+++ b/frontends/php/include/forms.inc.php
@@ -186,7 +186,7 @@
//TODO init checks
$dchecks = array();
- $db_checks = DBselect('SELECT * FROM dchecks WHERE druleid='.$_REQUEST['druleid']);
+ $db_checks = DBselect('SELECT type,ports,key_,snmp_community FROM dchecks WHERE druleid='.$_REQUEST['druleid']);
while($check_data = DBfetch($db_checks))
{
$dchecks[] = array( 'type' => $check_data['type'], 'ports' => $check_data['ports'] ,
@@ -231,7 +231,7 @@
{
case SVC_SNMPv1:
case SVC_SNMPv2:
- $external_param = '"'.$data['snmp_community'].'":"'.$data['key'].'"';
+ $external_param = ' "'.$data['snmp_community'].'":"'.$data['key'].'"';
break;
case SVC_AGENT:
$external_param = ' "'.$data['key'].'"';
@@ -239,10 +239,12 @@
default:
$external_param = null;
}
+ $port_def = svc_default_port($data['type']);
$dchecks[$id] = array(
- new CCheckBox('selected_checks[]',null,null,$id), SPACE,
- discovery_check_type2str($data['type']), SPACE,
- '('.$data['ports'].')'.SPACE.$external_param,
+ new CCheckBox('selected_checks[]',null,null,$id),
+ discovery_check_type2str($data['type']),
+ ($port_def == $data['ports'] ? '' : SPACE.'('.$data['ports'].')').
+ $external_param,
BR()
);
}
@@ -256,7 +258,7 @@
$cmbChkType = new CComboBox('new_check_type',$new_check_type,
"if(add_variable(this, 'type_changed', 1)) submit()"
);
- foreach(array(SVC_SSH, SVC_LDAP, SVC_SMTP, SVC_FTP, SVC_HTTP, SVC_POP, SVC_NNTP, SVC_IMAP, SVC_TCP, SVC_AGENT, SVC_SNMPv1, SVC_SNMPv2) as $type_int)
+ foreach(array(SVC_SSH, SVC_LDAP, SVC_SMTP, SVC_FTP, SVC_HTTP, SVC_POP, SVC_NNTP, SVC_IMAP, SVC_TCP, SVC_AGENT, SVC_SNMPv1, SVC_SNMPv2, SVC_ICMPPING) as $type_int)
$cmbChkType->AddItem($type_int, discovery_check_type2str($type_int));
if(isset($_REQUEST['type_changed']))
@@ -275,14 +277,18 @@
$form->AddVar('new_check_snmp_community', '');
$external_param = array_merge($external_param, array(BR(), S_KEY, new CTextBox('new_check_key', $new_check_key), BR()));
break;
+ case SVC_ICMPPING:
+ $form->AddVar('new_check_ports', '0');
default:
$form->AddVar('new_check_snmp_community', '');
$form->AddVar('new_check_key', '');
}
+ $ports_box = $new_check_type == SVC_ICMPPING ? NULL : array(S_PORTS_SMALL, SPACE,
+ new CNumericBox('new_check_ports', $new_check_ports,5));
$form->AddRow(S_NEW_CHECK, array(
$cmbChkType, SPACE,
- S_PORTS_SMALL, SPACE, new CNumericBox('new_check_ports', $new_check_ports,5),
+ $ports_box,
$external_param,
new CButton('add_check', S_ADD)
),'new');
@@ -3155,7 +3161,8 @@ include_once 'include/discovery.inc.php';
case CONDITION_TYPE_DSERVICE_TYPE:
$cmbCondVal = new CComboBox('new_condition[value]');
foreach(array(SVC_SSH, SVC_LDAP, SVC_SMTP, SVC_FTP, SVC_HTTP,
- SVC_POP, SVC_NNTP, SVC_IMAP, SVC_TCP,SVC_AGENT,SVC_SNMPv1,SVC_SNMPv2) as $svc)
+ SVC_POP, SVC_NNTP, SVC_IMAP, SVC_TCP,SVC_AGENT,SVC_SNMPv1,SVC_SNMPv2,
+ SVC_ICMPPING) as $svc)
$cmbCondVal->AddItem($svc,discovery_check_type2str($svc));
$rowCondition[] = $cmbCondVal;
diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php
index ece4c13c..7b8bfd5e 100644
--- a/frontends/php/include/locales/en_gb.inc.php
+++ b/frontends/php/include/locales/en_gb.inc.php
@@ -70,6 +70,7 @@
'S_NNTP'=> 'NNTP',
'S_IMAP'=> 'IMAP',
'S_TCP'=> 'TCP',
+ 'S_ICMPPING'=> 'ICMP Ping',
'S_PORTS_SMALL'=> 'ports',
'S_DISCOVERY_RULES_DELETED'=> 'Discovery rules deleted',