70 lines
1.5 KiB
Perl
70 lines
1.5 KiB
Perl
#!/usr/bin/env perl
|
|
|
|
use XML::Simple;
|
|
use Data::Dumper;
|
|
|
|
die unless $stat = `/usr/bin/varnishstat -x`;
|
|
|
|
# create object
|
|
$xml = new XML::Simple();
|
|
|
|
# read XML file
|
|
$data = $xml->XMLin($stat);
|
|
#print Dumper($data);
|
|
|
|
print "<<<app-varnish>>>\n";
|
|
|
|
|
|
######################
|
|
### Backend Statistics
|
|
|
|
# backend_conn / Backend conn. requests
|
|
print "$data->{stat}->{backend_req}->{value};";
|
|
|
|
# backend_unhealthy / Backend conn. not attempted
|
|
print "$data->{stat}->{backend_unhealthy}->{value};";
|
|
|
|
# backend_busy / Backend conn. too many
|
|
print "$data->{stat}->{backend_busy}->{value};";
|
|
|
|
# backend_fail / Backend conn. failures
|
|
print "$data->{stat}->{backend_fail}->{value};";
|
|
|
|
# backend_reuse / Backend conn. reuses
|
|
print "$data->{stat}->{backend_reuse}->{value};";
|
|
|
|
# backend_toolate / Backend conn. was closed
|
|
print "$data->{stat}->{backend_toolate}->{value};";
|
|
|
|
# backend_recycle / Backend conn. recycles
|
|
print "$data->{stat}->{backend_recycle}->{value};";
|
|
|
|
# backend_retry / Backend conn. retry
|
|
print "$data->{stat}->{backend_retry}->{value};";
|
|
|
|
|
|
####################
|
|
### Cache Statistics
|
|
|
|
# cache_hitpass / Cache hits for pass
|
|
print "$data->{stat}->{cache_hitpass}->{value};";
|
|
|
|
# cache_hit / Cache hits
|
|
print "$data->{stat}->{cache_hit}->{value};";
|
|
|
|
# cache_miss / Cache misses
|
|
print "$data->{stat}->{cache_miss}->{value};";
|
|
|
|
|
|
##################
|
|
### LRU Statistics
|
|
|
|
# n_lru_nuked / N LRU nuked objects
|
|
print "$data->{stat}->{n_lru_nuked}->{value};";
|
|
|
|
# n_lru_moved / N LRU moved objects
|
|
print "$data->{stat}->{n_lru_moved}->{value};";
|
|
|
|
|
|
#EOF
|