Changed the source from where the memory usage is collected in the 'squid' graph

This commit is contained in:
Jordi Sanfeliu 2013-05-15 10:36:23 +02:00
parent f93c2b5afd
commit 1c9cc26e8e
2 changed files with 20 additions and 6 deletions

View File

@ -1,5 +1,7 @@
3.N.N - NN.XXX-2013 3.N.N - NN.XXX-2013
==================== ====================
- Changed the source from where the memory usage is collected in the 'squid'
graph. Now the values shown are more real and accurate.
- Fixed a bug that prevented seeing the Core temperatures in the 'lmsens' graph. - Fixed a bug that prevented seeing the Core temperatures in the 'lmsens' graph.
(thanks to Bryan Guidroz, bryanguidroz AT hotmail.com for pointing this out) (thanks to Bryan Guidroz, bryanguidroz AT hotmail.com for pointing this out)

View File

@ -303,13 +303,25 @@ sub squid_update {
close(IN); close(IN);
$rrdata .= ":$rq_client_http_req:$rq_client_http_hit:$rq_server_http_req:$rq_server_ftp_req:$rq_server_other_req:$rq_aborted_req:$rq_swap_files_cleaned:$rq_unlink_requests:0"; $rrdata .= ":$rq_client_http_req:$rq_client_http_hit:$rq_server_http_req:$rq_server_ftp_req:$rq_server_other_req:$rq_aborted_req:$rq_swap_files_cleaned:$rq_unlink_requests:0";
open(IN, "$squid->{cmd} mgr:mem |"); open(IN, "$squid->{cmd} mgr:info |");
my $memory_section = 0;
while(<IN>) { while(<IN>) {
if(/^Total /) { if(/^Memory usage for squid via mallinfo/) {
(undef, undef, $m_alloc, undef, undef, undef, undef, $m_inuse) = split(' ', $_); $memory_section = 1;
chomp($m_alloc); next;
chomp($m_inuse); }
last; if($memory_section) {
if(/^\tTotal in use:\s+(\d+) KB/) {
$m_inuse = $1;
chomp($m_inuse);
next;
}
if(/^\tTotal size:\s+(\d+) KB/) {
$m_alloc = $1;
chomp($m_alloc);
$memory_section = 0;
last;
}
} }
} }
close(IN); close(IN);