add small help and manpage for marsadm, mars-status

This commit is contained in:
jmann 2012-04-10 18:52:25 +02:00 committed by Thomas Schoebel-Theuer
parent 994eb28e42
commit 1bfe46ee1a
4 changed files with 235 additions and 16 deletions

28
userspace/mars-status.pl → userspace/mars-status Executable file → Normal file
View File

@ -1,7 +1,8 @@
#!/usr/bin/perl -w
# (c) 2012 Joerg Mann / 1&1 Internet AG
#
# $Id: 93258bf9e072ff1d16807a2885dfc9c9714e8cfb $
# last update at Thu Mar 8 17:53:37 CET 2012 by joerg.mann@1und1.de
# $Id: 1cfc331c2f2dbd3c929c666e4fcc518f78b38c73 $
# last update at Tue Apr 10 17:20:32 CEST 2012 by joerg.mann@1und1.de
# TODO:
# check deutsch/englich
@ -19,7 +20,7 @@ use Date::Language;
use POSIX qw(strftime);
### defaults
my $version = "0.067s";
my $version = "0.067t";
my $alife_timeout = "99"; # sec
my $is_tty = 0;
my $mars_dir = '/mars';
@ -31,11 +32,20 @@ chomp $himself;
### ARGV
# Optionen in Hash-Ref parsen
my $params = {};
GetOptions( $params, 'help', 'resource=s', 'interval=i', 'help', 'long', 'history', 'debug' );
GetOptions( $params, 'help', 'h', 'version', 'v', 'resource=s', 'interval=i', 'long', 'history', 'debug' );
if($params->{help}) {
print "Usage: $0 [--help]\n";
print "Usage: $0 [--resource <RESNAME>] [--interval <seconds>] [--long [--history] [--debug]]\n";
if($params->{help} || $params->{h}) {
print "Usage: mars-status [--help]\n";
print "Usage: mars-status [--version]\n";
print "Usage: mars-status (without specification of parameters, an abstract of all the informations spent)\n";
print "Usage: mars-status [--resource <RESNAME>] [--interval <seconds>] [--long [--history] [--debug]]\n";
print " --resource : limits the display to the specified resource\n";
print " --interval : refreshes the display every second xxx\n";
print " --long : displays more detailed information\n";
print " --history : shows information about the log files, version numbers and their status\n";
print " --debug : additional display error messages and warnings to internal\n";
print " --monitor : indicator to use for monitoring (not available)\n";
print "\nAdvanced information are also available here: http://http://wiki.intranet.1and1.com/bin/view/PO/ProjektTEC1603\n";
exit;
}
@ -486,6 +496,10 @@ while(1) {
print "-------------------------------------------------------------------------------\n";
if($params->{version} || $params->{v}) {
exit 0;
}
#########################################################################################
### check load-limit
check_avg_limit;

69
userspace/mars-status.8 Normal file
View File

@ -0,0 +1,69 @@
.TH mars-status 8 "April 10, 2012" "" "Mars Admin"
.SH NAME
mars-status \- program to display status information from mars
.SH SYNOPSIS
.B "mars-status \-? \-h \-help"
.br
.B "mars-status \-v \-\-version "
.br
.B "mars-status [--resource <RESNAME>] [--interval <seconds>] [--long [--history] [--debug]]"
.br
.br
(See the OPTIONS section for alternate option syntax with long option names.)
.SH DESCRIPTION
This manual page explains the
.B mars-status
program. This program is used to display information from the Mars clusters, whose resources and the logfiles with its versions.
.SH OPTIONS
.SS "Generic Program Information"
.TP
.B \-h ", " \-\^\-help
Print a usage message briefly summarizing these command-line options and the bug-reporting address, then exit.
.TP
.BR \-V ", " \-\^\-version
Print the version number of
.B marsadm
This version number should be included in all bug reports (see below).
.SS "Display Options"
.TP
.BR without " " options
.B mars-status
display short summary of all informations of all resources on Cluster.
.TP
.BR resource " " RESNAME
Limits the display to the specified resource.
.TP
.BR interval " " seconds
Refreshes the display every second xxx.
.TP
.BR long
Displays more detailed information.
.TP
.BR long " " history
Shows information about the log files, version numbers and their status.
.TP
.BR debug
Additional display error messages and warnings to internal.
.TP
.BR monitor
Indicator to use for monitoring (not available).
.SH NOTES
Advanced information are also available here: http://http://wiki.intranet.1and1.com/bin/view/PO/ProjektTEC1603.
.SH BUGS
Problems and errors in the program are not known ;)

View File

@ -711,9 +711,38 @@ sub role_cmd {
}
}
sub helplist {
my $temp;
$temp = shift;
print "ERROR: $temp" if ($temp);
print "
marsadm command resource [option]
command for ...
- cluster : create-cluster join-cluster create-resource join-resource
- logfile : log-rotate log-delete log-delete-all
- device : attach detach connect disconnect connect-local disconnect-local up down
- resource : primary secondary invalidate-remote
- sync : pause-sync resume-sync pause-sync-local resume-sync-local fake-sync
- replay : pause-replay resume-replay pause-replay-local resume-replay-local
- internal : help version
resource = name of resource or [all] for all resources...
option = special by command
Advanced information are also available here: http://http://wiki.intranet.1and1.com/bin/view/PO/ProjektTEC1603
\n";
exit 0;
}
sub version {
print "$0 $Id\n";
print "my IP is $ip\n";
exit 0;
}
##################################################################
my %cmd_table =
(
# new keywords
@ -782,21 +811,22 @@ foreach my $arg (@ARGV) {
push @args, $arg;
}
my $cmd = shift @args || die "command argument is missing\n";
if($cmd eq "--version") {
print "$Id\n";
exit 0;
my $cmd = shift @args || helplist "command argument is missing\n";
if($cmd =~ m/^help$/ || $cmd =~ m/^h$/) {
helplist;
}
if($cmd =~ m/^version$/ || $cmd =~ m/^v$/) {
version;
}
die "only root may use this tool\n" if $< != 0; # getpid() seems to be missing in perlfunc
print "my IP is $ip\n";
die "unknown command '$cmd'\n" if !exists $cmd_table{$cmd};
helplist "unknown command $cmd\n" if !exists $cmd_table{$cmd};
my $res = "";
unless($cmd =~ m/^create-cluster$/) {
$res = shift @args || die "resource argument is missing\n";
$res = shift @args || helplist "resource argument is missing\n";
check_id($res);
}

106
userspace/marsadm.8 Normal file
View File

@ -0,0 +1,106 @@
.TH marsadm 8 "April 10, 2012" "" "Mars Admin"
.SH NAME
marsadm \- program for management of mars resources
.SH SYNOPSIS
.B "marsadm \-? \-h \-help"
.br
.B "marsadm \-v \-\-version "
.br
.B "marsadm command ressource [option]"
.br
.br
(See the COMMAND section for alternate option syntax with long option names.)
.SH DESCRIPTION
This manual page explains the
.B marsadm
program. This program is for management of mars cluster, resources, logfiles and informations.
.SH COMMANDS
.SS "Generic Program Information"
.TP
.B \-h ", " \-\^\-help
Print a usage message briefly summarizing these command-line options and the bug-reporting address, then exit.
.TP
.BR \-V ", " \-\^\-version
Print the version number of
.B marsadm
This version number should be included in all bug reports (see below).
.SS "Cluster Selection"
.TP
.BR create-cluster ", " join-cluster
Information for this command are not currently on disposal.
.TP
.BR create-resource ", " join-resource
Information for this command are not currently on disposal.
.SS "Logfile Selection"
.TP
.BR log-rotate
This command can rotate the logfiles to the next version. Note that this command affects all systems, the resource in the cluster are connected.
.TP
.BR log-delete ", " log-delete-all
With this command, the next unneeded logfile is deleted, respectively unneeded logfiles are deleted. Note that this command affects all systems, the resource in the cluster are connected.
.SS "Device Selection"
.TP
.BR attach ", " detach
Information for this command are not currently on disposal.
.TP
.BR connect ", " disconnect ", " connect-local ", " disconnect-local
Information for this command are not currently on disposal.
.TP
.BR up ", " down
Information for this command are not currently on disposal.
.SS "Resources Selection"
.TP
.BR primary ", " secondary
Information for this command are not currently on disposal.
.TP
.BR invalidate-remote
Information for this command are not currently on disposal.
.SS "Sync Selection"
.TP
.BR pause-sync ", " pause-sync-local
Stop the Sync-Process respectively only of the local system.
.TP
.BR resume-sync ", " resume-sync-local
Start the Sync-Process respectively only of the local system.
.TP
.BR fake-sync
Information for this command are not currently on disposal.
.SS "Replay Selection"
.TP
.BR pause-replay ", " pause-replay-local
Stop the Replay-Process respectively only of the local system.
.TP
.BR resume-replay ", " resume-replay-local
Start the Replay-Process respectively only of the local system.
.SH RESSOURCE
.TP
.B resource = name of resource or [all] for all resources...
.SH OPTION
.B
.IP option = special by command
.SH NOTES
Advanced information are also available here: http://http://wiki.intranet.1and1.com/bin/view/PO/ProjektTEC1603.
.SH BUGS
Problems and errors in the program are not known ;)