001 /* 002 * MDSTest.java 003 * 004 * Created on May 12, 2003, 2:34 PM 005 * 006 * This file is part of the STAR Scheduler. 007 * Copyright (c) 2002-2006 STAR Collaboration - Brookhaven National Laboratory 008 * 009 * STAR Scheduler is free software; you can redistribute it and/or modify 010 * it under the terms of the GNU General Public License as published by 011 * the Free Software Foundation; either version 2 of the License, or 012 * (at your option) any later version. 013 * 014 * STAR Scheduler is distributed in the hope that it will be useful, 015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 017 * GNU General Public License for more details. 018 * 019 * You should have received a copy of the GNU General Public License 020 * along with STAR Scheduler; if not, write to the Free Software 021 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 022 */ 023 package gov.bnl.star.offline.scheduler.monitor; 024 025 public class MDSTest { 026 027 public MDSTest() { 028 } 029 030 public static void main(String args[]) { 031 032 String host = "stargrid02.rcf.bnl.gov"; 033 String binddn = null; 034 String baseDN = "cl=STAR_CAS_Linux_Cluster, mds-vo-name=local, o=grid"; 035 String filter = "(objectclass=*)"; 036 String qop = "auth-conf, auth"; 037 boolean debug = false; 038 int port = 2135; 039 int version = 3; 040 041 042 String qhost = "rcas6185.rcf.bnl.gov"; 043 044 for (int i = 0; i < args.length; i++) { 045 if (args[i].equals("-h")) { 046 host = args[++i]; 047 } else if (args[i].equals("-p")) { 048 port = Integer.parseInt(args[++i]); 049 } else if (args[i].equals("-ver")) { 050 version = Integer.parseInt(args[++i]); 051 } else if (args[i].equals("-d")) { 052 debug = true; 053 } else if (args[i].equals("-D")) { 054 binddn = args[++i]; 055 } else if (args[i].equals("-b")) { 056 baseDN = args[++i]; 057 } else if (args[i].equals("-qop")) { 058 qop = args[++i]; 059 } else if (args[i].equalsIgnoreCase("-usage") || 060 args[i].equalsIgnoreCase("-help")) { 061 System.err.println("Usage: MDSTest -h [host] -p [port] -D [binddn] [-d] -b [baseDN]"); 062 System.err.println("Example: MDSTest -h mds.globus.org -p 2135 -b mds-vo-name=local,o=grid"); 063 System.exit(1); 064 } else { 065 System.err.println("Invalid argument: " + args[i]); 066 System.exit(1); 067 } 068 } 069 if (host == null) { 070 System.err.println("Error: hostname not specified!"); 071 System.exit(1); 072 } 073 074 MDSHostInfoFinder MHIF = new MDSHostInfoFinder(host); 075 MDSHostInfo MDSHI = new MDSHostInfo(); 076 MDSHI = (MDSHostInfo) MHIF.getHostInfo(qhost); 077 System.out.println("HostName: "+MDSHI.getHostName()); 078 System.out.println("Load 1Min: "+MDSHI.getLoad1m()); 079 System.out.println("Load 5Min: "+MDSHI.getLoad5m()); 080 System.out.println("Load 15Min: "+MDSHI.getLoad15m()); 081 System.out.println("SMP Load 1Min: "+MDSHI.getLoadSMP1Min()); 082 System.out.println("SMP Load 5Min: "+MDSHI.getLoadSMP5Min()); 083 System.out.println("SMP Load 15Min: "+MDSHI.getLoadSMP15Min()); 084 System.out.println("Memory Size: "+MDSHI.getMemorySize()); 085 System.out.println("Memory Available: "+MDSHI.getMemoryAvailable()); 086 System.out.println("Processor Count: "+MDSHI.getProcessorCount()); 087 System.out.println("Processor Speed: "+MDSHI.getProcessorSpeed()); 088 System.out.println("IP Address: "+MDSHI.getIPAddress()); 089 System.out.println("Network Adapter Name: "+MDSHI.getAdapterName()); 090 System.out.println("Unique ID: "+MDSHI.getUniqueID()); 091 092 } 093 094 }