PATCH for dhcpd

Frank Crawford <[email protected]> Sun, 11 Sep 2016 21:06:25 +1000
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
Handle new messages from dhcpd shipped with Fedora 24 and probably
earlier.  This also adds extra information on IPv6 leases, although it
is still difficult to tie this back to the host, as we only have the
DUID.

Regards
Frank

------------------------------------------------------------------------------

_______________________________________________
Logwatch-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/logwatch-devel
dhcpd.patch (text/x-patch, 2.7 KB)
diff --git a/scripts/services/dhcpd b/scripts/services/dhcpd
index a018a88..e59d953 100755
--- a/scripts/services/dhcpd
+++ b/scripts/services/dhcpd
@@ -42,10 +42,13 @@ while (my $line = <STDIN>) {
       ($line =~ /^Please contribute if you find this software useful/) or
       ($line =~ /^For info, please visit/) or
       # Other lines to ignore
-      ($line =~ /^Wrote .* to leases file\./) or
+      ($line =~ /^Wrote .* to lease(s)? file\./) or
       ($line =~ /^already acking lease/) or
       ($line =~ /^dhcpd shutdown .*succeeded/) or
       ($line =~ /^dhcpd startup .*succeeded/) or
+      ($line =~ /^Server starting service\./) or
+      ($line =~ /^Source compiled to use binary-leases/) or
+      ($line =~ /^WARNING: authoring-byte-order not in the lease file/) or
       ($line =~ /^Sending on/) or
       ($line =~ /^Dynamic and static leases present for/) or
       # backup server pool balancing
@@ -70,11 +73,14 @@ while (my $line = <STDIN>) {
       ($line =~ /^Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file/) or
       ($line =~ /^Solicit message from/) or
       ($line =~ /^Sending Advertise to/) or
-      ($line =~ /^pool [0-9a-f]+ /)
+      ($line =~ /^pool [0-9a-f]+ /) or
+      ($line =~ /^[^ ]* file: /)
       ) {
       # Ignore these lines
    } elsif ($line =~ s/Listening on\s+//) {
       $data{'DHCP Server Listening On'}{$line}++;
+   } elsif ($line =~ s/Bound to\s+//) {
+      $data{'DHCP Server Listening On'}{$line}++;
    } elsif (
       ($line =~ /^you want, please write a subnet declaration/) or
       ($line =~ /^in your dhcpd.conf file for the network segment/) or
@@ -121,6 +127,8 @@ while (my $line = <STDIN>) {
       $data{'Config error'}{$line}++;
    } elsif ($line =~ s/Not searching LDAP\s+.*$/No support for LDAP configured/) {
       $data{'Config error'}{$line}++;
+   } elsif ($line =~ s/^ldap_gssapi_principal is not set,//) {
+      $data{'Config error'}{$line}++;
    } elsif ($line =~ s/^DHCPOFFER on ([\d\.]+) to ([a-f\d:]+) via (\S+)\s*$/$1 -> $2 ($3)/) {
       if ($Detail >= 5) {
          $data{'Addresses Leased'}{$line}++;
@@ -153,6 +161,8 @@ while (my $line = <STDIN>) {
       } elsif (($Detail >= 10) and ($clientrequest =~ /Rebind|Renew/)) {
          $data{"Addresses $clientrequest"}{$line}++;
       }
+   } elsif ($line =~ s/^(Advertise|Reply) ([TN]A): address ([0-9a-fA-F:]+) to client with duid ([0-9a-fA-F:]+) iaid = [-\d]+( static)?/$3 ($2$5) -> DUID $4/) {
+         $data{"Addresses $1"}{$line}++;
    } elsif ($line =~ /^Client ([0-9a-fA-F:]+) releases address ([0-9a-fA-F:]+), which is not leased to it.$/) {
       if ($Detail >= 5) {
          $data{'Warnings'}{$line}++;