FDS, SNMP & Cacti...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



HAWKER, Dan wrote:
> And another attempt...
>
> Have separated out the three files in the tarball as it seems my company
> filter was killing the perl script.
>
> To use, simply follow the Howto on the wiki, but you'll all need to rename
> *openldap_response_time.txt* to openldap_response_time.pl*. The other two
> files are as required.
>
> Thanks
> Dan
>   
Thank you!
http://directory.fedora.redhat.com/download/README.snmp-cacti
http://directory.fedora.redhat.com/download/openldap_response_time.pl
http://directory.fedora.redhat.com/download/cacti_host_template_fedora_directory_server.xml
> #####
>
> Hmmm, had a bounce back from this address. Will try it again and forward to
> the FDS list also...
>
> #####
>
> Hi Richard,
>
> As requested please find attached a tarball with my template and its
> accompanying perl script. If you can pop that onto the wiki so that I can
> link to it, that'd be great.
>
> Regarding a Howto:SNMPMonitoring, have rustled up a quick one on the wiki.
> Should be at http://directory.fedora.redhat.com/wiki/Howto:SNMPMonitoring
>
> Think its all there, but no doubt there will be ommissions and errors :)
>
> Thanks
>
> Dan
> --
>
> Dan Hawker
> Linux System Administrator
> Astrium
>
>   
> ------------------------------------------------------------------------
>
> #! /usr/bin/perl -w
>
> #====================================================================
> # What's this ?
> #====================================================================
> # Script designed for cacti [ http://www.cacti.net ]
> # Gives the time to do these LDAP operations :
> # - bind (anonymous or not)
> # - RootDSE base search
> # - suffix (found in RootDSE) sub search (20 entries max) 
> #
> # Copyright (C) 2005 Clement OUDOT
> # Copyright (C) 2005 LINAGORA
> #
> # 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
> #====================================================================
>
> #====================================================================
> # Modules
> #====================================================================
> use strict;
> use Net::LDAP;
> use Getopt::Std;
> use Time::HiRes qw(gettimeofday);
>
> #====================================================================
> # Configuration
> #====================================================================
> # Command line parameters
> my ($host, $port, $binddn, $bindpw, $timeout, $ldap_version) = &options;
>
> # Name of the Operations branch in monitor
> my $branch = "cn=Operations,cn=Monitor";
>
> #====================================================================
> # options() subroutine
> #====================================================================
> sub options {
> 	# Init Options Hash Table
> 	my %opts;
> 	getopt('hpDWtv',\%opts);
> 	&usage unless exists $opts{"h"};
> 	$opts{"p"} = 389 unless exists $opts{"p"};
> 	$opts{"t"} = 5 unless exists $opts{"t"};
> 	$opts{"v"} = 3 unless exists $opts{"v"};
>
> 	return ($opts{"h"}, $opts{"p"}, $opts{"D"}, $opts{"W"}, $opts{"t"}, $opts{"v"});
> }
>
> #====================================================================
> # usage() subroutine
> #====================================================================
> sub usage {
> 	print STDERR "Usage: $0 -h host [-p port] [-D binddn -W bindpw] [-t timeout] [-v ldap_version]\n";
> 	print STDERR "Default values are :\n";
> 	print STDERR "\tport: 389\n\tbinddn/bindpw: without (anonymous connection)\n\ttimeout: 5\n\tldap_version: 3\n";
> 	exit 1;
> }
>
> #====================================================================
> # Connection to OpenLDAP monitor
> #====================================================================
> # Create LDAP connection
> my $ldap = Net::LDAP->new(	$host, 
> 				port => $port,
> 				version => $ldap_version,
> 				timeout => $timeout) or die "Unable to connect to $host on port $port\n";
>
> # Bind (anonymous or no)
> my $bind_time = gettimeofday();
> my $bind;
>
> if ($binddn && $bindpw) {
> 	$bind = $ldap->bind($binddn, password => $bindpw);
> } else {
> 	$bind = $ldap->bind;
> }
>
> if ($bind->code) {
> 	print "bind:U rootdsesearch:U suffixsearch:U\n";
> 	print STDERR "Bind : ".$bind->error."\n";
> 	exit 1;
> }
> $bind_time = gettimeofday() - $bind_time;
>
> # RootDSE Search
> my $rootdsesearch_time = gettimeofday();
> my $search = $ldap->search( 	base => '',
> 				scope => 'base',
> 				filter => 'objectClass=*',
> 				attrs => ['namingContexts'],
> 				timelimit => "$timeout");
>
> if ($search->code) {
> 	print "bind:$bind_time rootdsesearch:U suffixsearch:U\n";
> 	$ldap->unbind;
> 	print STDERR "Root DSE search : ".$search->error." (code ".$search->code.")\n";
> 	exit 1 ;
> }
> $rootdsesearch_time = gettimeofday() - $rootdsesearch_time,
>
> # Suffix search
> my $suffix = ($search->shift_entry())->get_value('namingContexts');
> my $suffix_time = gettimeofday();
> my $suffix_search = $ldap->search(	base => "$suffix",
> 					scope => 'sub',
> 					filter => 'objectClass=*',
> 					attrs => ['1.1'],
> 					sizelimit => '20',
> 					timelimit => "$timeout");
>
> if ($suffix_search->code && $suffix_search->code != 4) {
> 	print "bind:$bind_time rootdsesearch:$rootdsesearch_time suffixsearch:U\n";
> 	$ldap->unbind;
> 	print STDERR "Suffix search : ".$suffix_search->error." (code ".$suffix_search->code.")\n";
> 	exit 1 ;
> }
> $suffix_time = gettimeofday() - $suffix_time,
>
> # Unbind
> $ldap->unbind;
>
> #====================================================================
> # Print results
> #====================================================================
> print "bind:$bind_time rootdsesearch:$rootdsesearch_time suffixsearch:$suffix_time\n";
>
> #====================================================================
> # Exit
> #====================================================================
> exit 0;
>   
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3245 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.fedoraproject.org/pipermail/389-users/attachments/20070109/91b8a381/attachment.bin 


[Index of Archives]     [Fedora User Discussion]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora News]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora QA]     [Fedora Triage]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Yosemite Photos]     [Linux Apps]     [Maemo Users]     [Gnome Users]     [KDE Users]     [Fedora Tools]     [Fedora Art]     [Fedora Docs]     [Maemo Users]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Fedora ARM]

  Powered by Linux