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
====================
- 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.
(thanks to Bryan Guidroz, bryanguidroz AT hotmail.com for pointing this out)

View File

@ -303,13 +303,25 @@ sub squid_update {
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";
open(IN, "$squid->{cmd} mgr:mem |");
open(IN, "$squid->{cmd} mgr:info |");
my $memory_section = 0;
while(<IN>) {
if(/^Total /) {
(undef, undef, $m_alloc, undef, undef, undef, undef, $m_inuse) = split(' ', $_);
chomp($m_alloc);
chomp($m_inuse);
last;
if(/^Memory usage for squid via mallinfo/) {
$memory_section = 1;
next;
}
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);