Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Show locked Machines, Shares and Files from a Samba Server
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
Rübenrotze



Joined: 02 May 2005
Posts: 6

PostPosted: Sun May 08, 2005 2:51 pm    Post subject: Show locked Machines, Shares and Files from a Samba Server Reply with quote

I have written a little perl script for linux which graphs the locked machines, shares and files from a samba server in gauge mode.

the attachment includes a little install howto.


dirk



samba.png
 Description:
Graph
 Filesize:  4.87 KB
 Viewed:  11598 Time(s)

samba.png



samba.zip
 Description:
samba.pl
Graph Template
Install Howto

Download
 Filename:  samba.zip
 Filesize:  3.28 KB
 Downloaded:  1017 Time(s)

Back to top
sumsum
Cacti User


Joined: 26 Apr 2004
Posts: 60
Location: Switzerland

PostPosted: Sun May 08, 2005 5:09 pm    Post subject: Reply with quote

thanx for sharing your script

can't import the .XML file.
errormessage : Error: XML: Hash version does not exist.

what does that mean ?
which cacti version do you use for running that script ?
Back to top
Rübenrotze



Joined: 02 May 2005
Posts: 6

PostPosted: Sun May 08, 2005 6:57 pm    Post subject: Reply with quote

i use the latest stable version (0.8.6d)

http://forums.cacti.net/post-28880.html
it seems to be a version conflict
Back to top
jer00n



Joined: 02 Jun 2005
Posts: 8

PostPosted: Thu Jun 02, 2005 10:45 am    Post subject: grep: The -P option is not supported Reply with quote

Hi,

when I run that script, I get 3 errors:
grep: The -P option is not supported
grep: The -P option is not supported
grep: The -P option is not supported

something seems to be wrong with
grep -c -P '(\\d+)'`;

my grep version is 2.5.1.ds1-4

can you help me with this?

regards,

jeroen
Back to top
Rübenrotze



Joined: 02 May 2005
Posts: 6

PostPosted: Thu Jun 02, 2005 1:31 pm    Post subject: Reply with quote

the -P opion is for the perl regex >'(\\d+)'<, i think you have to install perl.

dirk
Back to top
jer00n



Joined: 02 Jun 2005
Posts: 8

PostPosted: Fri Jun 03, 2005 2:23 am    Post subject: grep: The -P option is not supported Reply with quote

hi,

I have perl installed:
>This is perl, v5.8.4 built for i386-linux-thread-multi

it was already installed.

any other ideas?

regards,

jeroen
Back to top
Rübenrotze



Joined: 02 May 2005
Posts: 6

PostPosted: Fri Jun 03, 2005 6:22 am    Post subject: Reply with quote

for this solution: no

but you can count all lines with grep (-c option) an than subtract the number of lines which are program outputs like version number, descriptions ...

dirk
Back to top
slebourdon



Joined: 08 Jul 2005
Posts: 2

PostPosted: Fri Jul 08, 2005 11:11 am    Post subject: Reply with quote

Tanks a lot for this script, it works fine with cacti 0.8.6f on SME Server 6.0.1-01.

Stephane
Back to top
rayel



Joined: 22 Aug 2005
Posts: 2

PostPosted: Mon Aug 22, 2005 6:57 pm    Post subject: Reply with quote

I modified the template to work with SNMP query. I Hope It helps somebody...

no problem with "grep: The -P option is not supported"

PS: I dont checked the results values.



samba.tar.gz
 Description:

Download
 Filename:  samba.tar.gz
 Filesize:  3.38 KB
 Downloaded:  692 Time(s)

Back to top
piccilli



Joined: 24 May 2005
Posts: 5

PostPosted: Mon Aug 29, 2005 2:27 pm    Post subject: Reply with quote

rayel wrote:
I modified the template to work with SNMP query. I Hope It helps somebody...

no problem with "grep: The -P option is not supported"

PS: I dont checked the results values.



Here snmpwalk works extremaly slow and my graphics continues empty.

time snmpwalk -v 1 -c public 10.100.0.252 .1.3.6.1.4.1.2021.55.1.101.1 -t 120
UCD-SNMP-MIB::ucdavis.55.1.101.1 = STRING: "340"

real 5m9.265s
user 0m0.041s
sys 0m0.010s



time snmpwalk -v 1 -c public 10.100.0.252 .1.3.6.1.4.1.2021.55.2.101.1 -t 120
UCD-SNMP-MIB::ucdavis.55.2.101.1 = STRING: "1689"

real 7m30.465s
user 0m0.046s
sys 0m0.003s


time snmpwalk -v 1 -c public 10.100.0.252 .1.3.6.1.4.1.2021.55.3.101.1 -t 120
UCD-SNMP-MIB::ucdavis.55.3.101.1 = STRING: "612"

real 0m0.132s
user 0m0.040s
sys 0m0.009s


why is smbstatus too slow here?
Back to top
rayel



Joined: 22 Aug 2005
Posts: 2

PostPosted: Wed Aug 31, 2005 9:16 pm    Post subject: Reply with quote

if you run smbstatus manually, it returns the values imediatelly?
Back to top
lanyao



Joined: 14 Dec 2005
Posts: 8

PostPosted: Tue Dec 27, 2005 12:51 am    Post subject: Reply with quote

rayel wrote:
I modified the template to work with SNMP query. I Hope It helps somebody...

no problem with "grep: The -P option is not supported"

PS: I dont checked the results values.


Hi, I think it's really very useful for me, but when I ran the script I got this messages:
# ./sambanew.pl
Use of uninitialized value in string eq at ./sambanew.pl line 9.
Use of uninitialized value in string eq at ./sambanew.pl line 9.
Use of uninitialized value in string eq at ./sambanew.pl line 9.
Use of uninitialized value in scalar chomp at ./sambanew.pl line 18.
Use of uninitialized value in string at ./sambanew.pl line 20.

Is there something wrong with my machine?
I can also get the output when run snmpwork from a remote server:
# snmpwalk -v 1 -c public 192.168.32.60 .1.3.6.1.4.1.2021.55.3.101.1
UCD-SNMP-MIB::ucdavis.55.3.101.1 = STRING: "Processes:11 Shares:12 Files:0"

but got no graph

My question: How can I get the samba status from a remote cacti server?
Back to top
gagadget
Cacti User


Joined: 21 Feb 2006
Posts: 64

PostPosted: Fri Sep 15, 2006 10:58 am    Post subject: Reply with quote

I was thinking somebody could be interested in a script not using grep at all :

Of course, adapt the paths to smbstatus.

Code:

/usr/local/bin/perl -w
###############################################################################
##
## local-samba-stats.pl
##
## Authors : Gael Jean
##
## Arguments : See help
##
################################################################################

use strict ;

################################################################################

my ( $status ) = eval { Main ( @ARGV ) || 0 } ;

if ( $@ ) {
        print STDERR $@ ;
        $status = 1 ;
}

exit $status ;

################################################################################

sub Main {

        my ( $files, $processes, $shares ) = 0 ;

        my $command = "/exploit/samba/bin/smbstatus -p" ;
        open ( OUTPUT, "$command |" ) || die "$!\n" ;

        # Parsing output
        foreach ( <OUTPUT> )
        {
                $processes++ if /^\d+/ ;
        }
        close ( OUTPUT ) ;

        my $command = "/exploit/samba/bin/smbstatus -S" ;
        open ( OUTPUT, "$command |" ) || die "$!\n" ;

        # Parsing output
        foreach ( <OUTPUT> )
        {
                $shares++ if /^[^\s]+\s+\d+/ ;
        }
        close ( OUTPUT ) ;

        my $command = "/exploit/samba/bin/smbstatus -L" ;
        open ( OUTPUT, "$command |" ) || die "$!\n" ;

        # Parsing output
        foreach ( <OUTPUT> )
        {
                $files++ if /^\d+/ ;
        }
        close ( OUTPUT ) ;

        # Print output
        print "processes:$processes shares:$shares files:$files" ;
        print "\n" ;

}



Regards.
Back to top
sllywhtboy



Joined: 09 Jul 2006
Posts: 29
Location: detroit'ish

PostPosted: Fri Mar 09, 2007 5:04 pm    Post subject: Reply with quote

if you replace "grep -c -P" with "grep -c -e" the first perl script works.
Back to top
nightwisher



Joined: 05 Sep 2008
Posts: 12
Location: Bosnia

PostPosted: Sun Nov 02, 2008 8:12 am    Post subject: Reply with quote

I try on gentoo 2008.0 to install !

But no graph ...

i use second modified template and folow instruction !

Need help



samba1.png
 Description:
 Filesize:  29.04 KB
 Viewed:  763 Time(s)

samba1.png


Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 



Powered by phpBB © 2001, 2005 phpBB Group