CVS: ispman/bin ispman.sitereport,NONE,1.1

Atif Ghaffar <[email protected]>
Newsgroups gmane.comp.isp.ispman.cvs
Message-ID <[email protected]>
Update of /cvsroot/ispman/ispman/bin
In directory sc8-pr-cvs1:/tmp/cvs-serv2830

Added Files:
	ispman.sitereport 
Log Message:
ispman.sitereport by Will Cooley.

This needs to be tested on HEAD and 1.0 and then enhanced perhaps with information about resellers, clients etc




--- NEW FILE ---
#!/usr/bin/perl
#
# File:         ispman.sitereport
#
# Author:       Wil Cooley <[email protected]>
#
# Description:  This script generates a full site report of
#               all domains and users.
#

BEGIN {
    use FindBin;
    unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
}

use ISPMan;
use strict;

my $cnt_dom = 0 ;
my (%customers, %owners, %status, %types) ;
my $ispman=ISPMan->new() || die "Unable to create ISPMan instance";

my $domains=$ispman->getDomains() ;

foreach my $key (sort keys %{$domains}) {
    $cnt_dom++ ;

    my $entry = $ispman->getEntryAsHashRef($domains->{$key}) || 
        print STDERR "Unable to get entry for $key!" ;

    $entry->{'ispmanDomainCustomer'} && 
        $customers{$entry->{'ispmanDomainCustomer'}}++ ;

    $entry->{'ispmanDomainOwner'} && 
        $owners{$entry->{'ispmanDomainOwner'}}++ ;

    $entry->{'ispmanDomainType'} &&
        $types{$entry->{'ispmanDomainType'}}++ ;

    $entry->{'ispmanStatus'} &&
        $status{$entry->{'ispmanStatus'}}++ ;

    print " *** $key ***\n" ;
    printf "Status:   %s\n", $entry->{'ispmanStatus'} ;
    printf "Type:     %s\n", $entry->{'ispmanDomainType'} ;
    printf "Customer: %s\n", $entry->{'ispmanDomainCustomer'} ;
    printf "Owner:    %s\n", $entry->{'ispmanDomainOwner'} ;
    printf "Users:    %s\n", $ispman->getUserCount($key) ;
    printf "Vhosts:   %s\n", $ispman->getVhostCount($key) ;

    print "\n" ;
}

print "\n     *** Site Totals ***\n" ;
printf "Users:     %4d\n", $ispman->getUsersCount() ;
printf "Domains:   %4d\n", $cnt_dom ;
printf "Vhosts:    %4d\n", $ispman->getVhostsCount() ;

print "\n     *** Customer Totals ***\n" ;

foreach my $cust (sort keys %customers) {
    printf "%40s %4d\n", $cust, $customers{$cust};
}

print "\n    *** Owner Totals ***\n" ;

foreach my $owner (sort keys %owners) {
    printf "%40s %4d\n", $owner, $owners{$owner};
}

print "\n    *** Status Totals ***\n" ;

foreach my $status (sort keys %status) {
    printf "%40s %4d\n", $status, $status{$status};
}

print "\n    *** Type Totals ***\n" ;

foreach my $type (sort keys %types) {
    printf "%40s %4d\n", $type, $types{$type};
}

#vim:expandtab tabstop=4 shiftwidth=4



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.