Sysop:Munin: Unterschied zwischen den Versionen

Aus immerda
Zur Navigation springen Zur Suche springen
Zeile 9: Zeile 9:


[[Category:ImmerdaDocumentationProject]]
[[Category:ImmerdaDocumentationProject]]
= things to look for =
* hostname, must be in the /etc/hosts file of the probe
* the label must be specified: echo 'softirq.label softirq'


= plugins =
= plugins =
Zeile 42: Zeile 46:
== tinydns ==
== tinydns ==
<pre>
<pre>
#!/usr/bin/perl -wT
#!/usr/bin/perl -T
 
# tinydns-munin-plugin +
#
# tinydns-munin-plugin
# Copyright (C) 2007 admin at immerda.ch
# Copyright (C) 2007 admin at immerda.ch
#
#
Zeile 55: Zeile 57:
# This program is distributed in the hope that it will be useful,
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


# with the HELP of
# with the HELP of
# tinygraph -- a RRDtool frontend for tinydns statistics
# tinygraph -- a RRDtool frontend for tinydns statistics
# Copyright (C) 2005   Ulrich Zehl <ulrich@topfen.net>
# Copyright (C) 2005 Ulrich Zehl <ulrich@topfen.net>
 
#use strict; # to activate ....


#use strict; # to activate ....
#use Time::TAI64 qw(tai2unix);


$A = 0;
$A = 0;
Zeile 92: Zeile 96:
     print "graph_title tinydns\n";
     print "graph_title tinydns\n";
     print "graph_args --base 1000 -l 0\n";
     print "graph_args --base 1000 -l 0\n";
    print "graph_category DNS\n";
        print "graph_category DNS\n";
        print "a.type COUNTER\n";
        print "mx.type COUNTER\n";
 
    print "a.label A\n";
        print "ns.label NS\n";
        print "cname.label CNAME\n";
        print "soa.label SOA\n";
        print "ptr.label PTR\n";
        print "mx.label MX\n";
        print "aaaa.label AAAA\n";
        print "any.label ANY\n";
        print "hinfo.label HINFO\n";
        print "txt.label TXT\n";
        print "rp.label RP\n";
        print "sig.label SIG\n";
        print "key.label KEY\n";
        print "a6.label A6\n";
        print "ixfr.label IXFR\n";
        print "axfr.label AXFR\n";
 
    print "a.type COUNTER\n";
        print "ns.type COUNTER\n";
        print "cname.type COUNTER\n";
        print "soa.type COUNTER\n";
        print "ptr.type COUNTER\n";
        print "mx.type COUNTER\n";
        print "aaaa.type COUNTER\n";
        print "any.type COUNTER\n";
        print "hinfo.type COUNTER\n";
        print "txt.type COUNTER\n";
        print "rp.type COUNTER\n";
        print "sig.type COUNTER\n";
        print "key.type COUNTER\n";
        print "a6.type COUNTER\n";
        print "ixfr.type COUNTER\n";
        print "axfr.type COUNTER\n";
     exit 0;
     exit 0;
}
}
Zeile 124: Zeile 164:
                 my $rtype  = $3;
                 my $rtype  = $3;
                 my $qtype  = $querytypes{$4};
                 my $qtype  = $querytypes{$4};
                #my $qstring = $5; # currently unused
                                #my $qstring = $5; # currently unused


                 if ($rtype eq '+')
                 if ($rtype eq '+')
                 {
                 {
                        if ($qtype eq 'A'){$A++;};
                                                if ($qtype eq 'A'){$A++;};
                        if ($qtype eq 'NS'){$NS++;};
                                                if ($qtype eq 'NS'){$NS++;};
                        if ($qtype eq 'CNAME'){$CNAME++;};
                                                if ($qtype eq 'CNAME'){$CNAME++;};
                        if ($qtype eq 'SOA'){$SOA++;};
                                                if ($qtype eq 'SOA'){$SOA++;};
                        if ($qtype eq 'PTR'){$PTR++;};
                                                if ($qtype eq 'PTR'){$PTR++;};
                        if ($qtype eq 'HINFO'){$HINFO++;};
                                                if ($qtype eq 'HINFO'){$HINFO++;};
                        if ($qtype eq 'MX'){$MX++;};
                                                if ($qtype eq 'MX'){$MX++;};
                        if ($qtype eq 'TXT'){$TXT++;};
                                                if ($qtype eq 'TXT'){$TXT++;};
                        if ($qtype eq 'RP'){$RP++;};
                                                if ($qtype eq 'RP'){$RP++;};
                        if ($qtype eq 'SIG'){$SIG++;};
                                                if ($qtype eq 'SIG'){$SIG++;};
                        if ($qtype eq 'KEY'){$KEY++;};
                                                if ($qtype eq 'KEY'){$KEY++;};
                        if ($qtype eq 'AAAA'){$AAAA++;};
                                                if ($qtype eq 'AAAA'){$AAAA++;};
                        if ($qtype eq 'A6'){$A6++;};
                                                if ($qtype eq 'A6'){$A6++;};
                        if ($qtype eq 'IXFR'){$IXFR++;};
                                                if ($qtype eq 'IXFR'){$IXFR++;};
                        if ($qtype eq 'AXFR'){$AXFR++;};
                                                if ($qtype eq 'AXFR'){$AXFR++;};
                        if ($qtype eq 'ANY'){$ANY++;};
                                                if ($qtype eq 'ANY'){$ANY++;};
                 }
                 }
         }
         }
Zeile 155: Zeile 195:
}
}


print "A.value $A\n";
print "a.value $A\n";
print "NS.value $NS\n";
print "ns.value $NS\n";
print "CNAME.value $CNAME\n";
print "cname.value $CNAME\n";
print "SOA.value $SOA\n";
print "soa.value $SOA\n";
print "PTR.value $PTR\n";
print "ptr.value $PTR\n";
print "MX.value $MX\n";
print "mx.value $MX\n";
print "AAAA.value $AAAA\n";
print "aaaa.value $AAAA\n";
print "ANY.value $ANY\n";
print "any.value $ANY\n";
print "HINFO.value $HINFO\n";
print "hinfo.value $HINFO\n";
print "TXT.value $TXT\n";
print "txt.value $TXT\n";
print "RP.value $RP\n";
print "rp.value $RP\n";
print "SIG.value $SIG\n";
print "sig.value $SIG\n";
print "KEY.value $KEY\n";
print "key.value $KEY\n";
print "A6.value $A6\n";
print "a6.value $A6\n";
print "IXFR.value $IXFR\n";
print "ixfr.value $IXFR\n";
print "AXFR.value $AXFR\n";
print "axfr.value $AXFR\n";
</pre>
</pre>

Version vom 6. März 2007, 00:35 Uhr

Links

Apropos Compilation

error in 1.2.4

you have to apply the following patch:

things to look for

  • hostname, must be in the /etc/hosts file of the probe
  • the label must be specified: echo 'softirq.label softirq'

plugins

selinux_enforced

#!/bin/sh
# -*- sh -*-
#
# Plugin to get the state of /selinux/enforced
#

if [ "$1" = "autoconf" ]; then
        echo yes
        exit 0
fi

if [ "$1" = "config" ]; then
        echo 'graph_title enforced amount'
        echo 'graph_args --upper-limit 1 -l 0 '
        echo 'graph_vlabel Is the system selinux enforced?'
        echo 'graph_scale no\n';
        echo 'graph_category selinux'
                echo 'enforced.label IsEnforced'
        #echo 'enforced.draw AREA'
                echo 'enforced.draw LINE2'

        exit 0
fi

echo -n "enforced.value " && cat /selinux/enforce

tinydns

#!/usr/bin/perl -T
# tinydns-munin-plugin  +
# Copyright (C) 2007 admin at immerda.ch
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

# with the HELP of
# tinygraph -- a RRDtool frontend for tinydns statistics
# Copyright (C) 2005 Ulrich Zehl <ulrich@topfen.net>

#use strict; # to activate ....

#use Time::TAI64 qw(tai2unix);

$A = 0;
$NS = 0;
$CNAME = 0;
$SOA = 0;
$PTR = 0;
$HINFO = 0;
$MX = 0;
$TXT = 0;
$RP = 0;
$SIG = 0;
$KEY = 0;
$AAAA = 0;
$A6 = 0;
$IXFR = 0;
$AXFR = 0;
$ANY = 0;

$logfile = $ENV{logdir} || "/var/tinydns/log/main/current";

if ( $ARGV[0] and $ARGV[0] eq "config" )
{
    print "host_name $ENV{FQDN}\n";
    print "graph_title tinydns\n";
    print "graph_args --base 1000 -l 0\n";
        print "graph_category DNS\n";
        print "a.type COUNTER\n";
        print "mx.type COUNTER\n";

    print "a.label A\n";
        print "ns.label NS\n";
        print "cname.label CNAME\n";
        print "soa.label SOA\n";
        print "ptr.label PTR\n";
        print "mx.label MX\n";
        print "aaaa.label AAAA\n";
        print "any.label ANY\n";
        print "hinfo.label HINFO\n";
        print "txt.label TXT\n";
        print "rp.label RP\n";
        print "sig.label SIG\n";
        print "key.label KEY\n";
        print "a6.label A6\n";
        print "ixfr.label IXFR\n";
        print "axfr.label AXFR\n";

    print "a.type COUNTER\n";
        print "ns.type COUNTER\n";
        print "cname.type COUNTER\n";
        print "soa.type COUNTER\n";
        print "ptr.type COUNTER\n";
        print "mx.type COUNTER\n";
        print "aaaa.type COUNTER\n";
        print "any.type COUNTER\n";
        print "hinfo.type COUNTER\n";
        print "txt.type COUNTER\n";
        print "rp.type COUNTER\n";
        print "sig.type COUNTER\n";
        print "key.type COUNTER\n";
        print "a6.type COUNTER\n";
        print "ixfr.type COUNTER\n";
        print "axfr.type COUNTER\n";
    exit 0;
}

my %querytypes = (
        '0001' => 'A',
        '0002' => 'NS',
        '0005' => 'CNAME',
        '0006' => 'SOA',
        '000c' => 'PTR',
        '000d' => 'HINFO',
        '000f' => 'MX',
        '0010' => 'TXT',
        '0011' => 'RP',
        '0018' => 'SIG',
        '0019' => 'KEY',
        '001c' => 'AAAA',
        '0026' => 'A6',
        '00fb' => 'IXFR',
        '00fc' => 'AXFR',
        '00ff' => 'ANY',
);

sub process_line($)
{
        my $line = shift;
        if ($line =~ /^(@[a-f0-9]{24}) ([a-f0-9]{8}):[a-f0-9]{4}:[a-f0-9]{4} ([\+\-IC\/]) ([a-f0-9]{4}) (.+)$/)
        {
                #my $time    = tai2unix($1);
                my $ip      = join(".", unpack("C*", pack("H8", $2)));
                my $rtype   = $3;
                my $qtype   = $querytypes{$4};
                                #my $qstring = $5; # currently unused

                if ($rtype eq '+')
                {
                                                 if ($qtype eq 'A'){$A++;};
                                                 if ($qtype eq 'NS'){$NS++;};
                                                 if ($qtype eq 'CNAME'){$CNAME++;};
                                                 if ($qtype eq 'SOA'){$SOA++;};
                                                 if ($qtype eq 'PTR'){$PTR++;};
                                                 if ($qtype eq 'HINFO'){$HINFO++;};
                                                 if ($qtype eq 'MX'){$MX++;};
                                                 if ($qtype eq 'TXT'){$TXT++;};
                                                 if ($qtype eq 'RP'){$RP++;};
                                                 if ($qtype eq 'SIG'){$SIG++;};
                                                 if ($qtype eq 'KEY'){$KEY++;};
                                                 if ($qtype eq 'AAAA'){$AAAA++;};
                                                 if ($qtype eq 'A6'){$A6++;};
                                                 if ($qtype eq 'IXFR'){$IXFR++;};
                                                 if ($qtype eq 'AXFR'){$AXFR++;};
                                                 if ($qtype eq 'ANY'){$ANY++;};
                }
        }
}

open(LOG, "<$logfile") or die "Error opening $logfile: $!";

while (<LOG>)
{
                        process_line($_);
}

print "a.value $A\n";
print "ns.value $NS\n";
print "cname.value $CNAME\n";
print "soa.value $SOA\n";
print "ptr.value $PTR\n";
print "mx.value $MX\n";
print "aaaa.value $AAAA\n";
print "any.value $ANY\n";
print "hinfo.value $HINFO\n";
print "txt.value $TXT\n";
print "rp.value $RP\n";
print "sig.value $SIG\n";
print "key.value $KEY\n";
print "a6.value $A6\n";
print "ixfr.value $IXFR\n";
print "axfr.value $AXFR\n";