parent
cf2566d1d3
commit
0198d76a75
|
@ -354,7 +354,7 @@ function psm_parse_msg($status, $type, $vars, $combi = false) {
|
||||||
* @return string cURL result
|
* @return string cURL result
|
||||||
*/
|
*/
|
||||||
function psm_curl_get($href, $header = false, $body = true, $timeout = null, $add_agent = true, $website_username = false, $website_password = false, $request_method = null, $post_field = null) {
|
function psm_curl_get($href, $header = false, $body = true, $timeout = null, $add_agent = true, $website_username = false, $website_password = false, $request_method = null, $post_field = null) {
|
||||||
$timeout = $timeout == null ? PSM_CURL_TIMEOUT : intval($timeout);
|
($timeout === null || $timeout > 0) ? PSM_CURL_TIMEOUT : intval($timeout);
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
if(defined('PSM_DEBUG') && PSM_DEBUG === true && psm_is_cli()) {
|
if(defined('PSM_DEBUG') && PSM_DEBUG === true && psm_is_cli()) {
|
||||||
|
|
|
@ -252,7 +252,7 @@ class ServerController extends AbstractServerController {
|
||||||
$clean = array(
|
$clean = array(
|
||||||
'label' => trim(strip_tags(psm_POST('label', ''))),
|
'label' => trim(strip_tags(psm_POST('label', ''))),
|
||||||
'ip' => trim(strip_tags(psm_POST('ip', ''))),
|
'ip' => trim(strip_tags(psm_POST('ip', ''))),
|
||||||
'timeout' => (isset($_POST['timeout']) && intval($_POST['timeout']) > 0) ? intval($_POST['timeout']) : null,
|
'timeout' => (isset($_POST['timeout']) && intval($_POST['timeout']) > 0) ? intval($_POST['timeout']) : 10,
|
||||||
'website_username' => psm_POST('website_username'),
|
'website_username' => psm_POST('website_username'),
|
||||||
'website_password' => $encrypted_password,
|
'website_password' => $encrypted_password,
|
||||||
'port' => intval(psm_POST('port', 0)),
|
'port' => intval(psm_POST('port', 0)),
|
||||||
|
|
|
@ -202,11 +202,12 @@ class StatusUpdater {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
protected function updateService($max_runs, $run = 1) {
|
protected function updateService($max_runs, $run = 1) {
|
||||||
|
$timeout = ($this->server['timeout'] === null || $this->server['timeout'] > 0) ? PSM_CURL_TIMEOUT : intval($this->server['timeout']);
|
||||||
$errno = 0;
|
$errno = 0;
|
||||||
// save response time
|
// save response time
|
||||||
$starttime = microtime(true);
|
$starttime = microtime(true);
|
||||||
|
|
||||||
$fp = @fsockopen($this->server['ip'], $this->server['port'], $errno, $this->error, $this->server['timeout']);
|
$fp = @fsockopen($this->server['ip'], $this->server['port'], $errno, $this->error, $timeout);
|
||||||
|
|
||||||
$status = ($fp === false) ? false : true;
|
$status = ($fp === false) ? false : true;
|
||||||
$this->rtime = (microtime(true) - $starttime);
|
$this->rtime = (microtime(true) - $starttime);
|
||||||
|
|
|
@ -115,7 +115,7 @@
|
||||||
<!-- Warning threshold -->
|
<!-- Warning threshold -->
|
||||||
{{ macro.input_field("number", "warning_threshold", null, "warning_threshold", label_warning_threshold, edit_value_warning_threshold, "0", "5", 'warning_threshold_help', label_warning_threshold_description) }}
|
{{ macro.input_field("number", "warning_threshold", null, "warning_threshold", label_warning_threshold, edit_value_warning_threshold, "0", "5", 'warning_threshold_help', label_warning_threshold_description) }}
|
||||||
<!-- Timeout -->
|
<!-- Timeout -->
|
||||||
{{ macro.input_field("number", "timeout", null, "timeout", label_timeout, edit_value_timeout, null, "10", 'timeout_help', label_timeout_description) }}
|
{{ macro.input_field("number", "timeout", null, "timeout", label_timeout, edit_value_timeout, default_value_timeout, "10", 'timeout_help', label_timeout_description) }}
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset class="types typeWebsite">
|
<fieldset class="types typeWebsite">
|
||||||
|
|
Loading…
Reference in New Issue