Changes from Version 1 of plugin-mysql_status_

Show
Ignore:
Author:
anonymous (IP: 65.57.245.11)
Timestamp:
06/28/06 08:51:15 (4 years ago)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • plugin-mysql_status_

    v0 v1  
     1{{{ 
     2#!/usr/bin/perl 
     3 
     4use strict; 
     5use warnings; 
     6 
     7use File::Basename; 
     8 
     9my $variable = basename $0; 
     10$variable =~ s/^mysql_status_//; 
     11$variable or die "no variable"; 
     12 
     13if ($ARGV[0] && $ARGV[0] eq 'config') { 
     14   print <<END; 
     15graph_title MySQL $variable 
     16graph_vlabel $variable 
     17$variable.label $variable 
     18END 
     19 
     20   exit; 
     21} 
     22 
     23open(MYSQL, '/usr/bin/mysqladmin extended-status |') or die $!; 
     24 
     25while (<MYSQL>) { 
     26   my (undef, $name, undef, $value) = split; 
     27 
     28   if ($name && $value && lc $name eq $variable) { 
     29      printf("%s.value %d\n", $variable, $value); 
     30      exit; 
     31   } 
     32} 
     33}}}