Created
January 19, 2013 00:17
-
-
Save pol/4569787 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| getstats="/usr/share/cacti/site/scripts/getd2lstats.pl" | |
| logfile="/var/log/syslog" | |
| grep slapd /var/log/syslog | perl ${getstats} | sort | uniq -c | xargs | while read a b c d; do printf "$b:$a $d:$c"; done; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/perl | |
| while(<>) | |
| { | |
| s/ds(\d) .*: conn=/conn=$1/; | |
| m/conn=(\d+) \w.+ ACCEPT from IP=(\S+):\d+ /; | |
| $h{$1}=$2 if $1; | |
| if(/filter/) | |
| { | |
| m/conn=(\d+)/; | |
| $conn = $1; | |
| s/$conn/$h{$conn}/; | |
| if(/204.92/ && !/object/) | |
| { | |
| m/uid=(.*)/; | |
| $id = $1; | |
| $id =~ /\./ ? print "firstlast\n" : print "netid\n"; | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| user@server:/usr/share/cacti/site/scripts$ grep slapd /var/log/syslog | head | |
| Jan 18 06:50:32 ds.sanitized.edu slapd2.4[3112]: conn=50858 fd=104 ACCEPT from IP=san.iti.zed.62:44637 (IP=0.0.0.0:389) | |
| Jan 18 06:50:32 ds slapd2.4[3112]: conn=50858 op=0 BIND dn="cn=d2ladmin,dc=sanitized,dc=edu" method=128 | |
| Jan 18 06:50:32 ds1 slapd2.4[3112]: conn=50858 op=0 BIND dn="cn=d2ladmin,dc=sanitized,dc=edu" mech=SIMPLE ssf=0 | |
| Jan 18 06:50:32 ds.sanitized.edu slapd2.4[3112]: conn=50858 op=0 RESULT tag=97 err=0 text= | |
| Jan 18 06:50:32 ds.sanitized.edu slapd2.4[3112]: conn=50858 op=1 SRCH base="ou=people,dc=sanitized,dc=edu" scope=2 deref=0 filter="(uid=last-update)" | |
| Jan 18 06:50:32 ds slapd2.4[3112]: conn=50858 op=1 SRCH attr=cn | |
| Jan 18 06:50:32 ds slapd2.4[3112]: conn=50858 op=1 SEARCH RESULT tag=101 err=0 nentries=1 text= | |
| Jan 18 06:50:32 ds1 slapd2.4[3112]: conn=50858 op=2 UNBIND | |
| Jan 18 06:50:32 ds.sanitized.edu slapd2.4[3112]: conn=50858 fd=104 closed | |
| Jan 18 06:51:18 ds1 slapd2.4[3112]: conn=50859 fd=104 ACCEPT from IP=san.iti.zed.8:35122 (IP=0.0.0.0:389) | |
| user@server:/usr/share/cacti/site/scripts$ grep slapd /var/log/syslog | perl getd2lstats.pl | |
| user@server:/usr/share/cacti/site/scripts$ | |
| # NO OUTPUT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment