Skip to content

Commit

Permalink
agents: move title to cell
Browse files Browse the repository at this point in the history
so its easier for small values
  • Loading branch information
sni committed Feb 2, 2024
1 parent edcaa57 commit ea9c385
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions plugins/plugins-available/agents/templates/agents.tt
Expand Up @@ -89,27 +89,27 @@
[% info.$hostname.os_version | html %]
</td>
<td>[% info.$hostname.os_arch %]</td>
<td class='align-top relative'>
<td class='align-top relative' title="[% IF info.$hostname.cpu_perc != ''; sprintf("%d", info.$hostname.cpu_perc*100); "% used"; END %]">
[% IF info.$hostname.cpu_perc; %][%IF info.$hostname.cpu_perc > 1; info.$hostname.cpu_perc = 1; END %]
<div style='width: [% 100 * info.$hostname.cpu_perc %]%; height: 100%;' class='[% IF info.$hostname.cpu_state == 2 %]CRITICAL[% ELSIF info.$hostname.cpu_state == 1 %]WARNING[% ELSE %]OK[% END %] absolute top-0 left-0' title="cpu usage: [% 100 * info.$hostname.cpu_perc %]%"></div>
<div style='width: [% 100 * info.$hostname.cpu_perc %]%; height: 100%;' class='[% IF info.$hostname.cpu_state == 2 %]CRITICAL[% ELSIF info.$hostname.cpu_state == 1 %]WARNING[% ELSE %]OK[% END %] absolute top-0 left-0'></div>
[% END %]
<span class='absolute top-0 left-0' style='margin-left: 3px;' title="[% IF info.$hostname.cpu_perc; sprintf("%.d", info.$hostname.cpu_perc*100); "% used"; END %]">
<span class='absolute top-0 left-0' style='margin-left: 3px;'>
[% IF info.$hostname.cpu_cores; info.$hostname.cpu_cores; " Cores"; END %]
</span>
</td>
<td class='align-top relative'>
[% IF info.$hostname.memfree; perc = ( info.$hostname.memtotal - info.$hostname.memfree ) / info.$hostname.memtotal %][%IF perc > 1; perc = 1; END %]
[% perc = 0; IF info.$hostname.memfree; perc = ( info.$hostname.memtotal - info.$hostname.memfree ) / info.$hostname.memtotal %][%IF perc > 1; perc = 1; END %]
<td class='align-top relative' title="[% IF info.$hostname.memfree; sprintf("%.1f", perc*100); "% used"; END %]">
<div style='width: [% 100 * perc %]%; height: 100%;' class='[% IF info.$hostname.mem_state == 2 %]CRITICAL[% ELSIF info.$hostname.mem_state == 1 %]WARNING[% ELSE %]OK[% END %] absolute top-0 left-0'></div>
[% END %]
<span class='absolute top-0 left-0' style='margin-left: 3px;' title="[% IF info.$hostname.memfree; sprintf("%.d", perc*100); "% used"; END %]">
<span class='absolute top-0 left-0' style='margin-left: 3px;'>
[% IF info.$hostname.memtotal; n = reduce_number(info.$hostname.memtotal, 'B', 1024); sprintf('%.1f %s',n.0, n.1); END %]
</span>
</td>
<td class='align-top relative'>
[% IF info.$hostname.disk_total; perc = ( info.$hostname.disk_total - info.$hostname.disk_free ) / info.$hostname.disk_total %][%IF perc > 1; perc = 1; END %]
[% perc = 0; IF info.$hostname.disk_total; perc = ( info.$hostname.disk_total - info.$hostname.disk_free ) / info.$hostname.disk_total %][%IF perc > 1; perc = 1; END %]
<td class='align-top relative' title="[% IF info.$hostname.disk_total %][% sprintf("%.1f", perc*100) %]% used, [% n = reduce_number(info.$hostname.disk_free, 'B', 1024); sprintf('%.1f %s',n.0, n.1) %] free[% END %]">
<div style='width: [% 100 * perc %]%; height: 100%;' class='[% IF info.$hostname.disk_state == 2 %]CRITICAL[% ELSIF info.$hostname.disk_state == 1 %]WARNING[% ELSE %]OK[% END %] absolute top-0 left-0'></div>
[% END %]
<span class='absolute top-0 left-0' style='margin-left: 3px;' title="[% IF info.$hostname.disk_total %][% sprintf("%.d", perc*100) %]% used, [% n = reduce_number(info.$hostname.disk_free, 'B', 1024); sprintf('%.1f %s',n.0, n.1) %] free[% END %]">
<span class='absolute top-0 left-0' style='margin-left: 3px;'>
[% IF info.$hostname.disk_total; n = reduce_number(info.$hostname.disk_total, 'B', 1024); sprintf('%.1f %s',n.0, n.1); END %]
</span>
</td>
Expand Down

0 comments on commit ea9c385

Please sign in to comment.