ASNMTAP
view release on metacpan or search on metacpan
lib/ASNMTAP/Asnmtap.pm view on Meta::CPAN
&_checkAccObjRef ( $_[0] ); &_checkSubArgs1;
if ( defined $_[1] or $_[0]->{_debug} ) {
use Data::Dumper;
print "\n". ref ($_[0]) .": Now we'll dump data\n\n", Dumper ( $_[0] ), "\n\n";
}
}
# Utility methods - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printRevision {
&_checkAccObjRef ( $_[0] ); &_checkSubArgs1;
print "\nThis is program: ", $_[0]->{_programName}, " (", $_[0]->{_programDescription}, ") v", $_[0]->{_programVersion}, "
Copyright (c) $COPYRIGHT ASNMTAP, Author: Alex Peeters [alex.peeters\@citap.be]
";
exit ( (ref $_[0]) =~ /^ASNMTAP::Asnmtap::Plugins/ ? $ERRORS{UNKNOWN} : 0 ) unless ( defined $_[1] );
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printUsage {
&_checkAccObjRef ( $_[0] ); &_checkSubArgs1;
print 'Usage: ', $_[0]->{_programName};
print (' ', $_[0]->{_programUsagePrefix}) if ( defined $_[0]->{_programUsagePrefix} );
print (' ', $_[0]->{_programUsageSuffix}) if ( defined $_[0]->{_programUsageSuffix} );
print "\n\n";
if ( defined $_[1] ) {
print ($_[1], "\n") unless ($_[1] eq '.');
exit ( (ref $_[0]) =~ /^ASNMTAP::Asnmtap::Plugins/ ? $ERRORS{UNKNOWN} : 0 );
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printHelp {
&_checkAccObjRef ( $_[0] ); &_checkSubArgs0;
$_[0]->printRevision(1);
$_[0]->printUsage();
print $_[0]->{_programHelpPrefix}, "\n" if ( defined $_[0]->{_programHelpPrefix} );
print $_[0]->{_programHelpSuffix}, "\n" if ( defined $_[0]->{_programHelpSuffix} );
print "Send email to $SENDEMAILTO if you have questions regarding\nuse of this software. To submit patches or suggest improvements, send\nemail to $SENDEMAILTO\n\n";
exit ( (ref $_[0]) =~ /^ASNMTAP::Asnmtap::Plugins/ ? $ERRORS{UNKNOWN} : 0 );
}
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
sub call_system {
&_checkAccObjRef ( $_[0] ); &_checkSubArgs1;
my ($stdout, $stderr);
if ( $CAPTUREOUTPUT ) {
use IO::CaptureOutput qw(capture_exec);
($stdout, $stderr) = capture_exec ( $_[1] );
chomp($stdout); chomp($stderr);
} else {
$stdout = $stderr = ''; system ( $_[1] );
}
my $exit_value = $? >> 8;
my $signal_num = $? & 127;
my $dumped_core = $? & 128;
my $status = ( $exit_value == 0 && $signal_num == 0 && $dumped_core == 0 && $stderr eq '' ) ? 1 : 0;
if ( $_[0]->{_debug} ) {
print ref $_[0], ": command : $_[1]\n",
ref $_[0], ": exit value : $exit_value\n",
ref $_[0], ": signal number: $signal_num\n",
ref $_[0], ": dumped core : $dumped_core\n",
ref $_[0], ": status : $status\n",
ref $_[0], ": stdout : '$stdout'\n",
ref $_[0], ": stderr : '$stderr'\n";
}
return ( $status, $stdout, $stderr );
}
# Destructor - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub DESTROY { print (ref ($_[0]), "::DESTROY: ()\n") if ( $_[0]->{_debug} ); }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
__END__
=head1 NAME
ASNMTAP::Asnmtap is an object-oriented Base Class to build modules that provides a nice object oriented interface for ASNMTAP.
=head1 SEE ALSO
ASNMTAP::Asnmtap::Applications, ASNMTAP::Asnmtap::Applications::CGI, ASNMTAP::Asnmtap::Applications::Collector, ASNMTAP::Asnmtap::Applications::Display
ASNMTAP::Asnmtap::Plugins, ASNMTAP::Asnmtap::Plugins::Nagios
=head1 AUTHOR
Alex Peeters [alex.peeters@citap.be]
=head1 COPYRIGHT NOTICE
(c) Copyright 2000-2011 by Alex Peeters [alex.peeters@citap.be],
All Rights Reserved.
ASNMTAP is based on 'Process System daemons v1.60.17-01', Alex Peeters [alex.peeters@citap.be]
Purpose: CronTab (CT, sysdCT),
Disk Filesystem monitoring (DF, sysdDF),
Intrusion Detection for FW-1 (ID, sysdID)
Process System daemons (PS, sysdPS),
Reachability of Remote Hosts on a network (RH, sysdRH),
Rotate Logfiles (system activity files) (RL),
Remote Socket monitoring (RS, sysdRS),
System Activity monitoring (SA, sysdSA).
'Process System daemons' is based on 'sysdaemon 1.60' written by Trans-Euro I.T Ltd
=head1 LICENSE
This ASNMTAP CPAN library and Plugin templates are free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The other parts of ASNMTAP may be used and modified free of charge by anyone so long as this copyright notice and the comments above remain intact. By using this code you agree to indemnify Alex Peeters from any liability that might arise from it's u...
Selling the code for this program without prior written consent is expressly forbidden. In other words, please ask first before you try and make money off of my program.
Obtain permission before redistributing this software over the Internet or in any other medium. In all cases copyright and header must remain intact.
=cut
( run in 1.149 second using v1.01-cache-2.11-cpan-99c4e6809bf )