Changeset 3333

Show
Ignore:
Timestamp:
02/03/10 13:56:04 (2 years ago)
Author:
stabidlo
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plugins/node.d/snort_alerts.in

    r2970 r3333  
    11#!@@GOODSH@@ 
     2# -*- sh -*- 
    23 
    3 # Proof of concept snort plugin written by Edward Bjarte FjellskÃ¥l. 
     4: << =cut 
     5 
     6=head1 NAME 
     7 
     8snort_alerts - Plugin to monitor the number of alerts in Snort 
     9 
     10=head1 CONFIGURATION 
     11 
     12The following configuration variables are used by this plugin 
     13 
     14 [snort_alerts] 
     15  env.statsfile - Logfile to Snort's perfmonitor logfile 
     16  env.warning - Warning percentage 
     17  env.critical - Critical percentage 
     18 
     19=head2 DEFAULT CONFIGURATION 
     20 
     21 [snort_alerts] 
     22  env.statsfile=/var/snort/snort.stats 
     23 
     24=head1 AUTHORS 
     25 
     26Copyright (C) 2009 Edward Bjarte FjellskÃ¥l 
     27 
     28Copyright (C) 2010 Rado Rovny 
     29 
     30=head1 LICENSE 
     31 
     32GNU GPLv2 
     33 
     34=begin comment 
     35 
     36This program is free software; you can redistribute it and/or 
     37modify it under the terms of the GNU General Public License 
     38as published by the Free Software Foundation; version 2 dated June, 
     391991. 
     40 
     41This program is distributed in the hope that it will be useful, 
     42but WITHOUT ANY WARRANTY; without even the implied warranty of 
     43MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     44GNU General Public License for more details. 
     45 
     46You should have received a copy of the GNU General Public License 
     47along with this program; if not, write to the Free Software 
     48Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
     49 
     50=end comment 
     51 
     52=head1 MAGIC MARKERS 
     53 
     54  #%# family=auto 
     55  #%# capabilities=autoconf 
     56 
     57=cut 
     58 
     59EOF 
     60 
     61 
     62if [ -z $statsfile  ]; then 
     63        _target=/var/snort/snort.stats 
     64else 
     65        _target=$statsfile 
     66fi 
     67 
     68if [ "$1" = "autoconf" ]; then 
     69        if [ -f $_target ]; then 
     70                echo yes 
     71                exit 0 
     72        else 
     73                echo "no ($_target not readable)" 
     74                exit 1 
     75        fi 
     76fi 
    477 
    578if [ "$1" = "config" ]; then 
     
    881        echo 'graph_vlabel Alerts / second' 
    982        echo 'graph_scale no' 
    10         echo 'alerts.label Alerts /second' 
    11         #echo 'alerts.warning 10' 
    12         #echo 'alerts.critical 50' 
     83        echo 'alerts.label Alerts/second' 
     84        if [ -n $warning ]; then 
     85                echo 'alerts.warning $warning' 
     86        fi 
     87        if [ -n $critical ]; then 
     88                echo 'alerts.critical $critical' 
     89        fi 
     90        echo 'alerts.info The number of alerts per second' 
    1391        echo 'graph_category Snort' 
    1492 
     
    1795 
    1896echo -n "alerts.value " 
    19 echo $( tail -n1 /your/path/to/snort.stats| awk -F, '{ print $4 }') 
     97echo $(tail -n1 $_target| awk -F, '{ print $4 }') 
  • trunk/plugins/node.d/snort_bytes_pkt.in

    r2970 r3333  
    11#!@@GOODSH@@ 
     2# -*- sh -*- 
    23 
    3 # Proof of concept snort plugin written by Edward Bjarte FjellskÃ¥l. 
     4: << =cut 
     5 
     6=head1 NAME 
     7 
     8snort_bytes_pkt - Plugin to monitor average size in KBytes per packet 
     9 
     10=head1 CONFIGURATION 
     11 
     12The following configuration variables are used by this plugin 
     13 
     14 [snort_bytes_pkt] 
     15  env.statsfile - Logfile to Snort's perfmonitor logfile 
     16  env.warning - Warning percentage 
     17  env.critical - Critical percentage 
     18 
     19=head2 DEFAULT CONFIGURATION 
     20 
     21 [snort_bytes_pkt] 
     22  env.statsfile=/var/snort/snort.stats 
     23 
     24=head1 AUTHORS 
     25 
     26Copyright (C) 2009 Edward Bjarte FjellskÃ¥l 
     27 
     28Copyright (C) 2010 Rado Rovny 
     29 
     30=head1 LICENSE 
     31 
     32GNU GPLv2 
     33 
     34=begin comment 
     35 
     36This program is free software; you can redistribute it and/or 
     37modify it under the terms of the GNU General Public License 
     38as published by the Free Software Foundation; version 2 dated June, 
     391991. 
     40 
     41This program is distributed in the hope that it will be useful, 
     42but WITHOUT ANY WARRANTY; without even the implied warranty of 
     43MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     44GNU General Public License for more details. 
     45 
     46You should have received a copy of the GNU General Public License 
     47along with this program; if not, write to the Free Software 
     48Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
     49 
     50=end comment 
     51 
     52=head1 MAGIC MARKERS 
     53 
     54  #%# family=auto 
     55  #%# capabilities=autoconf 
     56 
     57=cut 
     58 
     59EOF 
     60 
     61 
     62if [ -z $statsfile  ]; then 
     63        _target=/var/snort/snort.stats 
     64else 
     65        _target=$statsfile 
     66fi 
     67 
     68if [ "$1" = "autoconf" ]; then 
     69        if [ -f $_target ]; then 
     70                echo yes 
     71                exit 0 
     72        else 
     73                echo "no ($_target not readable)" 
     74                exit 1 
     75        fi 
     76fi 
    477 
    578if [ "$1" = "config" ]; then 
     
    881        echo 'graph_vlabel KBytes / pkt' 
    982        echo 'graph_scale no' 
    10         echo 'bytespkt.label KBytes/pkt' 
    11         #echo 'bytespkt.warning 80' 
    12         #echo 'bytespkt.critical 92' 
     83        echo 'bytes_pkt.label KBytes/pkt' 
     84        if [ -n $warning ]; then 
     85                echo 'bytes_pkt.warning $warning' 
     86        fi 
     87        if [ -n $critical ]; then 
     88                echo 'bytes_pkt.critical $critical' 
     89        fi 
     90        echo 'bytes_pkt.info Average size per packet' 
    1391        echo 'graph_category Snort' 
    1492 
     
    1694fi 
    1795 
    18 echo -n "bytespkt.value " 
    19 echo $( tail -n1 /your/path/to/snort.stats| awk -F, '{ print $6 }') 
     96echo -n "bytes_pkt.value " 
     97echo $(tail -n1 $_target| awk -F, '{ print $6 }') 
  • trunk/plugins/node.d/snort_drop_rate.in

    r2970 r3333  
    11#!@@GOODSH@@ 
     2# -*- sh -*- 
    23 
    3 # Proof of concept snort plugin written by Edward Bjarte FjellskÃ¥l. 
     4: << =cut 
     5 
     6=head1 NAME 
     7 
     8snort_droprate - Plugin to monitor Snort packet drop rate 
     9 
     10=head1 CONFIGURATION 
     11 
     12The following configuration variables are used by this plugin 
     13 
     14 [snort_droprate] 
     15  env.statsfile - Logfile to Snort's perfmonitor logfile 
     16  env.warning - Warning percentage 
     17  env.critical - Critical percentage 
     18 
     19=head2 DEFAULT CONFIGURATION 
     20 
     21 [snort_drop_rate] 
     22  env.statsfile=/var/snort/snort.stats 
     23 
     24=head1 AUTHORS 
     25 
     26Copyright (C) 2009 Edward Bjarte FjellskÃ¥l 
     27 
     28Copyright (C) 2010 Rado Rovny 
     29 
     30=head1 LICENSE 
     31 
     32GNU GPLv2 
     33 
     34=begin comment 
     35 
     36This program is free software; you can redistribute it and/or 
     37modify it under the terms of the GNU General Public License 
     38as published by the Free Software Foundation; version 2 dated June, 
     391991. 
     40 
     41This program is distributed in the hope that it will be useful, 
     42but WITHOUT ANY WARRANTY; without even the implied warranty of 
     43MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     44GNU General Public License for more details. 
     45 
     46You should have received a copy of the GNU General Public License 
     47along with this program; if not, write to the Free Software 
     48Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
     49 
     50=end comment 
     51 
     52=head1 MAGIC MARKERS 
     53 
     54  #%# family=auto 
     55  #%# capabilities=autoconf 
     56 
     57=cut 
     58 
     59EOF 
     60 
     61 
     62if [ -z $statsfile  ]; then 
     63        _target=/var/snort/snort.stats 
     64else 
     65        _target=$statsfile 
     66fi 
     67 
     68if [ "$1" = "autoconf" ]; then 
     69        if [ -f $_target ]; then 
     70                echo yes 
     71                exit 0 
     72        else 
     73                echo "no ($_target not readable)" 
     74                exit 1 
     75        fi 
     76fi 
    477 
    578if [ "$1" = "config" ]; then 
     
    982        echo 'graph_scale no' 
    1083        echo 'droprate.label % percent' 
    11         # To tell Nagios  
    12         echo 'droprate.warning 1' 
    13         echo 'droprate.critical 2' 
     84        if [ -n $warning ]; then 
     85                echo 'droprate.warning $warning' 
     86        fi 
     87        if [ -n $critical ]; then 
     88                echo 'droprate.critical $critical' 
     89        fi 
     90        echo 'droprate.info Packet drop rate in %' 
    1491        echo 'graph_category Snort' 
    1592 
     
    1895 
    1996echo -n "droprate.value " 
    20 echo $( tail -n1 /your/path/to/snort.stats| awk -F, '{ print $2 }') 
     97echo $(tail -n1 $_target| awk -F, '{ print $2 }') 
  • trunk/plugins/node.d/snort_pattern_match.in

    r2970 r3333  
    11#!@@GOODSH@@ 
     2# -*- sh -*- 
    23 
    3 # Proof of concept snort plugin written by Edward Bjarte FjellskÃ¥l. 
     4: << =cut 
     5 
     6=head1 NAME 
     7 
     8snort_pattmatch - Plugin to monitor percent of data received that  
     9                   Snort processes in pattern matching. 
     10 
     11=head1 CONFIGURATION 
     12 
     13The following configuration variables are used by this plugin 
     14 
     15 [snort_pattern_match] 
     16  env.statsfile - Logfile to Snort's perfmonitor logfile 
     17  env.warning - Warning percentage 
     18  env.critical - Critical percentage 
     19 
     20=head2 DEFAULT CONFIGURATION 
     21 
     22 [snort_pattern_match] 
     23  env.statsfile=/var/snort/snort.stats 
     24 
     25=head1 AUTHORS 
     26 
     27Copyright (C) 2009 Edward Bjarte FjellskÃ¥l 
     28 
     29Copyright (C) 2010 Rado Rovny 
     30 
     31=head1 LICENSE 
     32 
     33GNU GPLv2 
     34 
     35=begin comment 
     36 
     37This program is free software; you can redistribute it and/or 
     38modify it under the terms of the GNU General Public License 
     39as published by the Free Software Foundation; version 2 dated June, 
     401991. 
     41 
     42This program is distributed in the hope that it will be useful, 
     43but WITHOUT ANY WARRANTY; without even the implied warranty of 
     44MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     45GNU General Public License for more details. 
     46 
     47You should have received a copy of the GNU General Public License 
     48along with this program; if not, write to the Free Software 
     49Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
     50 
     51=end comment 
     52 
     53=head1 MAGIC MARKERS 
     54 
     55  #%# family=auto 
     56  #%# capabilities=autoconf 
     57 
     58=cut 
     59 
     60EOF 
     61 
     62 
     63if [ -z $statsfile  ]; then 
     64        _target=/var/snort/snort.stats 
     65else 
     66        _target=$statsfile 
     67fi 
     68 
     69if [ "$1" = "autoconf" ]; then 
     70        if [ -f $_target ]; then 
     71                echo yes 
     72                exit 0 
     73        else 
     74                echo "no ($_target not readable)" 
     75                exit 1 
     76        fi 
     77fi 
    478 
    579if [ "$1" = "config" ]; then 
     
    983        echo 'graph_scale no' 
    1084        echo 'pattmatch.label % percent' 
    11         #For Nagios 
    12         #echo 'pattmatch.warning 14' 
    13         #echo 'pattmatch.critical 25' 
     85        if [ -n $warning ]; then 
     86                echo 'pattmatch.warning $warning' 
     87        fi 
     88        if [ -n $critical ]; then 
     89                echo 'pattmatch.critical $critical' 
     90        fi 
     91        echo 'pattmatch.info The percent of data received that Snort processes in pattern matching' 
    1492        echo 'graph_category Snort' 
    1593 
     
    1896 
    1997echo -n "pattmatch.value " 
    20 echo $( tail -n1 /your/path/to/snort.stats| awk -F, '{ print $7 }') 
     98echo $(tail -n1 $_target| awk -F, '{ print $7 }') 
  • trunk/plugins/node.d/snort_pkts.in

    r2970 r3333  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
     2# -*- sh -*- 
    23 
    3 # Proof of concept snort plugin written by Edward Bjarte FjellskÃ¥l. 
     4: << =cut 
     5 
     6=head1 NAME 
     7 
     8snort_pktsec - Plugin to monitor the number of packets per second  
     9               passed through Snort filters 
     10 
     11=head1 CONFIGURATION 
     12 
     13The following configuration variables are used by this plugin 
     14 
     15 [snort_pkts] 
     16  env.statsfile - Logfile to Snort's perfmonitor logfile 
     17  env.warning - Warning percentage 
     18  env.critical - Critical percentage 
     19 
     20=head2 DEFAULT CONFIGURATION 
     21 
     22 [snort_pkts] 
     23  env.statsfile=/var/snort/snort.stats 
     24 
     25=head1 AUTHORS 
     26 
     27Copyright (C) 2009 Edward Bjarte FjellskÃ¥l 
     28 
     29Copyright (C) 2010 Rado Rovny 
     30 
     31=head1 LICENSE 
     32 
     33GNU GPLv2 
     34 
     35=begin comment 
     36 
     37This program is free software; you can redistribute it and/or 
     38modify it under the terms of the GNU General Public License 
     39as published by the Free Software Foundation; version 2 dated June, 
     401991. 
     41 
     42This program is distributed in the hope that it will be useful, 
     43but WITHOUT ANY WARRANTY; without even the implied warranty of 
     44MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     45GNU General Public License for more details. 
     46 
     47You should have received a copy of the GNU General Public License 
     48along with this program; if not, write to the Free Software 
     49Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
     50 
     51=end comment 
     52 
     53=head1 MAGIC MARKERS 
     54 
     55  #%# family=auto 
     56  #%# capabilities=autoconf 
     57 
     58=cut 
     59 
     60EOF 
     61 
     62 
     63if [ -z $statsfile  ]; then 
     64        _target=/var/snort/snort.stats 
     65else 
     66        _target=$statsfile 
     67fi 
     68 
     69if [ "$1" = "autoconf" ]; then 
     70        if [ -f $_target ]; then 
     71                echo yes 
     72                exit 0 
     73        else 
     74                echo "no ($_target not readable)" 
     75                exit 1 
     76        fi 
     77fi 
    478 
    579if [ "$1" = "config" ]; then 
    680        echo 'graph_title Snort Avg packets/s' 
    781        echo 'graph_args --base 1000 -l 0' 
    8         echo 'graph_vlabel Packets / sec
     82        echo 'graph_vlabel Packets / second
    983        echo 'graph_scale no' 
    1084        echo 'pktsec.label Packets/second' 
    11         #echo 'pktsec.warning 80' 
    12         #echo 'pktsec.critical 92' 
     85        if [ -n $warning ]; then 
     86                echo 'pktsec.warning $warning' 
     87        fi 
     88        if [ -n $critical ]; then 
     89                echo 'pktsec.critical $critical' 
     90        fi 
     91        echo 'pktsec.info The number of packets per second' 
    1392        echo 'graph_category Snort' 
    1493 
     
    1796 
    1897echo -n "pktsec.value " 
    19 echo $( tail -n1 /your/path/to/snort.stats| awk -F, '{ print $5 }') \* 1000|bc -l 
     98echo $( tail -n1 $_target| awk -F, '{ print $5 }') \* 1000|bc -l 
  • trunk/plugins/node.d/snort_traffic.in

    r2970 r3333  
    11#!@@GOODSH@@ 
     2# -*- sh -*- 
    23 
    3 # Proof of concept snort plugin written by Edward Bjarte FjellskÃ¥l. 
     4: << =cut 
     5 
     6=head1 NAME 
     7 
     8snort_traffic - Plugin to monitor Snort traffic in Mbites per second 
     9 
     10=head1 CONFIGURATION 
     11 
     12The following configuration variables are used by this plugin 
     13 
     14 [snort_traffic] 
     15  env.statsfile - Logfile to Snort's perfmonitor logfile 
     16  env.warning - Warning percentage 
     17  env.critical - Critical percentage 
     18 
     19=head2 DEFAULT CONFIGURATION 
     20 
     21 [snort_traffic] 
     22  env.statsfile=/var/snort/snort.stats 
     23 
     24=head1 AUTHORS 
     25 
     26Copyright (C) 2009 Edward Bjarte FjellskÃ¥l 
     27 
     28Copyright (C) 2010 Rado Rovny 
     29 
     30=head1 LICENSE 
     31 
     32GNU GPLv2 
     33 
     34=begin comment 
     35 
     36This program is free software; you can redistribute it and/or 
     37modify it under the terms of the GNU General Public License 
     38as published by the Free Software Foundation; version 2 dated June, 
     391991. 
     40 
     41This program is distributed in the hope that it will be useful, 
     42but WITHOUT ANY WARRANTY; without even the implied warranty of 
     43MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     44GNU General Public License for more details. 
     45 
     46You should have received a copy of the GNU General Public License 
     47along with this program; if not, write to the Free Software 
     48Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
     49 
     50=end comment 
     51 
     52=head1 MAGIC MARKERS 
     53 
     54  #%# family=auto 
     55  #%# capabilities=autoconf 
     56 
     57=cut 
     58 
     59EOF 
     60 
     61 
     62if [ -z $statsfile  ]; then 
     63        _target=/var/snort/snort.stats 
     64else 
     65        _target=$statsfile 
     66fi 
     67 
     68if [ "$1" = "autoconf" ]; then 
     69        if [ -f $_target ]; then 
     70                echo yes 
     71                exit 0 
     72        else 
     73                echo "no ($_target not readable)" 
     74                exit 1 
     75        fi 
     76fi 
    477 
    578if [ "$1" = "config" ]; then 
     
    982        echo 'graph_scale no' 
    1083        echo 'traffic.label Mbits/second' 
     84        if [ -n $warning ]; then 
     85                echo 'traffic.warning $warning' 
     86        fi 
     87        if [ -n $critical ]; then 
     88                echo 'traffic.critical $critical' 
     89        fi 
     90        echo 'traffic.info Traffic in Mbites per second' 
    1191        echo 'graph_category Snort' 
    1292 
     
    1595 
    1696echo -n "traffic.value " 
    17 echo $( tail -n1 /your/path/to/snort.stats| awk -F, '{ print $3 }') 
     97echo $(tail -n1 $_target| awk -F, '{ print $3 }')