1/*2 * Licensed to the Apache Software Foundation (ASF) under one3 * or more contributor license agreements. See the NOTICE file4 * distributed with this work for additional information5 * regarding copyright ownership. The ASF licenses this file6 * to you under the Apache License, Version 2.0 (the7 * "License"); you may not use this file except in compliance8 * with the License. You may obtain a copy of the License at9 *10 * http://www.apache.org/licenses/LICENSE-2.011 *12 * Unless required by applicable law or agreed to in writing, software13 * distributed under the License is distributed on an "AS IS" BASIS,14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.15 * See the License for the specific language governing permissions and16 * limitations under the License.17 */18package org.apache.hadoop.chukwa.inputtools.plugin.pbsnode;
192021import org.apache.commons.logging.Log;
22import org.apache.commons.logging.LogFactory;
23import org.apache.hadoop.chukwa.inputtools.mdl.DataConfig;
24import org.apache.hadoop.chukwa.inputtools.plugin.ExecPlugin;
25import org.apache.hadoop.chukwa.inputtools.plugin.IPlugin;
26import org.json.simple.JSONObject;
2728publicclassPbsNodePluginextendsExecPlugin {
29privatestatic Log log = LogFactory.getLog(PbsNodePlugin.class);
30private String cmde = null;
31privateDataConfig dataConfig = null;
3233publicPbsNodePlugin() {
34 dataConfig = newDataConfig();
35 cmde = dataConfig.get("chukwa.inputtools.plugin.pbsNode.cmde");
36 }
3738 @Override
39public String getCmde() {
40return cmde;
41 }
4243publicstaticvoid main(String[] args) {
44IPlugin plugin = newPbsNodePlugin();
45 JSONObject result = plugin.execute();
46 System.out.print("Result: " + result);
4748if ((Integer) result.get("status") < 0) {
49 System.out.println("Error");
50 log.warn("[ChukwaError]:" + PbsNodePlugin.class + ", "51 + result.get("stderr"));
52 } else {
53 log.info(result.get("stdout"));
54 }
55 }
56 }