Skip to content

Commit

Permalink
fix showing days in unhandled problems on main page (fixes #1265)
Browse files Browse the repository at this point in the history
  • Loading branch information
sni committed Apr 7, 2023
1 parent 7193402 commit 0dabc7d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/Thruk/Utils/Filter.pm
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ sub duration {
$years = int($duration/(365*86400));
$duration = $duration%(365*86400);
}
}
if($options == 4 || $options == 5 || $options == 6 || $options == 1) {
if($duration >= 86400) {
$days = int($duration/86400);
$duration = $duration%86400;
Expand Down
4 changes: 2 additions & 2 deletions templates/main.tt
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
<td><a class="link" href="extinfo.cgi?type=1&amp;host=[% h.name | uri %]">[% h.name | html %]</a></td>
<td class="flex justify-center"><div class="badge DOWN">DOWN</div></td>
<td class="truncate w-1/2 max-w-0">[% h.plugin_output %]</td>
<td>[% duration(date.now - h.last_hard_state_change) %]</td>
<td>[% duration(date.now - h.last_hard_state_change, 6) %]</td>
</tr>
[% END %]
[% IF problemhosts.size == 0 %]
Expand Down Expand Up @@ -272,7 +272,7 @@
<td><a class="link" href="extinfo.cgi?type=2&amp;host=[% s.host_name | uri %]&amp;service=[% s.description | uri %]&amp;backend=[% s.peer_key | uri %]">[% s.description | html %]</a></td>
<td class="flex justify-center"><div class="badge [% state %]">[% state %]</div></td>
<td class="truncate w-1/2 max-w-0">[% s.plugin_output %]</td>
<td>[% duration(date.now - s.last_hard_state_change) %]</td>
<td>[% duration(date.now - s.last_hard_state_change, 6) %]</td>
</tr>
[% END %]
[% IF problemservices.size == 0 %]
Expand Down

0 comments on commit 0dabc7d

Please sign in to comment.