diff options
| author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-05-14 12:30:14 +0000 |
|---|---|---|
| committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-05-14 12:30:14 +0000 |
| commit | 77ddebaf537a1c9d5a98e6ba7cbefce50b64d27f (patch) | |
| tree | 7bb757f88228440455f58990b3cc71c2d3e123cc /frontends/php/include | |
| parent | 90f1044ad520c79987196bdeb408877bc571bbd4 (diff) | |
- added http status code configuration for web monitoring (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@4130 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
| -rw-r--r-- | frontends/php/include/defines.inc.php | 1 | ||||
| -rw-r--r-- | frontends/php/include/forms.inc.php | 6 | ||||
| -rw-r--r-- | frontends/php/include/httptest.inc.php | 13 | ||||
| -rw-r--r-- | frontends/php/include/locales/en_gb.inc.php | 1 | ||||
| -rw-r--r-- | frontends/php/include/validate.inc.php | 31 |
5 files changed, 45 insertions, 7 deletions
diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php index 2cab0aab..3ddd3850 100644 --- a/frontends/php/include/defines.inc.php +++ b/frontends/php/include/defines.inc.php @@ -51,6 +51,7 @@ define('T_ZBX_CLR', 5); define('T_ZBX_PORTS', 6); define('T_ZBX_IP_RANGE', 7); + define('T_ZBX_INT_RANGE', 8); define('O_MAND', 0); define('O_OPT', 1); diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php index 6a785eb2..f4044e2f 100644 --- a/frontends/php/include/forms.inc.php +++ b/frontends/php/include/forms.inc.php @@ -323,12 +323,14 @@ $posts = get_request('posts', ''); $timeout = get_request('timeout', 15); $required = get_request('required', ''); + $status_codes = get_request('status_codes', ''); $form->AddRow(S_NAME, new CTextBox('name', $name, 50)); $form->AddRow(S_URL, new CTextBox('url', $url, 80)); $form->AddRow(S_POST, new CTextArea('posts', $posts, 50, 10)); $form->AddRow(S_TIMEOUT, new CNumericBox('timeout', $timeout, 5)); $form->AddRow(S_REQUIRED, new CTextBox('required', $required, 80)); + $form->AddRow(S_STATUS_CODES, new CTextBox('status_codes', $status_codes, 80)); $form->AddItemToBottomRow(new CButton("save", isset($sid) ? S_SAVE : S_ADD)); @@ -419,7 +421,7 @@ $form->AddRow(S_VARIABLES, new CTextArea('macros', $macros, 84, 5)); $tblSteps = new CTableInfo(); - $tblSteps->SetHeader(array(S_NAME,S_TIMEOUT,S_URL,S_REQUIRED,SPACE)); + $tblSteps->SetHeader(array(S_NAME,S_TIMEOUT,S_URL,S_REQUIRED,S_STATUS,SPACE)); if(count($steps) > 0) { $first = min(array_keys($steps)); @@ -455,6 +457,7 @@ url_param($s['url'],false,'url'). url_param($s['posts'],false,'posts'). url_param($s['required'],false,'required'). + url_param($s['status_codes'],false,'status_codes'). '");'); if(strlen($s['url']) > 70) @@ -472,6 +475,7 @@ $s['timeout'].SPACE.S_SEC_SMALL, $url, $s['required'], + $s['status_codes'], array($up, isset($up) && isset($down) ? SPACE : null, $down) )); } diff --git a/frontends/php/include/httptest.inc.php b/frontends/php/include/httptest.inc.php index 1a394336..409d992a 100644 --- a/frontends/php/include/httptest.inc.php +++ b/frontends/php/include/httptest.inc.php @@ -45,7 +45,7 @@ return $status; } - function db_save_step($hostid, $applicationid, $httptestid, $testname, $name, $no, $timeout, $url, $posts, $required, $delay, $history, $trends) + function db_save_step($hostid, $applicationid, $httptestid, $testname, $name, $no, $timeout, $url, $posts, $required, $status_codes, $delay, $history, $trends) { if (!eregi('^([0-9a-zA-Z\_\.[.-.]\$ ]+)$', $name)) { @@ -59,10 +59,10 @@ $httpstepid = get_dbid("httpstep","httpstepid"); if (!DBexecute('insert into httpstep'. - ' (httpstepid, httptestid, name, no, url, timeout, posts, required) '. + ' (httpstepid, httptestid, name, no, url, timeout, posts, required, status_codes) '. ' values ('.$httpstepid.','.$httptestid.','.zbx_dbstr($name).','.$no.','. zbx_dbstr($url).','.$timeout.','. - zbx_dbstr($posts).','.zbx_dbstr($required).')' + zbx_dbstr($posts).','.zbx_dbstr($required).','.zbx_dbstr($status_codes).')' )) return false; } else @@ -71,7 +71,7 @@ if (!DBexecute('update httpstep set '. ' name='.zbx_dbstr($name).', no='.$no.', url='.zbx_dbstr($url).', timeout='.$timeout.','. - ' posts='.zbx_dbstr($posts).', required='.zbx_dbstr($required). + ' posts='.zbx_dbstr($posts).', required='.zbx_dbstr($required).', status_codes='.zbx_dbstr($status_codes). ' where httpstepid='.$httpstepid)) return false; } @@ -207,10 +207,11 @@ if(!isset($s['timeout'])) $s['timeout'] = 15; if(!isset($s['url'])) $s['url'] = ''; if(!isset($s['posts'])) $s['posts'] = ''; - if(!isset($s['required'])) $s['required'] = ''; + if(!isset($s['required'])) $s['required'] = ''; + if(!isset($s['status_codes'])) $s['status_codes'] = ''; $result = db_save_step($hostid, $applicationid, $httptestid, - $name, $s['name'], $sid, $s['timeout'], $s['url'], $s['posts'], $s['required'], + $name, $s['name'], $sid, $s['timeout'], $s['url'], $s['posts'], $s['required'],$s['status_codes'], $delay, $history, $trends); if(!$result) break; diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php index e5d26181..ae117c9d 100644 --- a/frontends/php/include/locales/en_gb.inc.php +++ b/frontends/php/include/locales/en_gb.inc.php @@ -100,6 +100,7 @@ 'S_STATE'=> 'State', // httpconf.php + 'S_STATUS_CODES'=> 'Status codes', 'S_WEB'=> 'Web', 'S_CONFIGURATION_OF_WEB_MONITORING'=> 'Configuration of Web monitoring', 'S_CONFIGURATION_OF_WEB_MONITORING_BIG'=>'CONFIGURATION OF WEB MONITORING', diff --git a/frontends/php/include/validate.inc.php b/frontends/php/include/validate.inc.php index 07ef0752..997e7f76 100644 --- a/frontends/php/include/validate.inc.php +++ b/frontends/php/include/validate.inc.php @@ -28,6 +28,19 @@ define('ZBX_VALID_ERROR', 1); define('ZBX_VALID_WARNING', 2); + function is_int_range($value) + { + if( !empty($value) ) foreach(explode(',',$value) as $int_range) + { + $int_range = explode('-', $int_range); + if(count($int_range) > 2) return false; + foreach($int_range as $int_val) + if( !is_numeric($int_val) ) + return false; + } + return true; + } + function is_hex_color($value) { return eregi('^[0-9,A-F]{6}$', $value); @@ -258,6 +271,24 @@ $err |= check_type($field, $flags, $p, T_ZBX_INT); return $err; } + + if($type == T_ZBX_INT_RANGE) + { + if( !is_int_range($var) ) + { + if($flags&P_SYS) + { + info("Critical error. Field [".$field."] is not integer range"); + return ZBX_VALID_ERROR; + } + else + { + info("Warning. Field [".$field."] is not integer range"); + return ZBX_VALID_WARNING; + } + } + return ZBX_VALID_OK; + } if(($type == T_ZBX_INT) && !is_numeric($var)) { if($flags&P_SYS) |
