JDK 1.6.0_43 64 Bit 無法使用 jvm snmp ,一定要使用檔案的方式宣告方可使用.
之前使用直寫的方式,在 java 32 Bit 的版本是沒問題的.
另外一個問題是 /etc/hosts 一定要將主機名稱寫入,要不然 jmx 是無法使用
-Djava.rmi.server.hostname=192.168.x.x 這個參數!
java snmp 以檔案方式宣告如下:
tomcat startup.sh
export JAVA_OPTS="-Xms1024m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=256m -Dcom.sun.management.config.file=/usr/local/tomcat/bin/snmp.properties -Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=192.168.x.x. -Dcom.sun.management.jmxremote.port=9012 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
[root@Test-Tomcat bin]# cat snmp.acl
acl = {
{
communities = public
access = read-only
managers = localhost
}
}
[root@Test-Tomcat bin]# cat snmp.properties
com.sun.management.snmp.interface=0.0.0.0
com.sun.management.snmp.port=1610
com.sun.management.snmp.acl=/usr/local/tomcat/bin/snmp.acl
直寫方式如下:
export JAVA_OPTS="="-Xms1024m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=256m -Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=192.168.xx.xx -Dcom.sun.management.jmxremote
.port=9012 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.managemen
t.snmp.port=1610 -Dcom.sun.management.snmp.acl.file=/tmp/snmp.acl -Dcom.sun.management.snmp.interface=0.0.0.0"
2013年3月26日 星期二
2013年3月15日 星期五
apache 整合 tomcat 的二種方式
tomcat-connectors
http://tomcat.apache.org/connectors-doc/
#wget http://www.apache.org/dist/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.37-src.tar.gz
#tar -zvxf tomcat-connectors-1.2.37-src.tar.gz
#cd tomcat-connectors-1.2.37-src/native
#./buildconf.sh
#./configure --with-apxs=/usr/sbin/apxs
#make
#make install
#vi workers.properties
#vi jk_mode.conf
#vi ssl.conf
#service httpd restart
jk_module
workers.properties
worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.connection_pool_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.socket_timeout=60
jk_mod.conf
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogFile /tmp/mod_jk.log
JkMount /test1/*.jsp worker1
JkMount /manager/* worker1
ssl.conf
.......
JkMount /test1/*.jsp worker1
JkMount /manager/* worker1
</VirtualHost>
Proxy_ajp
proxy_ajp.conf
LoadModule proxy_ajp_module
modules/mod_proxy_ajp.so
#
# When loaded, the mod_proxy_ajp module
adds support for
# proxying to an AJP/1.3 backend server
(such as Tomcat).
# To proxy to an AJP backend, use the
"ajp://" URI scheme;
# Tomcat is configured to listen on port
8009 for AJP requests
# by default.
# Uncomment the following lines to serve
the ROOT webapp
# under the /tomcat/ location, and the
jsp-examples webapp
# under the /examples/ location.
#
#ProxyPass /tomcat/ ajp://localhost:8009/
#ProxyPass /examples/
ajp://localhost:8009/jsp-examples/
ProxyPass /test1/ ajp://localhost:8009/test1/
ProxyPass /manager/
ajp://localhost:8009/manager/
2013年3月8日 星期五
使用 perl 做 scp 的二種方式
使用 perl 做 scp 的二種方式
#yum install libssh2-devel
#yum install libssh2
#yum install perl-Net-SSH2
#yum install perl-Net-SFTP
========================================================
#!/usr/bin/perl
use Net::SFTP;
$sftp = Net::SFTP->new('xxx.xxx.xxx.xxx',user=>'userID',password=>'userPWD');
$sftp->get("/xxx/xxx", "/xxx/xxx");
========================================================
#!/usr/bin/perl
@ip=qw
(
192.168.1.1
192.168.1.2
);
@host=qw
(
server1
server2
);
@list=qw
(
server1.txt
server1.txt
);
for ($x=0;$x<=$#ip;$x++) {
print " \n $x SCP IP : $ip[$x] HostName : $host[$x] DFCHK_File : $df[$x] \n";
sshget();
}
sub sshget {
use Net::SSH2;
use Net::SSH2::Dir;
$ssh=Net::SSH2->new() or die "couldn't make SSH object\n";
#$ssh->debug(1);
$ssh->blocking(1);
print "made SSH object\n";
$ssh->connect("$ip[$x]") or die "couldn't connect to host\n";
print "connected to $host[$x] $ip[$x] \n";
$ssh->auth_password('userID','userPWD') or die "couldn't authenticate user \n";
print "authenticated UserID\n";
$ssh->scp_get("/xxx/$list[$x]","/xxx/$list[$x]") or warn "couldn't get file in $list[$x] \n ";
print "\n Download Successfully \n";
$ssh->disconnect or die "couldn't disconnect\n";
}
========================================================
#yum install libssh2-devel
#yum install libssh2
#yum install perl-Net-SSH2
#yum install perl-Net-SFTP
========================================================
#!/usr/bin/perl
use Net::SFTP;
$sftp = Net::SFTP->new('xxx.xxx.xxx.xxx',user=>'userID',password=>'userPWD');
$sftp->get("/xxx/xxx", "/xxx/xxx");
========================================================
#!/usr/bin/perl
@ip=qw
(
192.168.1.1
192.168.1.2
);
@host=qw
(
server1
server2
);
@list=qw
(
server1.txt
server1.txt
);
for ($x=0;$x<=$#ip;$x++) {
print " \n $x SCP IP : $ip[$x] HostName : $host[$x] DFCHK_File : $df[$x] \n";
sshget();
}
sub sshget {
use Net::SSH2;
use Net::SSH2::Dir;
$ssh=Net::SSH2->new() or die "couldn't make SSH object\n";
#$ssh->debug(1);
$ssh->blocking(1);
print "made SSH object\n";
$ssh->connect("$ip[$x]") or die "couldn't connect to host\n";
print "connected to $host[$x] $ip[$x] \n";
$ssh->auth_password('userID','userPWD') or die "couldn't authenticate user \n";
print "authenticated UserID\n";
$ssh->scp_get("/xxx/$list[$x]","/xxx/$list[$x]") or warn "couldn't get file in $list[$x] \n ";
print "\n Download Successfully \n";
$ssh->disconnect or die "couldn't disconnect\n";
}
========================================================
訂閱:
文章 (Atom)