Skip to content

Commit

Permalink
Fixed: Service check timed out after 0.00 seconds on Naemon installat…
Browse files Browse the repository at this point in the history
  • Loading branch information
zet committed Oct 28, 2021
1 parent 6ee9a75 commit b6aff75
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2.0.6 - ??/??/2021
------------------
- Fixed service check timed out after 0.00 seconds on Naemon installations (#61) (ccztux)

2.0.5 - 10/14/2021
------------------
- Updated jQuery to version 3.6.0 -JO
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Download the latest tarball and extract to start the install:

```
cd /tmp
wget https://github.com/NagiosEnterprises/nrdp/archive/2.0.5.tar.gz
tar xvf 2.0.5.tar.gz
wget https://github.com/NagiosEnterprises/nrdp/archive/2.0.6.tar.gz
tar xvf 2.0.6.tar.gz
cd nrdp-*
```

Expand Down
2 changes: 1 addition & 1 deletion server/includes/constants.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

// PRODUCT INFO
define("PRODUCT_NAME", "nrdp");
define("PRODUCT_VERSION", "2.0.5");
define("PRODUCT_VERSION", "2.0.6");

// ERROR STRINGS
define("ERROR_CAPABILITY_NOT_ENABLED","NOT ENABLED");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function nagioscorepassivecheck_submit_check_data()


if ($output_type == TYPE_XML) {

$data = grab_xml();
$data = @simplexml_load_string($data);

Expand Down Expand Up @@ -100,7 +100,7 @@ function nagioscorepassivecheck_submit_check_data()

_debug("our json: " . print_r($data, true));
}



// Make sure we can write to check results dir
Expand Down Expand Up @@ -156,7 +156,7 @@ function nagioscorepassivecheck_submit_check_data()
$debug_msg .= "time: {$time}\n";

_debug($debug_msg);


if (!empty($time) && $allow_old_results == true) {
nrdp_write_check_output_to_ndo($hostname, $servicename, $state, $output, $type, $time);
Expand Down Expand Up @@ -219,12 +219,12 @@ function nrdp_write_check_output_to_cmd($hostname, $servicename, $state, $output
$check_result_contents .= "host_name={$hostname}\n";
$check_result_contents .= $service_line;
$check_result_contents .= "check_type=1\n";
$check_result_contents .= "early_timeout=1\n";
$check_result_contents .= "early_timeout=0\n";
$check_result_contents .= "exited_ok=1\n";
$check_result_contents .= "return_code={$state}\n";
$check_result_contents .= "output=${output}\\n\n";

// put check result into the check file
// put check result into the check file
file_put_contents($check_file, $check_result_contents);


Expand Down Expand Up @@ -252,7 +252,7 @@ function nrdp_write_check_output_to_cmd($hostname, $servicename, $state, $output
if ($mod_changed == false) {
_debug("unable to change permissions on {$check_file} to 0770");
}


// Create an ok-to-go, so Nagios Core picks it up
$touched = touch("{$check_file}.ok");
Expand Down Expand Up @@ -473,7 +473,7 @@ function nrdp_write_check_output_to_ndo($hostname, $servicename, $state, $output
{$update_status_sql}
latency = 0
WHERE service_object_id = {$object_id}";

$db->query($sql);


Expand All @@ -485,16 +485,16 @@ function nrdp_write_check_output_to_ndo($hostname, $servicename, $state, $output

$sql = "INSERT INTO nagios_statehistory
(
instance_id, state_time, object_id, state_change,
state, state_type, current_check_attempt,
max_check_attempts, last_state, last_hard_state,
instance_id, state_time, object_id, state_change,
state, state_type, current_check_attempt,
max_check_attempts, last_state, last_hard_state,
output, long_output
)
VALUES
VALUES
(
1, FROM_UNIXTIME({$time}), {$object_id}, 1,
{$state}, {$state_type}, {$current_attempt},
{$max_check_attempts}, {$current_state}, {$last_hard_state},
1, FROM_UNIXTIME({$time}), {$object_id}, 1,
{$state}, {$state_type}, {$current_attempt},
{$max_check_attempts}, {$current_state}, {$last_hard_state},
'{$output}', '{$long_output}'
)";
$db->query($sql);
Expand Down Expand Up @@ -564,14 +564,14 @@ function nrdp_write_check_output_to_ndo($hostname, $servicename, $state, $output
// add a row into the log entries table
$sql = "INSERT INTO nagios_logentries
(
instance_id, logentry_time, entry_time,
instance_id, logentry_time, entry_time,
entry_time_usec, logentry_type, logentry_data,
realtime_data, inferred_data_extracted
)
VALUES
VALUES
(
1, FROM_UNIXTIME({$time}), FROM_UNIXTIME({$time}),
0, {$logentry_type}, '{$logentry}',
0, {$logentry_type}, '{$logentry}',
1, 1
)";

Expand Down

0 comments on commit b6aff75

Please sign in to comment.