Search in sources :

Example 1 with QWCRSSTS

use of com.ibm.nagios.util.QWCRSSTS in project nagios-for-i by IBM.

the class CurSignOnUsers method execute.

public int execute(AS400 as400, Map<String, String> args, StringBuffer response) {
    int ccsid = as400.getCcsid();
    AS400Text text4 = new AS400Text(4, ccsid, as400);
    byte[] data = null;
    int returnValue = Constants.UNKNOWN;
    String warningCap = args.get("-W");
    String criticalCap = args.get("-C");
    int intWarningCap = (warningCap == null) ? 100 : Integer.parseInt(warningCap);
    int intCriticalCap = (criticalCap == null) ? 100 : Integer.parseInt(criticalCap);
    QWCRSSTS pgmCall = new QWCRSSTS();
    try {
        data = pgmCall.run(as400, response);
        if (data == null) {
            response.append(Constants.retrieveDataError);
            return returnValue;
        }
        int signOnUserNum = BinaryConverter.byteArrayToInt(text4.toBytes(text4.toObject(data, 24)), 0);
        returnValue = CommonUtil.getStatus(signOnUserNum, intWarningCap, intCriticalCap, returnValue);
        response.insert(0, "Currently Sign On Users Num: " + signOnUserNum + " | 'Currently Sign On Users Num' = " + signOnUserNum + ";" + warningCap + ";" + criticalCap);
    } catch (Exception e) {
        response.append(Constants.retrieveDataException + " - " + e.toString());
        CommonUtil.printStack(e.getStackTrace(), response);
        e.printStackTrace();
    } finally {
        data = null;
    }
    return returnValue;
}
Also used : AS400Text(com.ibm.as400.access.AS400Text) QWCRSSTS(com.ibm.nagios.util.QWCRSSTS)

Aggregations

AS400Text (com.ibm.as400.access.AS400Text)1 QWCRSSTS (com.ibm.nagios.util.QWCRSSTS)1