Updated anvil-monitor-performance to reduce logging volume.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 10 months ago
parent c79b76e2ee
commit a65bf5090e
  1. 1
      share/words.xml
  2. 72
      tools/anvil-monitor-performance

@ -2726,6 +2726,7 @@ The file: [#!variable!file!#] needs to be updated. The difference is:
<key name="log_0843">Creating the: [#!variable!file!#] debug file on: [#!variable!host!#].</key>
<key name="log_0844">The bond interface: [#!variable!bond_name!#] is not ready yet, we'll check again shortly.</key>
<key name="log_0845">No interfaces found configured for the bond: [#!variable!bond_name!#], ignoring it.</key>
<key name="log_0846">CPU Load Average: [#!variable!one_minute!# / #!variable!five_minutes!# / #!variable!ten_minutes!#], io wait: [#!variable!iowait!#%], running/blocked processes: [#!variable!running!# / #!variable!blocked!#]</key>
<!-- Messages for users (less technical than log entries), though sometimes used for logs, too. -->
<key name="message_0001">The host name: [#!variable!target!#] does not resolve to an IP address.</key>

@ -31,8 +31,8 @@ $anvil->Get->switches({list => [
"print",
"run-once",
], man => $THIS_FILE});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => $anvil->data->{switches}});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure => 0, key => "log_0115", variables => { program => $THIS_FILE }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => $anvil->data->{switches}});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, secure => 0, key => "log_0115", variables => { program => $THIS_FILE }});
# Calculate my sum so that we can exit if it changes later.
$anvil->Storage->record_md5sums;
@ -59,7 +59,7 @@ while(1)
if (time > $next_md5sum_check)
{
$next_md5sum_check = time + 30;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { next_md5sum_check => $next_md5sum_check }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { next_md5sum_check => $next_md5sum_check }});
if ($anvil->Storage->check_md5sums)
{
# NOTE: We exit with '0' to prevent systemctl from showing a scary red message.
@ -76,36 +76,36 @@ sub record_data
{
my ($anvil) = @_;
$anvil->Get->load_average({debug => 2});
# Show the CPU load percents.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 1, key => "log_0840", variables => {
iowait => $anvil->data->{loads}{load_percent}{iowait},
user => $anvil->data->{loads}{load_percent}{user},
steal => $anvil->data->{loads}{load_percent}{steal},
idle => $anvil->data->{loads}{load_percent}{idle},
nice => $anvil->data->{loads}{load_percent}{nice},
'system' => $anvil->data->{loads}{load_percent}{'system'},
}});
# Show the CPU load levels
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 1, key => "log_0835", variables => {
one_minute => $anvil->data->{loads}{load_average}{one_minute},
five_minutes => $anvil->data->{loads}{load_average}{five_minute},
ten_minutes => $anvil->data->{loads}{load_average}{ten_minute},
}});
# Show the processes
my $key = $detailed ? "log_0841" : "log_0836";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 1, key => $key, variables => {
total => $anvil->Convert->add_commas({number => $anvil->data->{loads}{processes}{total}}),
running => $anvil->Convert->add_commas({number => $anvil->data->{loads}{processes}{running}}),
blocked => $anvil->Convert->add_commas({number => $anvil->data->{loads}{processes}{blocked}}),
interrupts => $anvil->Convert->add_commas({number => $anvil->data->{loads}{interrupts}{total}}),
}});
$anvil->Get->load_average({debug => 3});
if ($detailed)
{
# Show the CPU load percents.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 1, key => "log_0840", variables => {
iowait => $anvil->data->{loads}{load_percent}{iowait},
user => $anvil->data->{loads}{load_percent}{user},
steal => $anvil->data->{loads}{load_percent}{steal},
idle => $anvil->data->{loads}{load_percent}{idle},
nice => $anvil->data->{loads}{load_percent}{nice},
'system' => $anvil->data->{loads}{load_percent}{'system'},
}});
# Show the CPU load levels
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 1, key => "log_0835", variables => {
one_minute => $anvil->data->{loads}{load_average}{one_minute},
five_minutes => $anvil->data->{loads}{load_average}{five_minute},
ten_minutes => $anvil->data->{loads}{load_average}{ten_minute},
}});
# Show the processes
my $key = $detailed ? "log_0841" : "log_0836";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 1, key => $key, variables => {
total => $anvil->Convert->add_commas({number => $anvil->data->{loads}{processes}{total}}),
running => $anvil->Convert->add_commas({number => $anvil->data->{loads}{processes}{running}}),
blocked => $anvil->Convert->add_commas({number => $anvil->data->{loads}{processes}{blocked}}),
interrupts => $anvil->Convert->add_commas({number => $anvil->data->{loads}{interrupts}{total}}),
}});
# CPU average load times
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 1, key => "log_0837", variables => {
io_wait => $anvil->Convert->add_commas({number => ($anvil->data->{loads}{cpu}{average}{io_wait} / 100)}),
@ -141,6 +141,18 @@ sub record_data
}});
}
}
else
{
# This is much more condensed.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 1, key => "log_0846", variables => {
one_minute => $anvil->data->{loads}{load_average}{one_minute},
five_minutes => $anvil->data->{loads}{load_average}{five_minute},
ten_minutes => $anvil->data->{loads}{load_average}{ten_minute},
iowait => $anvil->data->{loads}{load_percent}{iowait},
running => $anvil->Convert->add_commas({number => $anvil->data->{loads}{processes}{running}}),
blocked => $anvil->Convert->add_commas({number => $anvil->data->{loads}{processes}{blocked}}),
}});
}
return(0);
}

Loading…
Cancel
Save