changeed -s flag in monadd command to be consistent with other commands

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3759 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
linggao 2009-07-10 20:26:28 +00:00
parent e38a8fbe3c
commit 33aeb981c1
2 changed files with 21 additions and 11 deletions

View File

@ -22,7 +22,7 @@ This command is used to register a monitoring plug-in module to monitor the xCAT
I<name> is the name of the monitoring plug-in module. For example, if the the I<name> is called I<xxx>, then the actual file name that the xcatd looks for is I</opt/xcat/lib/perl/xCAT_monitoring/xxx.pm>. Use I<monls -a> command to list all the monitoring plug-in modules that can be used.
I<settings> is the monitoring plug-in specific settings. It is used to customize the behavior of the plug-in or configure the 3rd party software. Format: I<[key-value],[key=value]...> Please note that the square brackets are needed here. Use I<monls name -d> command to look for the possbile setting keys for a plug-in module.
I<settings> is the monitoring plug-in specific settings. It is used to customize the behavior of the plug-in or configure the 3rd party software. Format: I<-s key-value -s key=value ...> Please note that the square brackets are needed here. Use I<monls name -d> command to look for the possbile setting keys for a plug-in module.
=head1 OPTIONS
@ -31,7 +31,7 @@ B<-h | --help> Display usage message.
B<-n | --nodestatmon> Indicate that this monitoring plug-in will be used for feeding the node liveness status to the xCAT I<nodelist> table.
B<-s | --settings> Specifies the plug-in specific settings. These settings will be used by the plug-in to customize certain entities for the plug-in or the third party monitoring software. e.g. [mon_interval=10],[toggle=1].
B<-s | --settings> Specifies the plug-in specific settings. These settings will be used by the plug-in to customize certain entities for the plug-in or the third party monitoring software. e.g. -s mon_interval=10 -s toggle=1.
B<-v | --version > Command Version.
@ -60,7 +60,7 @@ This will also add the I<configrmcnode> to the I<postscripts> table. To view the
3. To register xcatmon plug-in module to feed the node liveness status to xCAT's I<nodelist> table, enter:
monaddt rmcmon -n -s [ping-interval=2]
monaddt rmcmon -n -s ping-interval=2
where 2 is the number of minutes between the pings.

View File

@ -849,10 +849,10 @@ sub monadd {
$rsp->{data}->[3]= " name is the name of the monitoring plug-in module to be added.";
$rsp->{data}->[4]= " Use 'monls -a' command to list all the monitoring plug-in names.";
$rsp->{data}->[5]= " settings is used by the monitoring plug-in to customize its behavior.";
$rsp->{data}->[6]= " Format: [key1=value1],[key2=value2]... ";
$rsp->{data}->[6]= " Format: -s key1=value1 -s key2=value2 ... ";
$rsp->{data}->[7]= " Please note that the square brackets are needed. ";
$rsp->{data}->[7]= " Use 'monls name -d' command to look for the possible settings for a plug-in.";
$rsp->{data}->[8]= " Example: monadd xcatmon -n -s [ping-interval=10]";
$rsp->{data}->[8]= " Example: monadd xcatmon -n -s ping-interval=10";
$cb->($rsp);
}
@ -865,7 +865,7 @@ sub monadd {
'h|help' => \$::HELP,
'v|version' => \$::VERSION,
'n|nodestatmon' => \$::NODESTATMON,
's|settings=s' => \$settings))
's|settings=s@' => \$settings))
{
&monadd_usage($callback);
return 1;
@ -952,11 +952,21 @@ sub monadd {
my $table1=xCAT::Table->new("monsetting", -create => 1,-autocommit => 1);
my %key_col1 = (name=>$pname);
#parse the settings. Setting format: key="value",key="value"....
while ($settings =~ s/^\[([^\[\]\=]*)=([^\[\]]*)\](,)*//) {
$key_col1{key}=$1;
my %setting_hash=();
$setting_hash{value}=$2;
$table1->setAttribs(\%key_col1, \%setting_hash);
foreach (@$settings) {
if (/^\[(.*)\]$/) { #backward compatible
while (s/^\[([^\[\]\=]*)=([^\[\]]*)\](,)*//) {
$key_col1{key}=$1;
my %setting_hash=();
$setting_hash{value}=$2;
$table1->setAttribs(\%key_col1, \%setting_hash);
}
} else {
/^([^\=]*)=(.*)/;
$key_col1{key}=$1;
my %setting_hash=();
$setting_hash{value}=$2;
$table1->setAttribs(\%key_col1, \%setting_hash);
}
}
$table1->close();
}