mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-26 15:14:16 +02:00
enh(as400): add ssl connection option (#5476)
Co-authored-by: garnier-quentin <garnier.quentin@gmail.com>
This commit is contained in:
parent
5a23b681ec
commit
baf703598e
@ -6,9 +6,9 @@ RUN bash -e <<EOF
|
|||||||
|
|
||||||
dnf install -y \
|
dnf install -y \
|
||||||
git \
|
git \
|
||||||
|
java-17-openjdk-devel \
|
||||||
wget \
|
wget \
|
||||||
zstd \
|
zstd
|
||||||
java-17-openjdk-devel
|
|
||||||
|
|
||||||
cd /usr/local/src
|
cd /usr/local/src
|
||||||
wget https://dlcdn.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz
|
wget https://dlcdn.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz
|
||||||
|
@ -6,9 +6,9 @@ RUN bash -e <<EOF
|
|||||||
|
|
||||||
dnf install -y \
|
dnf install -y \
|
||||||
git \
|
git \
|
||||||
|
java-17-openjdk-devel \
|
||||||
wget \
|
wget \
|
||||||
zstd \
|
zstd
|
||||||
java-17-openjdk-devel
|
|
||||||
|
|
||||||
cd /usr/local/src
|
cd /usr/local/src
|
||||||
wget https://dlcdn.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz
|
wget https://dlcdn.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz
|
||||||
|
@ -8,9 +8,9 @@ apt-get update
|
|||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
git \
|
git \
|
||||||
zstd \
|
|
||||||
maven=3.8.7-1 \
|
maven=3.8.7-1 \
|
||||||
openjdk-17-jdk
|
openjdk-17-jdk \
|
||||||
|
zstd
|
||||||
|
|
||||||
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list
|
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list
|
||||||
|
|
||||||
|
@ -8,9 +8,9 @@ apt-get update
|
|||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
git \
|
git \
|
||||||
zstd \
|
|
||||||
maven=3.6.3-5 \
|
maven=3.6.3-5 \
|
||||||
openjdk-17-jdk
|
openjdk-17-jdk \
|
||||||
|
zstd
|
||||||
|
|
||||||
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list
|
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list
|
||||||
|
|
||||||
|
@ -8,9 +8,9 @@ apt-get update
|
|||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
git \
|
git \
|
||||||
|
openjdk-17-jdk \
|
||||||
wget \
|
wget \
|
||||||
zstd \
|
zstd
|
||||||
openjdk-17-jdk
|
|
||||||
|
|
||||||
cd /usr/local/src
|
cd /usr/local/src
|
||||||
wget https://dlcdn.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz
|
wget https://dlcdn.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz
|
||||||
|
2
.github/workflows/as400.yml
vendored
2
.github/workflows/as400.yml
vendored
@ -20,7 +20,7 @@ jobs:
|
|||||||
get-environment:
|
get-environment:
|
||||||
uses: ./.github/workflows/get-environment.yml
|
uses: ./.github/workflows/get-environment.yml
|
||||||
with:
|
with:
|
||||||
version_file: as400/packaging/centreon-as400-daemon.yaml
|
version_file: as400/connector.as400/pom.xml
|
||||||
|
|
||||||
package:
|
package:
|
||||||
needs: [get-environment]
|
needs: [get-environment]
|
||||||
|
6
.github/workflows/get-environment.yml
vendored
6
.github/workflows/get-environment.yml
vendored
@ -249,9 +249,11 @@ jobs:
|
|||||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
|
const { execSync } = require('child_process');
|
||||||
let version = '';
|
let version = '';
|
||||||
|
if ('${{ inputs.version_file }}'.match(/pom\.xml$/)) {
|
||||||
if ('${{ steps.get_stability.outputs.stability }}' === 'testing') {
|
version = execSync(`grep -m 1 "<version>.*</version>" ${{ inputs.version_file }} | sed 's/.*<version>\\(.*\\)<\\/version>.*/\\1/'`).toString().trim();
|
||||||
|
} else if ('${{ steps.get_stability.outputs.stability }}' === 'testing') {
|
||||||
const branchName = "${{ github.head_ref || github.ref_name }}";
|
const branchName = "${{ github.head_ref || github.ref_name }}";
|
||||||
const matches = branchName.match(/^(?:release|hotfix)-(\d{8})$/);
|
const matches = branchName.match(/^(?:release|hotfix)-(\d{8})$/);
|
||||||
if (matches) {
|
if (matches) {
|
||||||
|
@ -26,6 +26,7 @@ import java.text.NumberFormat;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import com.ibm.as400.access.AS400;
|
import com.ibm.as400.access.AS400;
|
||||||
|
import com.ibm.as400.access.SecureAS400;
|
||||||
import com.ibm.as400.access.AS400SecurityException;
|
import com.ibm.as400.access.AS400SecurityException;
|
||||||
import com.ibm.as400.access.ConnectionEvent;
|
import com.ibm.as400.access.ConnectionEvent;
|
||||||
import com.ibm.as400.access.ConnectionListener;
|
import com.ibm.as400.access.ConnectionListener;
|
||||||
@ -44,11 +45,13 @@ public abstract class AbstractHandler {
|
|||||||
protected String host = null;
|
protected String host = null;
|
||||||
protected String login = null;
|
protected String login = null;
|
||||||
protected String password = null;
|
protected String password = null;
|
||||||
|
protected Integer ssl = 0;
|
||||||
|
|
||||||
public AbstractHandler(final String host, final String login, final String password) {
|
public AbstractHandler(final String host, final String login, final String password, final Integer ssl) {
|
||||||
this.host = host;
|
this.host = host;
|
||||||
this.login = login;
|
this.login = login;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
|
this.ssl = ssl;
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@ -77,7 +80,28 @@ public abstract class AbstractHandler {
|
|||||||
properties.setLoginTimeout(Conf.as400LoginTimeout);
|
properties.setLoginTimeout(Conf.as400LoginTimeout);
|
||||||
properties.setSoTimeout(Conf.as400ReadTimeout);
|
properties.setSoTimeout(Conf.as400ReadTimeout);
|
||||||
|
|
||||||
final AS400 system = new AS400(this.host, this.login, this.password);
|
if (this.ssl == 1) {
|
||||||
|
SecureAS400 system = new SecureAS400(this.host, this.login, this.password);
|
||||||
|
system.setSocketProperties(properties);
|
||||||
|
system.addConnectionListener(new ConnectionListener() {
|
||||||
|
@Override
|
||||||
|
public void connected(final ConnectionEvent event) {
|
||||||
|
ConnectorLogger.getInstance().getLogger().debug("Connect event service : " + event.getService());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disconnected(final ConnectionEvent event) {
|
||||||
|
ConnectorLogger.getInstance().getLogger().debug("Disconnect event service : " + event.getService());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
system.validateSignon();
|
||||||
|
|
||||||
|
return (AS400)system;
|
||||||
|
}
|
||||||
|
|
||||||
|
AS400 system = new AS400(this.host, this.login, this.password);
|
||||||
|
|
||||||
system.setSocketProperties(properties);
|
system.setSocketProperties(properties);
|
||||||
system.addConnectionListener(new ConnectionListener() {
|
system.addConnectionListener(new ConnectionListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -34,8 +34,8 @@ import com.centreon.connector.as400.dispatcher.check.ResponseData;
|
|||||||
*/
|
*/
|
||||||
public class CommandHandler extends AbstractHandler implements ICommandHandler {
|
public class CommandHandler extends AbstractHandler implements ICommandHandler {
|
||||||
|
|
||||||
public CommandHandler(final String host, final String login, final String password) {
|
public CommandHandler(final String host, final String login, final String password, final Integer ssl) {
|
||||||
super(host, login, password);
|
super(host, login, password, ssl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -38,10 +38,10 @@ public class DiskHandler extends AbstractHandler implements IDiskHandler {
|
|||||||
|
|
||||||
private QyaspolYasp0300PcmlHandler qyaspolPcmlHandler = null;
|
private QyaspolYasp0300PcmlHandler qyaspolPcmlHandler = null;
|
||||||
|
|
||||||
public DiskHandler(final String host, final String login, final String password)
|
public DiskHandler(final String host, final String login, final String password, final Integer ssl)
|
||||||
throws AS400SecurityException, IOException {
|
throws AS400SecurityException, IOException {
|
||||||
super(host, login, password);
|
super(host, login, password, ssl);
|
||||||
this.qyaspolPcmlHandler = new QyaspolYasp0300PcmlHandler(host, login, password);
|
this.qyaspolPcmlHandler = new QyaspolYasp0300PcmlHandler(host, login, password, ssl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,8 +37,8 @@ import com.centreon.connector.as400.dispatcher.check.ResponseData;
|
|||||||
public class JobHandler extends AbstractHandler implements IJobHandler {
|
public class JobHandler extends AbstractHandler implements IJobHandler {
|
||||||
private final JobCache jobCache;
|
private final JobCache jobCache;
|
||||||
|
|
||||||
public JobHandler(final String host, final String login, final String password) {
|
public JobHandler(final String host, final String login, final String password, final Integer ssl) {
|
||||||
super(host, login, password);
|
super(host, login, password, ssl);
|
||||||
this.jobCache = new JobCache(this);
|
this.jobCache = new JobCache(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ import com.centreon.connector.as400.dispatcher.check.ResponseData;
|
|||||||
*/
|
*/
|
||||||
public class JobQueueHandler extends AbstractHandler implements IJobQueueHandler {
|
public class JobQueueHandler extends AbstractHandler implements IJobQueueHandler {
|
||||||
|
|
||||||
public JobQueueHandler(final String host, final String login, final String password) {
|
public JobQueueHandler(final String host, final String login, final String password, final Integer ssl) {
|
||||||
super(host, login, password);
|
super(host, login, password, ssl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,9 +42,9 @@ import com.centreon.connector.as400.dispatcher.check.ResponseData;
|
|||||||
*/
|
*/
|
||||||
public class SubSystemHandler extends AbstractHandler implements ISubSystemHandler {
|
public class SubSystemHandler extends AbstractHandler implements ISubSystemHandler {
|
||||||
|
|
||||||
public SubSystemHandler(final String host, final String login, final String password)
|
public SubSystemHandler(final String host, final String login, final String password, final Integer ssl)
|
||||||
throws AS400SecurityException, IOException {
|
throws AS400SecurityException, IOException {
|
||||||
super(host, login, password);
|
super(host, login, password, ssl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -45,14 +45,14 @@ import com.centreon.connector.as400.dispatcher.check.ResponseData;
|
|||||||
public class SystemHandler extends AbstractHandler implements ISystemHandler {
|
public class SystemHandler extends AbstractHandler implements ISystemHandler {
|
||||||
private SystemStatus status = null;
|
private SystemStatus status = null;
|
||||||
|
|
||||||
public SystemHandler(final String host, final String login, final String password)
|
public SystemHandler(final String host, final String login, final String password, final Integer ssl)
|
||||||
throws AS400SecurityException, IOException {
|
throws AS400SecurityException, IOException {
|
||||||
this(host, login, password, null);
|
this(host, login, password, null, ssl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SystemHandler(final String host, final String login, final String password, SystemStatus as400Status)
|
public SystemHandler(final String host, final String login, final String password, SystemStatus as400Status, final Integer ssl)
|
||||||
throws AS400SecurityException, IOException {
|
throws AS400SecurityException, IOException {
|
||||||
super(host, login, password);
|
super(host, login, password, ssl);
|
||||||
this.status = as400Status == null ? new SystemStatus(getNewAs400()) : as400Status;
|
this.status = as400Status == null ? new SystemStatus(getNewAs400()) : as400Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ibm.as400.access.AS400;
|
import com.ibm.as400.access.AS400;
|
||||||
|
import com.ibm.as400.access.SecureAS400;
|
||||||
import com.ibm.as400.access.AS400Message;
|
import com.ibm.as400.access.AS400Message;
|
||||||
import com.ibm.as400.access.AS400SecurityException;
|
import com.ibm.as400.access.AS400SecurityException;
|
||||||
import com.ibm.as400.access.ConnectionEvent;
|
import com.ibm.as400.access.ConnectionEvent;
|
||||||
@ -61,11 +62,13 @@ public class QyaspolYasp0300PcmlHandler {
|
|||||||
String host = null;
|
String host = null;
|
||||||
String login = null;
|
String login = null;
|
||||||
String password = null;
|
String password = null;
|
||||||
|
Integer ssl = 0;
|
||||||
|
|
||||||
public QyaspolYasp0300PcmlHandler(final String host, final String login, final String password) {
|
public QyaspolYasp0300PcmlHandler(final String host, final String login, final String password, final Integer ssl) {
|
||||||
this.host = host;
|
this.host = host;
|
||||||
this.login = login;
|
this.login = login;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
|
this.ssl = ssl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addYasp0300Data(final Yasp0300Data data) {
|
public void addYasp0300Data(final Yasp0300Data data) {
|
||||||
@ -238,7 +241,27 @@ public class QyaspolYasp0300PcmlHandler {
|
|||||||
properties.setLoginTimeout(Conf.as400LoginTimeout);
|
properties.setLoginTimeout(Conf.as400LoginTimeout);
|
||||||
properties.setSoTimeout(Conf.as400ReadTimeout);
|
properties.setSoTimeout(Conf.as400ReadTimeout);
|
||||||
|
|
||||||
final AS400 system = new AS400(this.host, this.login, this.password);
|
if (this.ssl == 1) {
|
||||||
|
SecureAS400 system = new SecureAS400(this.host, this.login, this.password);
|
||||||
|
system.setSocketProperties(properties);
|
||||||
|
system.addConnectionListener(new ConnectionListener() {
|
||||||
|
@Override
|
||||||
|
public void connected(final ConnectionEvent event) {
|
||||||
|
ConnectorLogger.getInstance().getLogger().debug("Connect event service : " + event.getService());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disconnected(final ConnectionEvent event) {
|
||||||
|
ConnectorLogger.getInstance().getLogger().debug("Disconnect event service : " + event.getService());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
system.validateSignon();
|
||||||
|
|
||||||
|
return (AS400)system;
|
||||||
|
}
|
||||||
|
|
||||||
|
AS400 system = new AS400(this.host, this.login, this.password);
|
||||||
system.setSocketProperties(properties);
|
system.setSocketProperties(properties);
|
||||||
system.addConnectionListener(new ConnectionListener() {
|
system.addConnectionListener(new ConnectionListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -102,8 +102,8 @@ public class CachedMessageQueueHandler extends AbstractHandler implements ICache
|
|||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CachedMessageQueueHandler(final String host, final String login, final String password) {
|
public CachedMessageQueueHandler(final String host, final String login, final String password, final Integer ssl) {
|
||||||
super(host, login, password);
|
super(host, login, password, ssl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,8 +42,8 @@ import com.centreon.connector.as400.dispatcher.check.ResponseData;
|
|||||||
*/
|
*/
|
||||||
public class MessageQueueHandler extends AbstractHandler implements IMessageQueueHandler {
|
public class MessageQueueHandler extends AbstractHandler implements IMessageQueueHandler {
|
||||||
|
|
||||||
public MessageQueueHandler(final String host, final String login, final String password) {
|
public MessageQueueHandler(final String host, final String login, final String password, final Integer ssl) {
|
||||||
super(host, login, password);
|
super(host, login, password, ssl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -69,8 +69,8 @@ public class WorkWithProblemHandler extends AbstractHandler {
|
|||||||
private final boolean SSL = false;
|
private final boolean SSL = false;
|
||||||
private final String logPrefix;
|
private final String logPrefix;
|
||||||
|
|
||||||
public WorkWithProblemHandler(final String host, final String login, final String password) {
|
public WorkWithProblemHandler(final String host, final String login, final String password, final Integer ssl) {
|
||||||
super(host, login, password);
|
super(host, login, password, ssl);
|
||||||
this.logPrefix = "[" + WorkWithProblemHandler.INSTANCE_ID++ + "]";
|
this.logPrefix = "[" + WorkWithProblemHandler.INSTANCE_ID++ + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,5 +40,7 @@ public interface IClient {
|
|||||||
|
|
||||||
String getAs400CheckType();
|
String getAs400CheckType();
|
||||||
|
|
||||||
|
Integer getAs400Ssl();
|
||||||
|
|
||||||
Object getAs400Arg(String key);
|
Object getAs400Arg(String key);
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ abstract class AbstractClient implements IClient {
|
|||||||
private String as400Password = null;
|
private String as400Password = null;
|
||||||
private String as400CheckType = null;
|
private String as400CheckType = null;
|
||||||
private String as400Args = null;
|
private String as400Args = null;
|
||||||
|
private Integer as400Ssl = 0;
|
||||||
private List<Map<String, String>> argList = new ArrayList<Map<String, String>>();
|
private List<Map<String, String>> argList = new ArrayList<Map<String, String>>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -77,6 +78,11 @@ abstract class AbstractClient implements IClient {
|
|||||||
return this.input.getArg(key);
|
return this.input.getArg(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getAs400Ssl() {
|
||||||
|
return this.input.getSsl();
|
||||||
|
}
|
||||||
|
|
||||||
public List<Map<String , String>> getAs400ArgList(String key) {
|
public List<Map<String , String>> getAs400ArgList(String key) {
|
||||||
Object arg = this.input.getArg(key);
|
Object arg = this.input.getArg(key);
|
||||||
if (arg == null) {
|
if (arg == null) {
|
||||||
|
@ -87,6 +87,7 @@ public class CheckDispatcher {
|
|||||||
private String host = null;
|
private String host = null;
|
||||||
private String login = null;
|
private String login = null;
|
||||||
private String password = null;
|
private String password = null;
|
||||||
|
private Integer ssl = 0;
|
||||||
|
|
||||||
private volatile ConcurrentHashMap<String, Long> filter = new ConcurrentHashMap<String, Long>();
|
private volatile ConcurrentHashMap<String, Long> filter = new ConcurrentHashMap<String, Long>();
|
||||||
|
|
||||||
@ -135,10 +136,11 @@ public class CheckDispatcher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheckDispatcher(final String host, final String login, final String password) {
|
public CheckDispatcher(final String host, final String login, final String password, final Integer ssl) {
|
||||||
this.host = host;
|
this.host = host;
|
||||||
this.login = login;
|
this.login = login;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
|
this.ssl = ssl;
|
||||||
|
|
||||||
this.executorGlobal = new ThreadPoolExecutorPostFilter(5, 10, Conf.workerQueueTimeout, TimeUnit.MILLISECONDS,
|
this.executorGlobal = new ThreadPoolExecutorPostFilter(5, 10, Conf.workerQueueTimeout, TimeUnit.MILLISECONDS,
|
||||||
new LinkedBlockingQueue<Runnable>());
|
new LinkedBlockingQueue<Runnable>());
|
||||||
@ -165,6 +167,10 @@ public class CheckDispatcher {
|
|||||||
return this.password;
|
return this.password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getSsl() {
|
||||||
|
return this.ssl;
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized void dispatch(final NetworkClient client) {
|
public synchronized void dispatch(final NetworkClient client) {
|
||||||
|
|
||||||
if (this.filter.containsKey(client.getRawRequest())) {
|
if (this.filter.containsKey(client.getRawRequest())) {
|
||||||
@ -190,52 +196,52 @@ public class CheckDispatcher {
|
|||||||
|
|
||||||
public ICommandHandler getCommandHandler() throws AS400SecurityException, IOException {
|
public ICommandHandler getCommandHandler() throws AS400SecurityException, IOException {
|
||||||
if (this.commandHandler == null) {
|
if (this.commandHandler == null) {
|
||||||
this.commandHandler = new CommandHandler(this.host, this.login, this.password);
|
this.commandHandler = new CommandHandler(this.host, this.login, this.password, this.ssl);
|
||||||
}
|
}
|
||||||
return this.commandHandler;
|
return this.commandHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDiskHandler getDiskHandler() throws AS400SecurityException, IOException {
|
public IDiskHandler getDiskHandler() throws AS400SecurityException, IOException {
|
||||||
if (this.diskHandler == null) {
|
if (this.diskHandler == null) {
|
||||||
this.diskHandler = new DiskHandler(this.host, this.login, this.password);
|
this.diskHandler = new DiskHandler(this.host, this.login, this.password, this.ssl);
|
||||||
}
|
}
|
||||||
return this.diskHandler;
|
return this.diskHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IJobHandler getJobHandler() throws AS400SecurityException, IOException {
|
public IJobHandler getJobHandler() throws AS400SecurityException, IOException {
|
||||||
if (this.jobHandler == null) {
|
if (this.jobHandler == null) {
|
||||||
this.jobHandler = new JobHandler(this.host, this.login, this.password);
|
this.jobHandler = new JobHandler(this.host, this.login, this.password, this.ssl);
|
||||||
}
|
}
|
||||||
return this.jobHandler;
|
return this.jobHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ISubSystemHandler getSubSystemHandler() throws AS400SecurityException, IOException {
|
public ISubSystemHandler getSubSystemHandler() throws AS400SecurityException, IOException {
|
||||||
if (this.subSystemHandler == null) {
|
if (this.subSystemHandler == null) {
|
||||||
this.subSystemHandler = new SubSystemHandler(this.host, this.login, this.password);
|
this.subSystemHandler = new SubSystemHandler(this.host, this.login, this.password, this.ssl);
|
||||||
}
|
}
|
||||||
return this.subSystemHandler;
|
return this.subSystemHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ISystemHandler getSystemHandler() throws AS400SecurityException, IOException {
|
public ISystemHandler getSystemHandler() throws AS400SecurityException, IOException {
|
||||||
if (this.systemHandler == null) {
|
if (this.systemHandler == null) {
|
||||||
this.systemHandler = new SystemHandler(this.host, this.login, this.password);
|
this.systemHandler = new SystemHandler(this.host, this.login, this.password, this.ssl);
|
||||||
}
|
}
|
||||||
return this.systemHandler;
|
return this.systemHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICachedMessageQueueHandler getCachedMessageQueueHandler() throws AS400SecurityException, IOException {
|
public ICachedMessageQueueHandler getCachedMessageQueueHandler() throws AS400SecurityException, IOException {
|
||||||
return new CachedMessageQueueHandler(this.host, this.login, this.password);
|
return new CachedMessageQueueHandler(this.host, this.login, this.password, this.ssl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMessageQueueHandler getMessageQueueHandler() throws AS400SecurityException, IOException {
|
public IMessageQueueHandler getMessageQueueHandler() throws AS400SecurityException, IOException {
|
||||||
return new MessageQueueHandler(this.host, this.login, this.password);
|
return new MessageQueueHandler(this.host, this.login, this.password, this.ssl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IJobQueueHandler getJobQueueHandler() throws AS400SecurityException, IOException {
|
public IJobQueueHandler getJobQueueHandler() throws AS400SecurityException, IOException {
|
||||||
return new JobQueueHandler(this.host, this.login, this.password);
|
return new JobQueueHandler(this.host, this.login, this.password, this.ssl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorkWithProblemHandler getWrkPrbHandler() throws AS400SecurityException, IOException {
|
public WorkWithProblemHandler getWrkPrbHandler() throws AS400SecurityException, IOException {
|
||||||
return new WorkWithProblemHandler(this.host, this.login, this.password);
|
return new WorkWithProblemHandler(this.host, this.login, this.password, this.ssl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ public class InputData {
|
|||||||
private String password = null;
|
private String password = null;
|
||||||
private String host = null;
|
private String host = null;
|
||||||
private String command = null;
|
private String command = null;
|
||||||
|
private Integer ssl = null;
|
||||||
Map<String, Object> args = null;
|
Map<String, Object> args = null;
|
||||||
|
|
||||||
public InputData() {
|
public InputData() {
|
||||||
@ -44,6 +45,13 @@ public class InputData {
|
|||||||
return this.password;
|
return this.password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getSsl() {
|
||||||
|
if (this.ssl == null || this.ssl == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
public String getHost() {
|
public String getHost() {
|
||||||
return this.host;
|
return this.host;
|
||||||
}
|
}
|
||||||
|
@ -52,37 +52,37 @@ public class ClientDispatcherImpl implements ClientDispatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private synchronized CheckDispatcher createNewCheckDispatcher(final String host, final String login,
|
private synchronized CheckDispatcher createNewCheckDispatcher(final String host, final String login,
|
||||||
final String password) throws AS400SecurityException, IOException, DelayedConnectionException, Exception {
|
final String password, final Integer ssl) throws AS400SecurityException, IOException, DelayedConnectionException, Exception {
|
||||||
|
|
||||||
ConnectorLogger.getInstance().info("create new As400 : " + host);
|
ConnectorLogger.getInstance().info("create new As400 : " + host);
|
||||||
|
|
||||||
CheckDispatcher resource = null;
|
CheckDispatcher resource = null;
|
||||||
resource = new CheckDispatcher(host, login, password);
|
resource = new CheckDispatcher(host, login, password, ssl);
|
||||||
|
|
||||||
this.pool.put(resource, System.currentTimeMillis());
|
this.pool.put(resource, System.currentTimeMillis());
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CheckDispatcher getAs400(final String host, final String login, final String password)
|
private CheckDispatcher getAs400(final String host, final String login, final String password, final Integer ssl)
|
||||||
throws AS400SecurityException, IOException, DelayedConnectionException, Exception {
|
throws AS400SecurityException, IOException, DelayedConnectionException, Exception {
|
||||||
|
|
||||||
for (final CheckDispatcher resource : this.pool.keySet()) {
|
for (final CheckDispatcher resource : this.pool.keySet()) {
|
||||||
if (resource.getHost().equalsIgnoreCase(host) && resource.getLogin().equalsIgnoreCase(login)
|
if (resource.getHost().equalsIgnoreCase(host) && resource.getLogin().equalsIgnoreCase(login)
|
||||||
&& resource.getPassword().equalsIgnoreCase(password)) {
|
&& resource.getPassword().equalsIgnoreCase(password) && resource.getSsl() == ssl) {
|
||||||
this.pool.put(resource, System.currentTimeMillis());
|
this.pool.put(resource, System.currentTimeMillis());
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.createNewCheckDispatcher(host, login, password);
|
return this.createNewCheckDispatcher(host, login, password, ssl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void dispatch(final NetworkClient client)
|
public synchronized void dispatch(final NetworkClient client)
|
||||||
throws AS400SecurityException, IOException, DelayedConnectionException, Exception {
|
throws AS400SecurityException, IOException, DelayedConnectionException, Exception {
|
||||||
final CheckDispatcher checkDispatcher = this.getAs400(client.getAs400Host(), client.getAs400Login(),
|
final CheckDispatcher checkDispatcher = this.getAs400(client.getAs400Host(), client.getAs400Login(),
|
||||||
client.getAs400Password());
|
client.getAs400Password(), client.getAs400Ssl());
|
||||||
checkDispatcher.dispatch(client);
|
checkDispatcher.dispatch(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public class SystemHandlerTest {
|
|||||||
try {
|
try {
|
||||||
SystemStatus as400 = mock(SystemStatus.class);
|
SystemStatus as400 = mock(SystemStatus.class);
|
||||||
when(as400.getSystemPools()).thenReturn(new Vector<Object>().elements());
|
when(as400.getSystemPools()).thenReturn(new Vector<Object>().elements());
|
||||||
SystemHandler sh = new SystemHandler(null, null, null, as400);
|
SystemHandler sh = new SystemHandler(null, null, null, as400, null);
|
||||||
sh.dumpSystem();
|
sh.dumpSystem();
|
||||||
} finally {
|
} finally {
|
||||||
System.setOut(originalOut);
|
System.setOut(originalOut);
|
||||||
|
@ -53,7 +53,8 @@ sub new {
|
|||||||
'critical-http-status:s' => { name => 'critical_http_status' },
|
'critical-http-status:s' => { name => 'critical_http_status' },
|
||||||
'as400-hostname:s' => { name => 'as400_hostname' },
|
'as400-hostname:s' => { name => 'as400_hostname' },
|
||||||
'as400-username:s' => { name => 'as400_username' },
|
'as400-username:s' => { name => 'as400_username' },
|
||||||
'as400-password:s' => { name => 'as400_password' }
|
'as400-password:s' => { name => 'as400_password' },
|
||||||
|
'as400-ssl' => { name => 'as400_ssl' }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$options{options}->add_help(package => __PACKAGE__, sections => 'REST API OPTIONS', once => 1);
|
$options{options}->add_help(package => __PACKAGE__, sections => 'REST API OPTIONS', once => 1);
|
||||||
@ -87,6 +88,7 @@ sub check_options {
|
|||||||
$self->{as400_hostname} = (defined($self->{option_results}->{as400_hostname})) ? $self->{option_results}->{as400_hostname} : '';
|
$self->{as400_hostname} = (defined($self->{option_results}->{as400_hostname})) ? $self->{option_results}->{as400_hostname} : '';
|
||||||
$self->{as400_username} = (defined($self->{option_results}->{as400_username})) ? $self->{option_results}->{as400_username} : '';
|
$self->{as400_username} = (defined($self->{option_results}->{as400_username})) ? $self->{option_results}->{as400_username} : '';
|
||||||
$self->{as400_password} = (defined($self->{option_results}->{as400_password})) ? $self->{option_results}->{as400_password} : '';
|
$self->{as400_password} = (defined($self->{option_results}->{as400_password})) ? $self->{option_results}->{as400_password} : '';
|
||||||
|
$self->{as400_ssl} = (defined($self->{option_results}->{as400_ssl})) ? 1 : 0;
|
||||||
|
|
||||||
if ($self->{connector_hostname} eq '') {
|
if ($self->{connector_hostname} eq '') {
|
||||||
$self->{output}->add_option_msg(short_msg => "Need to specify --connector-hostname option.");
|
$self->{output}->add_option_msg(short_msg => "Need to specify --connector-hostname option.");
|
||||||
@ -152,6 +154,7 @@ sub request_api {
|
|||||||
host => $self->{as400_hostname},
|
host => $self->{as400_hostname},
|
||||||
login => $self->{as400_username},
|
login => $self->{as400_username},
|
||||||
password => $self->{as400_password},
|
password => $self->{as400_password},
|
||||||
|
ssl => $self->{as400_ssl},
|
||||||
command => $options{command}
|
command => $options{command}
|
||||||
};
|
};
|
||||||
if (defined($options{args})) {
|
if (defined($options{args})) {
|
||||||
@ -247,6 +250,10 @@ AS/400 username (required)
|
|||||||
|
|
||||||
AS/400 password (required)
|
AS/400 password (required)
|
||||||
|
|
||||||
|
=item B<--as400-ssl>
|
||||||
|
|
||||||
|
Use SSL connection (port: 9475)
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
@ -24,6 +24,7 @@ api.meraki.com
|
|||||||
--api-username
|
--api-username
|
||||||
--api-version
|
--api-version
|
||||||
AppearTV
|
AppearTV
|
||||||
|
AS400
|
||||||
ASAM
|
ASAM
|
||||||
Avigilon
|
Avigilon
|
||||||
Avocent
|
Avocent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user