Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: Service check timed out after 0.00 seconds on Naemon installat… #62

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2.0.7 - ??/??/20??
------------------
- Fixed service check timed out after 0.00 seconds on Naemon installations (#61) (ccztux)

2.0.6 - 08/01/2024
------------------
- Make sure tabs aren't mistakenly added to the output file of nrdp_write_check_output_to_cmd - (tsadpbb)
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,14 +219,14 @@ 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";

$check_result_contents = str_replace("\t", " ", $check_result_contents);

// 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 @@ -254,7 +254,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 @@ -475,7 +475,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 @@ -487,16 +487,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 @@ -566,14 +566,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