| Last change
                  on this file since 330 was
                  42,
                  checked in by presbrey, 19 years ago | 
        
          | scripts.mit.edu NOC graphing | 
        | File size:
            973 bytes | 
      
      
        
  | Rev | Line |  | 
|---|
| [42] | 1 | #!/usr/bin/perl | 
|---|
|  | 2 |  | 
|---|
|  | 3 | # File:    $Id: testentry.pl,v 1.4 2005/10/08 05:55:08 sauber Exp $ | 
|---|
|  | 4 | # Author:  (c) Soren Dossing, 2005 | 
|---|
|  | 5 | # License: OSI Artistic License | 
|---|
|  | 6 | #          http://www.opensource.org/licenses/artistic-license.php | 
|---|
|  | 7 |  | 
|---|
|  | 8 | # Modify this script to test map entries before inserting into real | 
|---|
|  | 9 | # map file. Run the script and check if the output is as expected. | 
|---|
|  | 10 |  | 
|---|
|  | 11 | use strict; | 
|---|
|  | 12 | no strict "subs"; | 
|---|
|  | 13 | use Data::Dumper; | 
|---|
|  | 14 | my @s; | 
|---|
|  | 15 |  | 
|---|
|  | 16 | # Insert servicesdescr, output and perfdata here as it appears in log file. | 
|---|
|  | 17 | # | 
|---|
|  | 18 | $_ = <<DATA; | 
|---|
|  | 19 | servicedescr:ping | 
|---|
|  | 20 | output:Total RX Bytes: 4058.14 MB, Total TX Bytes: 2697.28 MB<br>Average Traffic: 3.57 kB/s (0.0%) in, 4.92 kB/s (0.0%) out| inUsage=0.0,85,98 outUsage=0.0,85,98 | 
|---|
|  | 21 | perfdata: | 
|---|
|  | 22 | DATA | 
|---|
|  | 23 |  | 
|---|
|  | 24 | eval { | 
|---|
|  | 25 |  | 
|---|
|  | 26 | # Insert here a map entry to parse the nagios plugin data above. | 
|---|
|  | 27 | # | 
|---|
|  | 28 | /output:.*Average Traffic.*?([.\d]+) kB.+?([.\d]+) kB/ | 
|---|
|  | 29 | and push @s, [ rxbytes, | 
|---|
|  | 30 | [ in,  GAUGE, $1 ], | 
|---|
|  | 31 | [ out, GAUGE, $2 ] ]; | 
|---|
|  | 32 |  | 
|---|
|  | 33 | }; | 
|---|
|  | 34 |  | 
|---|
|  | 35 | print Data::Dumper->Dump([\@s], [qw(*s)]); | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.