more on syslog, updated pod for rspconfig

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1011 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
linggao 2008-04-09 19:34:43 +00:00
parent 444542fbc6
commit 1e56ecd504
4 changed files with 39 additions and 105 deletions

View File

@ -387,6 +387,7 @@ site => {
" ipmisdrcache\n".
" iscsidir\n".
" xcatservers (service nodes??)\n".
" svloglocal (logs on the service node stay local or not. 1 or 0)\n".
" dhcpinterfaces (network interfaces DHCP should listen on??)\n".
" forwarders (DNS forwarders??)\n".
" genpasswords (generate BMC passwords??)\n".

View File

@ -6,6 +6,8 @@ B<rspconfig> - remote power control of nodes
B<rspconfig> I<noderange> {B<alert>|B<snmpdest>|B<community>|B<garp>}
B<rspconfig> I<noderange> {B<ip>|B<netmask>|B<gateway>|B<backupgateway>}
B<rspconfig> I<noderange> B<alert>={B<on>|B<enable>|B<off>|B<disable>}
B<rspconfig> I<noderange> B<snmpdest>=I<snmpmanager-IP>
@ -29,17 +31,33 @@ specified, without the B<=>, it displays the current value.
Turn on or off SNMP alerts.
=item B<snmpdest>=I<snmpmanager-IP>
=item B<backupgateway>
Set where the SNMP alerts should be sent to.
Get the BMC backup gateway ip address.
=item B<community>={B<public>|I<string>}
Set the SNMP commmunity value.
Get or set the SNMP commmunity value. The default is I<public>.
=item B<garp>=I<time>
Set Gratuitous ARP generation interval. The unit is number of 1/2 second.
Get or set Gratuitous ARP generation interval. The unit is number of 1/2 second.
=item B<gateway>
Get the BMC gateway ip address.
=item B<ip>
Get the BMC ip address.
=item B<netmask>
Get the BMC subnet mask.
=item B<snmpdest>=I<snmpmanager-IP>
Get or set where the SNMP alerts should be sent to.
=item B<-h>|B<--help>

View File

@ -1,100 +0,0 @@
#!/usr/bin/env perl
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
#-------------------------------------------------------
package xCAT_plugin::ASYSLOGsn;
use xCAT::Table;
use xCAT::Utils;
use xCAT::MsgUtils;
use Getopt::Long;
#-------------------------------------------------------
=head1
xCAT plugin package to setup SYSLOG
#-------------------------------------------------------
=head3 handled_commands
Check to see if on a Service Node
Call setup_SYSLOG
=cut
#-------------------------------------------------------
sub handled_commands
{
my $rc = 0;
if (xCAT::Utils->isServiceNode())
{
my $service = "syslog";
# service needed on this Service Node
$rc = &setup_SYSLOG(); # setup SYSLOG
if ($rc == 0)
{
xCAT::Utils->update_xCATSN($service);
}
}
return $rc;
}
#-------------------------------------------------------
=head3 process_request
Process the command
=cut
#-------------------------------------------------------
sub process_request
{
return;
}
#-----------------------------------------------------------------------------
=head3 setup_SYSLOG
Sets up SYSLOG
=cut
#-----------------------------------------------------------------------------
sub setup_SYSLOG
{
my $rc = 0;
my $cmd;
if (-e "/etc/syslog.conf")
{
$cmd = "grep *.debug /etc/syslog.conf";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0)
{ # need to add
` echo "*.debug /var/log/messages" >> /etc/syslog.conf`;
`echo "*.crit /var/log/messages" >> /etc/syslog.conf`;
}
$cmd = "service syslog restart";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0)
{ # error try rsyslog
$cmd = "service rsyslog restart";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0)
{ # error on both
xCAT::MsgUtils->message("E",
"Error could not start syslog or rsyslog");
return 1;
}
}
}
return $rc;
}
1;

View File

@ -88,7 +88,22 @@ if (($ng) && (-e "/etc/xCATSN")) {
}
#now handling where the logs go
my $goLocal=0;
if (-e "/etc/xCATMN") {
$goLocal=1;
} elsif (-e "/etc/xCATSN") {
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
require "$::XCATROOT/lib/perl/xCAT/Table.pm";
my $sitetab = xCAT::Table->new('site');
if ($sitetab) {
(my $ref) = $sitetab->getAttribs({key => 'svloglocal'}, value);
if ($ref and $ref->{value}) {
if ($ref->{value} == 1) { $goLocal=1;}
}
}
}
if ($goLocal) {
#making sure all the messages goes to /var/log/messages
`touch /var/log/messages`; #log file must exist first
if (!$ng) {
@ -101,7 +116,7 @@ if (-e "/etc/xCATMN") {
`echo "*.debug;*.crit;*.err;*.warning /var/log/messages" >> $conf_file`;
}
}
} else {
} else {
#now make the syslogd fowarding the messages to the the master
if ($ng) {
if (! -f "$conf_file.XCATORIG") {