You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
(927) |
Apr
(419) |
May
(352) |
Jun
(431) |
Jul
(463) |
Aug
(345) |
Sep
(304) |
Oct
(596) |
Nov
(466) |
Dec
(414) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(348) |
Feb
(313) |
Mar
(665) |
Apr
(688) |
May
(434) |
Jun
(311) |
Jul
(540) |
Aug
(554) |
Sep
(467) |
Oct
(341) |
Nov
(365) |
Dec
(272) |
2009 |
Jan
(386) |
Feb
(293) |
Mar
(279) |
Apr
(239) |
May
(229) |
Jun
(199) |
Jul
(186) |
Aug
(111) |
Sep
(196) |
Oct
(146) |
Nov
(116) |
Dec
(140) |
2010 |
Jan
(170) |
Feb
(159) |
Mar
(151) |
Apr
(161) |
May
(90) |
Jun
(56) |
Jul
(28) |
Aug
(22) |
Sep
(5) |
Oct
|
Nov
(23) |
Dec
(12) |
2011 |
Jan
(8) |
Feb
(8) |
Mar
(22) |
Apr
(24) |
May
(4) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2012 |
Jan
(5) |
Feb
(1) |
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <gla...@hy...> - 2009-11-13 20:26:24
|
Author: glaullon Date: 2009-11-13 12:26:13 -0800 (Fri, 13 Nov 2009) New Revision: 13945 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=13945 Added: trunk/plugins/zimbra/src/org/hyperic/hq/plugin/zimbra/five/Service.java trunk/plugins/zimbra/src/org/hyperic/hq/plugin/zimbra/five/ZimbraMeasurement.java Modified: trunk/plugins/zimbra/etc/hq-plugin.xml trunk/plugins/zimbra/src/org/hyperic/hq/plugin/zimbra/five/ZimbraCollector.java trunk/plugins/zimbra/src/org/hyperic/hq/plugin/zimbra/five/ZimbraServerDetector.java Log: NPE solved and Zimbra 6 support Modified: trunk/plugins/zimbra/etc/hq-plugin.xml =================================================================== --- trunk/plugins/zimbra/etc/hq-plugin.xml 2009-11-13 19:53:35 UTC (rev 13944) +++ trunk/plugins/zimbra/etc/hq-plugin.xml 2009-11-13 20:26:13 UTC (rev 13945) @@ -335,10 +335,7 @@ default="Pid.PidFile.eq=%installpath%/cyrus-sasl/state/saslauthd.pid" description="PTQL for Zimbra Cyrus SASL"/> </config> - <metric name="Availability" - template="sigar:Type=ProcState,Arg=%process.query%:State" - indicator="true"/> - &process-metrics; + &multi-process-metrics; </service> <service name="Apache Httpd"> @@ -361,10 +358,7 @@ default="Pid.SudoPidFile.eq=%installpath%/log/amavisd.pid" description="PTQL for Zimbra AMaViS"/> </config> - <metric name="Availability" - template="sigar:Type=ProcState,Arg=%process.query%:State" - indicator="true"/> - &process-metrics; + &multi-process-metrics; </service> @@ -427,6 +421,59 @@ </server> + <metrics name="multi-process"> + <metric name="Availability" template="sigar:Type=ProcState,Arg=Pid.SudoPidFile.eq=%process.status%:State" indicator="true"/> + <metric name="Number of Processes" + alias="NumProcesses" + template="sigar:Type=MultiProcCpu,Arg=%process.query%:Processes" + category="UTILIZATION" + units="none" + collectionType="dynamic"/> + + <metric name="Memory Size" + alias="MemSize" + template="sigar:Type=MultiProcMem,Arg=%process.query%:Size" + category="UTILIZATION" + units="B" + collectionType="dynamic"/> + + <metric name="Resident Memory Size" + alias="ResidentMemSize" + template="sigar:Type=MultiProcMem,Arg=%process.query%:Resident" + category="UTILIZATION" + units="B" + collectionType="dynamic"/> + + <metric name="Cpu System Time" + alias="SystemTime" + template="sigar:Type=MultiProcCpu,Arg=%process.query%:Sys" + category="UTILIZATION" + units="ms" + collectionType="trendsup"/> + + <metric name="Cpu User Time" + alias="UserTime" + template="sigar:Type=MultiProcCpu,Arg=%process.query%:User" + category="UTILIZATION" + units="ms" + collectionType="trendsup"/> + + <metric name="Cpu Total Time" + alias="TotalTime" + template="sigar:Type=MultiProcCpu,Arg=%process.query%:Total" + category="UTILIZATION" + units="ms" + collectionType="trendsup"/> + + <metric name="Cpu Usage" + alias="Usage" + template="sigar:Type=MultiProcCpu,Arg=%process.query%:Percent" + category="UTILIZATION" + indicator="true" + units="percentage" + collectionType="dynamic"/> + </metrics> + <filter name="template_mailboxd" value="zimbra-stats:statsfile=%installpath%/zmstat/mailboxd.csv:${alias}"/> <filter name="template_mysql" value="zimbra-stats:statsfile=%installpath%/zmstat/mysql.csv:${alias}"/> <filter name="template_cpu" value="zimbra-stats:statsfile=%installpath%/zmstat/cpu.csv:${alias}"/> @@ -894,8 +941,9 @@ <service name="Cyrus SASL"> <config> <option name="process.query" description="Sigar PTQL Process Query"/> + <option name="process.status" description="Process PID file"/> </config> - &multi-process-metrics; + <metrics include="multi-process"/> </service> <!-- --> @@ -904,8 +952,9 @@ <plugin type="log_track" class="org.hyperic.hq.product.LogFileTailPlugin"/> <config> <option name="process.query" description="Sigar PTQL Process Query"/> + <option name="process.status" description="Process PID file"/> </config> - &multi-process-metrics; + <metrics include="multi-process"/> </service> <!-- --> @@ -913,8 +962,9 @@ <service name="HTTPD"> <config> <option name="process.query" description="Sigar PTQL Process Query"/> + <option name="process.status" description="Process PID file"/> </config> - &multi-process-metrics; + <metrics include="multi-process"/> </service> <!-- --> @@ -922,18 +972,20 @@ <service name="AMaViS" description="A Mail Virus Scanner"> <config> <option name="process.query" description="Sigar PTQL Process Query"/> + <option name="process.status" description="Process PID file"/> </config> - &multi-process-metrics; + <metrics include="multi-process"/> </service> <!-- --> - + <!-- convertd --> <service name="Convertd"> <plugin type="log_track" class="org.hyperic.hq.product.Log4JLogTrackPlugin"/> <config> <option name="process.query" default="State.Name.eq=java,Args.*.eq=com.zimbra.cs.convertd.TransformationServer" description="Sigar PTQL Process Query"/> + <option name="process.status" description="Process PID file"/> </config> - &multi-process-metrics; + <metrics include="multi-process"/> </service> <!-- --> @@ -979,7 +1031,10 @@ </service> </server> - + + <server name="Zimbra" version="6.0.x" include="Zimbra 5.0.x"> + </server> + <!-- ==================== Plugin Help =========================== --> <help name="Zimbra"> <![CDATA[ Added: trunk/plugins/zimbra/src/org/hyperic/hq/plugin/zimbra/five/Service.java =================================================================== --- trunk/plugins/zimbra/src/org/hyperic/hq/plugin/zimbra/five/Service.java (rev 0) +++ trunk/plugins/zimbra/src/org/hyperic/hq/plugin/zimbra/five/Service.java 2009-11-13 20:26:13 UTC (rev 13945) @@ -0,0 +1,60 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package org.hyperic.hq.plugin.zimbra.five; + +/** + * + * @author laullon + */ +public class Service { + + private String name, pidFile, log, process; + + public Service(String name, String pidFile, String log, String process) { + this.name = name; + this.pidFile = pidFile; + this.log = log; + this.process = process; + } + + public Service(String name, String pidFile, String log) { + this.name = name; + this.pidFile = pidFile; + this.log = log; + } + + public Service(String name, String pidFile) { + this.name = name; + this.pidFile = pidFile; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @return the pidFile + */ + public String getPidFile() { + return pidFile; + } + + /** + * @return the log + */ + public String getLog() { + return log; + } + + /** + * @return the process + */ + public String getProcess() { + return process; + } +} Modified: trunk/plugins/zimbra/src/org/hyperic/hq/plugin/zimbra/five/ZimbraCollector.java =================================================================== --- trunk/plugins/zimbra/src/org/hyperic/hq/plugin/zimbra/five/ZimbraCollector.java 2009-11-13 19:53:35 UTC (rev 13944) +++ trunk/plugins/zimbra/src/org/hyperic/hq/plugin/zimbra/five/ZimbraCollector.java 2009-11-13 20:26:13 UTC (rev 13945) @@ -37,13 +37,24 @@ protected void init() { BufferedReader buffer = null; - log.debug("init() (" + getProperties() + ")"); + log.debug("init() prop=" + getProperties()); + log.debug("init() PConfig=" + getPlugin().getConfig()); try { // read 1st line of filename and create a List or String[] of the field names assert (getProperties().getProperty(STATSFILE) != null); - myStatsFile = new File(getProperties().getProperty(STATSFILE)); + String file = getProperties().getProperty(STATSFILE); + if (file == null) { + log.error("propertie '" + STATSFILE + "' not found"); + return; + } + myStatsFile = new File(file); + if (!myStatsFile.exists()) { + log.error("File '" + myStatsFile + "' no found"); + return; + } + buffer = new BufferedReader(new FileReader(myStatsFile)); String line = buffer.readLine(); if (line == null) { @@ -55,8 +66,8 @@ myAliasMap.put(new Integer(i), metrics[i].trim().replaceAll(":", "_")); } - // XXX mejorar esto // read complete file to found last line + //buffer.skip(myStatsFile.length() - 1000); while ((line = buffer.readLine()) != null) { lastLine = line; } @@ -107,7 +118,7 @@ log.debug("collect() (" + getProperties() + ")"); } if (log.isTraceEnabled()) { - log.trace("myLastLine=" + lastLine); + log.trace("[collect] ("+getProperties().getProperty("statsfile")+") myLastLine=" + lastLine); } try { if (lastLine == null) { Added: trunk/plugins/zimbra/src/org/hyperic/hq/plugin/zimbra/five/ZimbraMeasurement.java =================================================================== --- trunk/plugins/zimbra/src/org/hyperic/hq/plugin/zimbra/five/ZimbraMeasurement.java (rev 0) +++ trunk/plugins/zimbra/src/org/hyperic/hq/plugin/zimbra/five/ZimbraMeasurement.java 2009-11-13 20:26:13 UTC (rev 13945) @@ -0,0 +1,40 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package org.hyperic.hq.plugin.zimbra.five; + +import java.util.Arrays; +import org.hyperic.hq.product.MeasurementInfo; +import org.hyperic.hq.product.SigarMeasurementPlugin; +import org.hyperic.hq.product.Metric; +import org.hyperic.hq.product.MetricNotFoundException; +import org.hyperic.hq.product.MetricUnreachableException; +import org.hyperic.hq.product.MetricValue; +import org.hyperic.hq.product.PluginException; +import org.hyperic.hq.product.TypeInfo; + +/** + * + * @author laullon + */ +public class ZimbraMeasurement extends SigarMeasurementPlugin { + + public MetricValue getValue(Metric metric) throws PluginException, MetricNotFoundException, MetricUnreachableException { + MetricValue res = null; + try { + res = super.getValue(metric); + getLog().debug("--->" + res + " (" + metric + ")"); + } catch (Exception e) { + getLog().debug(e); + } + return res; + } + + public MeasurementInfo[] getMeasurements(TypeInfo info) { + getLog().debug("[getMeasurements] (" + info + ")"); + MeasurementInfo[] res = super.getMeasurements(info); + getLog().debug("[getMeasurements] (" + Arrays.asList(res) + ")"); + return res; + } +} Modified: trunk/plugins/zimbra/src/org/hyperic/hq/plugin/zimbra/five/ZimbraServerDetector.java =================================================================== --- trunk/plugins/zimbra/src/org/hyperic/hq/plugin/zimbra/five/ZimbraServerDetector.java 2009-11-13 19:53:35 UTC (rev 13944) +++ trunk/plugins/zimbra/src/org/hyperic/hq/plugin/zimbra/five/ZimbraServerDetector.java 2009-11-13 20:26:13 UTC (rev 13945) @@ -1,5 +1,6 @@ package org.hyperic.hq.plugin.zimbra.five; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FilenameFilter; import java.text.MessageFormat; @@ -12,221 +13,286 @@ import org.apache.commons.logging.LogFactory; import org.hyperic.hq.product.AutoServerDetector; import org.hyperic.hq.product.LogFileTrackPlugin; +import org.hyperic.hq.product.LogTrackPlugin; import org.hyperic.hq.product.PluginException; import org.hyperic.hq.product.ServerControlPlugin; import org.hyperic.hq.product.ServerDetector; import org.hyperic.hq.product.ServerResource; import org.hyperic.hq.product.ServiceResource; import org.hyperic.util.config.ConfigResponse; +import org.hyperic.util.exec.Execute; +import org.hyperic.util.exec.PumpStreamHandler; public class ZimbraServerDetector extends ServerDetector implements AutoServerDetector { - private static final String PROCESS_NAME = "zmmailboxdmgr"; - private static final String PROCESS_DIR = "/libexec"; - private static final String ZMSTATS_DIR = "zmstat"; - private static final String PTQL_QUERY = "State.Name.eq={0}"; - private static final String PROCESS_PID_QUERY = "Pid.SudoPidFile.eq={0}"; - private static final String PROCESS_EXEC = "State.Name.eq={0}"; - // private static final String PROCESS_CHILD_QUERY = "State.Ppid.eq={0,number,#}"; + private static final String PROCESS_NAME = "zmmailboxdmgr"; + private static final String PROCESS_DIR = "/libexec"; + private static final String ZMSTATS_DIR = "zmstat"; + private static final String PTQL_QUERY = "State.Name.eq={0}"; + private static final String PROCESS_PID_QUERY = "Pid.SudoPidFile.eq={0}"; + private static final String PROCESS_EXEC = "State.Name.eq={0}"; + private static final String PROCESS_EXEC_2 = "State.Name.ct={0}"; + // private static final String PROCESS_CHILD_QUERY = "State.Ppid.eq={0,number,#}"; + private static Log log = LogFactory.getLog(ZimbraServerDetector.class); - private static Log log = LogFactory.getLog(ZimbraServerDetector.class); + public List getServerResources(ConfigResponse platformConfig) throws PluginException { + log.debug("getServerResources(" + platformConfig + ")"); - public List getServerResources(ConfigResponse platformConfig) throws PluginException { - log.debug("getServerResources(" + platformConfig + ")"); + Object args[] = {PROCESS_NAME}; + long[] pids = getPids(MessageFormat.format(PTQL_QUERY, args)); + List list_servers = new ArrayList(); + for (int n = 0; n < pids.length; n++) { + long pid = pids[n]; + try { + String exe = getProcExe(pid); + String path = exe.substring(0, exe.length() - (PROCESS_DIR + File.separator + PROCESS_NAME).length()); + log.debug("[getServerResources] proc: (" + pid + ") " + exe + " (" + path + ")"); - String args[] = { PROCESS_NAME }; - long[] pids = getPids(MessageFormat.format(PTQL_QUERY, args)); - List list_servers = new ArrayList(); - for (int n = 0; n < pids.length; n++) { - long pid = pids[n]; - try { - String exe = getProcExe(pid); - String path = exe.substring(0, exe.length() - (PROCESS_DIR + File.separator + PROCESS_NAME).length()); - log.debug("proc: (" + pid + ") " + exe + " (" + path + ")"); - if (new File(path, ZMSTATS_DIR).exists()) { - ConfigResponse productConfig = new ConfigResponse(); - productConfig.setValue("installpath", path); + // check version + if (!checkVersion(path, getTypeInfo().getVersion())) { + return list_servers; + } + //************** - ServerResource server = new ServerResource(); - server.setType(this); - server.setName(getPlatformName() + " " + getTypeInfo().getName()); - server.setInstallPath(path); - server.setIdentifier("zimbra " + path); + File zmStatsDir = new File(path, ZMSTATS_DIR); + log.debug("[getServerResources] zmStatsDir=" + zmStatsDir.getCanonicalPath() + " (" + (zmStatsDir.exists() ? "OK" : "No OK") + ")"); + if (zmStatsDir.exists()) { + ConfigResponse productConfig = new ConfigResponse(); + productConfig.setValue("installpath", path); - // server.setProductConfig(productConfig); - setProductConfig(server, productConfig); + ServerResource server = new ServerResource(); + server.setType(this); + server.setName(getPlatformName() + " " + getTypeInfo().getName()); + server.setInstallPath(path); + server.setIdentifier("zimbra " + path); - ConfigResponse metricConfig = new ConfigResponse(); - metricConfig.setValue(LogFileTrackPlugin.PROP_FILES_SERVER, - "log/mailbox.log"); - server.setMeasurementConfig(metricConfig, - LogFileTrackPlugin.LOGLEVEL_WARN, - false); - - ConfigResponse controlConfig = new ConfigResponse(); - controlConfig.setValue(ServerControlPlugin.PROP_PROGRAMPREFIX, "/usr/bin/sudo -u zimbra"); // RHEL 5.0 - controlConfig.setValue(ServerControlPlugin.PROP_TIMEOUT, "300"); - server.setControlConfig(controlConfig); - - list_servers.add(server); - } - } catch (Exception e) { - log.error(e.getMessage(), e); - } - } - - return list_servers; - } + // server.setProductConfig(productConfig); + setProductConfig(server, productConfig); - private final static String[][] SERVICES = { { "MySQL", "/db/mysql.pid" }, { "Postfix", "/data/postfix/spool/pid/master.pid" }, { "Log Watch", "/log/logswatch.pid" }, { "Logger MySQL", "/logger/db/mysql.pid" }, { "OpenLDAP", "/openldap/var/run/slapd.pid" }, { "Swatch", "/log/swatch.pid" }, { "MTA Config", "/log/zmmtaconfig.pid" }, { "memcached", "/log/memcached.pid" }, { "ClamAV", "/log/clamd.pid","log/clamd.log" }, { "Convertd Monitor", "/log/zmconvertdmon.pid","log/zmconvertd.log" }, { "Jetty Process", "/log/zmmailboxd_java.pid" } }; - private final static String[][] MULTI_SERVICES = { { "AMaViS", "/log/amavisd.pid" }, { "HTTPD", "/log/httpd.pid" }, { "NGINX", "/log/nginx.pid","log/nginx.log" }, { "Cyrus SASL", "/cyrus-sasl/state/saslauthd.pid" } }; - private final static String[][] OTHER_SERVICES = { { "MTAQueue Stats", "/zmstat/mtaqueue.csv" }, { "VM Stats", "/zmstat/vm.csv" } }; - - protected List discoverServices(ConfigResponse config) throws PluginException { - log.debug("discoverServices(" + config + ")"); - List services = new ArrayList(); + ConfigResponse metricConfig = new ConfigResponse(); + metricConfig.setValue(LogFileTrackPlugin.PROP_FILES_SERVER, + "log/mailbox.log"); + server.setMeasurementConfig(metricConfig, + LogFileTrackPlugin.LOGLEVEL_WARN, + false); - for (int n = 0; n < OTHER_SERVICES.length; n++) { - String[] serviceSata = OTHER_SERVICES[n]; - File csvFile = new File(config.getValue("installpath"), serviceSata[1]); - if (csvFile.exists()) { - ServiceResource service = new ServiceResource(); - service.setServiceName(serviceSata[0]); - service.setType(this, serviceSata[0]); - service.setDescription(csvFile.getAbsolutePath()); + ConfigResponse controlConfig = new ConfigResponse(); + controlConfig.setValue(ServerControlPlugin.PROP_PROGRAMPREFIX, "/usr/bin/sudo -u zimbra"); // RHEL 5.0 + controlConfig.setValue(ServerControlPlugin.PROP_TIMEOUT, "300"); + server.setControlConfig(controlConfig); - ConfigResponse props = new ConfigResponse(); - setProductConfig(service, props); + list_servers.add(server); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } - ConfigResponse metricConfig = new ConfigResponse(); - if (serviceSata.length > 2) { - metricConfig.setValue(LogFileTrackPlugin.PROP_FILES_SERVICE, serviceSata[2]); - } - service.setMeasurementConfig(metricConfig); - service.setCustomProperties(new ConfigResponse()); + return list_servers; + } + private final static Service[] SERVICES = { + new Service("MySQL", "/db/mysql.pid"), + new Service("Postfix", "/data/postfix/spool/pid/master.pid"), + new Service("Log Watch", "/log/logswatch.pid"), + new Service("Logger MySQL", "/logger/db/mysql.pid"), + new Service("OpenLDAP", "/openldap/var/run/slapd.pid"), + new Service("Swatch", "/log/swatch.pid"), + new Service("MTA Config", "/log/zmmtaconfig.pid"), + new Service("memcached", "/log/memcached.pid"), + new Service("ClamAV", "/log/clamd.pid", "log/clamd.log"), + new Service("Convertd Monitor", "/log/zmconvertdmon.pid", "log/zmconvertd.log"), + new Service("Jetty Process", "/log/zmmailboxd_java.pid") + }; + private final static Service[] MULTI_SERVICES = { + new Service("AMaViS", "/log/amavisd.pid", null, "amavisd"), + new Service("HTTPD", "/log/httpd.pid"), + new Service("NGINX", "/log/nginx.pid", "log/nginx.log"), + new Service("Cyrus SASL", "/cyrus-sasl/state/saslauthd.pid") + }; + private final static Service[] OTHER_SERVICES = { + new Service("MTAQueue Stats", "/zmstat/mtaqueue.csv"), + new Service("VM Stats", "/zmstat/vm.csv") + }; - services.add(service); - } else { - log.debug("OTHER_SERVICES '" + serviceSata[0] + "(" + serviceSata[1] + ")' not found"); - } - } + private ServiceResource createService(Service serviceData, String path) { + ServiceResource service = new ServiceResource(); + service.setServiceName(serviceData.getName()); + service.setType(this, serviceData.getName()); + service.setDescription(path); - for (int n = 0; n < SERVICES.length; n++) { - String[] serviceSata = SERVICES[n]; - File pidFile = new File(config.getValue("installpath"), serviceSata[1]); - if (pidFile.exists()) { - ServiceResource service = new ServiceResource(); - service.setServiceName(serviceSata[0]); - service.setType(this, serviceSata[0]); - service.setDescription(pidFile.getAbsolutePath()); + ConfigResponse metricConfig = new ConfigResponse(); + if (serviceData.getLog() != null) { + metricConfig.setValue(LogFileTrackPlugin.PROP_FILES_SERVICE, serviceData.getLog()); + } else { + metricConfig.setValue("service.log_track.enable", "false"); + } + service.setMeasurementConfig(metricConfig); - ConfigResponse props = new ConfigResponse(); - String args[] = { pidFile.getAbsolutePath() }; - props.setValue("process.query", MessageFormat.format(PROCESS_PID_QUERY, args)); - setProductConfig(service, props); + return service; + } - ConfigResponse metricConfig = new ConfigResponse(); - if (serviceSata.length > 2) { - metricConfig.setValue(LogFileTrackPlugin.PROP_FILES_SERVICE, serviceSata[2]); - } - service.setMeasurementConfig(metricConfig); - service.setCustomProperties(new ConfigResponse()); + protected List discoverServices(ConfigResponse config) throws PluginException { + log.debug("discoverServices(" + config + ")"); + List services = new ArrayList(); - services.add(service); - } else { - log.debug("SERVICES '" + serviceSata[0] + "(" + serviceSata[1] + ")' not found"); - } - } + for (int n = 0; n < OTHER_SERVICES.length; n++) { + Service serviceData = OTHER_SERVICES[n]; + File csvFile = new File(config.getValue("installpath"), serviceData.getPidFile()); + if (csvFile.exists()) { + ServiceResource service = createService(serviceData, csvFile.getAbsolutePath()); - for (int n = 0; n < MULTI_SERVICES.length; n++) { - String[] serviceSata = MULTI_SERVICES[n]; - File pidFile = new File(config.getValue("installpath"), serviceSata[1]); - log.debug("pidFile='" + pidFile + "'"); - String args[] = { pidFile.getAbsolutePath() }; - String pQuery=MessageFormat.format(PROCESS_PID_QUERY, args); - log.debug("pQuery --> '"+pQuery+"'"); - long[] pids = getPids(pQuery); - if (pids.length > 0) { - long pid = pids[0]; - String exec = getProcExe(pid); - log.debug("'" + serviceSata[0] + "' exec='" + exec + "'"); + ConfigResponse props = new ConfigResponse(); + setProductConfig(service, props); - ServiceResource service = new ServiceResource(); - service.setServiceName(serviceSata[0]); - service.setType(this, serviceSata[0]); - service.setDescription(pidFile.getAbsolutePath()); + service.setCustomProperties(new ConfigResponse()); - ConfigResponse props = new ConfigResponse(); - String[] args2 = { new File(exec).getName() }; - props.setValue("process.query", MessageFormat.format(PROCESS_EXEC, args2)); - setProductConfig(service, props); + services.add(service); + } else { + log.debug("OTHER_SERVICES '" + serviceData.getName() + "(" + serviceData.getPidFile() + ")' not found"); + } + } - service.setMeasurementConfig(new ConfigResponse()); - service.setCustomProperties(new ConfigResponse()); + for (int n = 0; n < SERVICES.length; n++) { + Service serviceData = SERVICES[n]; + File pidFile = new File(config.getValue("installpath"), serviceData.getPidFile()); + if (pidFile.exists()) { + ServiceResource service = createService(serviceData, pidFile.getAbsolutePath()); - services.add(service); - } else { - log.debug("MULTI_SERVICES '" + serviceSata[0] + "(" + serviceSata[1] + ")' not found"); - } - } + ConfigResponse props = new ConfigResponse(); + Object args[] = {pidFile.getAbsolutePath()}; + props.setValue("process.query", MessageFormat.format(PROCESS_PID_QUERY, args)); + setProductConfig(service, props); - long[] pids = getPids("State.Name.eq=java,Args.*.eq=com.zimbra.cs.convertd.TransformationServer"); - if (pids.length > 0) { - ServiceResource service = new ServiceResource(); - service.setServiceName("Convertd"); - service.setType(this, "Convertd"); + service.setCustomProperties(new ConfigResponse()); - ConfigResponse props = new ConfigResponse(); - setProductConfig(service, props); + services.add(service); + } else { + log.debug("SERVICES '" + serviceData.getName() + "(" + serviceData.getPidFile() + ")' not found"); + } + } - ConfigResponse metricConfig = new ConfigResponse(); - metricConfig.setValue(LogFileTrackPlugin.PROP_FILES_SERVICE, - "log/convertd.log"); //relative to installpath + for (int n = 0; n < MULTI_SERVICES.length; n++) { + Service serviceData = MULTI_SERVICES[n]; + log.debug("[discoverServices] -> " + serviceData.getName()); + File pidFile = new File(config.getValue("installpath"), serviceData.getPidFile()); + log.debug("pidFile='" + pidFile + "'"); + Object args[] = {pidFile.getAbsolutePath()}; + String pQuery = MessageFormat.format(PROCESS_PID_QUERY, args); + log.debug("pQuery --> '" + pQuery + "'"); + long[] pids = getPids(pQuery); + if (pids.length > 0) { + long pid = pids[0]; + String exec = getProcExe(pid); + log.debug("'" + serviceData.getName() + "' exec='" + exec + "'"); - service.setMeasurementConfig(metricConfig); - service.setCustomProperties(new ConfigResponse()); + ServiceResource service = createService(serviceData, pidFile.getAbsolutePath()); - services.add(service); - } + ConfigResponse props = new ConfigResponse(); + if (serviceData.getProcess() != null) { + Object[] args2 = {serviceData.getProcess()}; + props.setValue("process.query", MessageFormat.format(PROCESS_EXEC_2, args2)); + } else { + Object[] args2 = {new File(exec).getName()}; + props.setValue("process.query", MessageFormat.format(PROCESS_EXEC, args2)); + } + props.setValue("process.status", pidFile.getAbsolutePath()); + setProductConfig(service, props); + log.debug("process.query = '" + props.getValue("process.query") + "'"); + log.debug("process.status ='" + pidFile.getAbsolutePath() + "'"); - // Stats Process - File dir_pids = new File(config.getValue("installpath"), "/zmstat/pid"); - String[] pids_files = dir_pids.list(new PIDFilter()); - for (int n = 0; n < pids_files.length; n++) { - String pid_file = pids_files[n]; - services.add(cerateStatService(pid_file)); - } + service.setCustomProperties(new ConfigResponse()); - return services; - } + services.add(service); + } else { + log.debug("MULTI_SERVICES '" + serviceData.getName() + "(" + serviceData.getPidFile() + ")' not found"); + } + log.debug("[discoverServices] <- " + serviceData.getName()); + } - private static Pattern p = Pattern.compile("zmstat-(.*).pid"); + long[] pids = getPids("State.Name.eq=java,Args.*.eq=com.zimbra.cs.convertd.TransformationServer"); + if (pids.length > 0) { + ServiceResource service = new ServiceResource(); + service.setServiceName("Convertd"); + service.setType(this, "Convertd"); - private ServiceResource cerateStatService(String file) { - log.debug("cerateStatService('" + file + "')"); - Matcher m = p.matcher(file); - String name = file; - if (m.matches()) - name = m.group(); - ServiceResource servicio = new ServiceResource(); - servicio.setServiceName(name); - servicio.setType(this, "Stats process"); - servicio.setDescription(file); + ConfigResponse props = new ConfigResponse(); + setProductConfig(service, props); - ConfigResponse props = new ConfigResponse(); - props.setValue("pid-file", file); - setProductConfig(servicio, props); + ConfigResponse metricConfig = new ConfigResponse(); + metricConfig.setValue(LogFileTrackPlugin.PROP_FILES_SERVICE, "log/convertd.log"); //relative to installpath + service.setMeasurementConfig(metricConfig); + service.setCustomProperties(new ConfigResponse()); - servicio.setMeasurementConfig(new ConfigResponse()); - servicio.setCustomProperties(new ConfigResponse()); - return servicio; + services.add(service); + } - } + // Stats Process + File dir_pids = new File(config.getValue("installpath"), "/zmstat/pid"); + String[] pids_files = dir_pids.list(new PIDFilter()); + for (int n = 0; n < pids_files.length; n++) { + String pid_file = pids_files[n]; + services.add(cerateStatService(pid_file)); + } - private static class PIDFilter implements FilenameFilter { - public boolean accept(File dir, String name) { - return name.endsWith(".pid"); - } - } + return services; + } + private static Pattern p = Pattern.compile("zmstat-(.*).pid"); + private ServiceResource cerateStatService(String file) { + log.debug("cerateStatService('" + file + "')"); + Matcher m = p.matcher(file); + String name = file; + if (m.matches()) { + name = m.group(); + } + ServiceResource servicio = new ServiceResource(); + servicio.setServiceName(name); + servicio.setType(this, "Stats process"); + servicio.setDescription(file); + + ConfigResponse props = new ConfigResponse(); + props.setValue("pid-file", file); + setProductConfig(servicio, props); + + ConfigResponse metricConfig = new ConfigResponse(); + metricConfig.setValue("service.log_track.enable", "false"); + servicio.setMeasurementConfig(metricConfig); + + servicio.setCustomProperties(new ConfigResponse()); + return servicio; + + } + + private static class PIDFilter implements FilenameFilter { + + public boolean accept(File dir, String name) { + return name.endsWith(".pid"); + } + } + + private boolean checkVersion(String path, String version) { + boolean res = false; + try { + ByteArrayOutputStream output = new ByteArrayOutputStream(); + Execute exec = new Execute(new PumpStreamHandler(output)); + exec.setCommandline( + new String[]{"sudo", "-u", "zimbra", path + "/bin/zmcontrol", "-v"}); + int rc = exec.execute(); + String out = output.toString().trim(); + if (getLog().isDebugEnabled()) { + getLog().debug("output of '" + path + "/bin/zmcontrol -v' : " + out); + } + if (rc == 0) { + Pattern p = Pattern.compile(version.toLowerCase().replaceAll("x", "\\\\d*")); + Matcher m = p.matcher(out); + res = m.find(); + if (!res) { + getLog().debug("m -->" + m); + } + } + } catch (Exception e) { + getLog().warn("Could not get the version of mysql: " + e.getMessage(), e); + } + return res; + } } |
From: <dcr...@hy...> - 2009-11-13 19:53:47
|
Author: dcrutchf Date: 2009-11-13 11:53:35 -0800 (Fri, 13 Nov 2009) New Revision: 13944 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=13944 Modified: trunk/src/org/hyperic/hq/appdef/server/session/AgentDAO.java trunk/src/org/hyperic/hq/appdef/server/session/AgentManagerEJBImpl.java Log: [HHQ-3535] - Agent connection listing not sorted on platform inventory pages Overrode findAll call and added ordering by ip, then port Modified: trunk/src/org/hyperic/hq/appdef/server/session/AgentDAO.java =================================================================== --- trunk/src/org/hyperic/hq/appdef/server/session/AgentDAO.java 2009-11-13 19:51:05 UTC (rev 13943) +++ trunk/src/org/hyperic/hq/appdef/server/session/AgentDAO.java 2009-11-13 19:53:35 UTC (rev 13944) @@ -28,6 +28,7 @@ import java.util.List; import org.hibernate.Query; +import org.hibernate.criterion.Order; import org.hyperic.dao.DAOFactory; import org.hyperic.hibernate.PageInfo; import org.hyperic.hq.appdef.Agent; @@ -66,6 +67,14 @@ return ag; } + public List findAll() { + return getSession() + .createCriteria(Agent.class) + .addOrder(Order.asc("address")) + .addOrder(Order.asc("port")) + .list(); + } + public List findByIP(String ip) { String hql = "from Agent where address=:address"; return getSession() Modified: trunk/src/org/hyperic/hq/appdef/server/session/AgentManagerEJBImpl.java =================================================================== --- trunk/src/org/hyperic/hq/appdef/server/session/AgentManagerEJBImpl.java 2009-11-13 19:51:05 UTC (rev 13943) +++ trunk/src/org/hyperic/hq/appdef/server/session/AgentManagerEJBImpl.java 2009-11-13 19:53:35 UTC (rev 13944) @@ -210,7 +210,7 @@ * @ejb:transaction type="Required" */ public List getAgents(){ - return new ArrayList(getAgentDAO().findAll()); + return getAgentDAO().findAll(); } /** |
From: <dcr...@hy...> - 2009-11-13 19:51:17
|
Author: dcrutchf Date: 2009-11-13 11:51:05 -0800 (Fri, 13 Nov 2009) New Revision: 13943 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=13943 Modified: branches/HQ_4_2/src/org/hyperic/hq/appdef/server/session/AgentDAO.java branches/HQ_4_2/src/org/hyperic/hq/appdef/server/session/AgentManagerEJBImpl.java Log: [HHQ-3535] - Agent connection listing not sorted on platform inventory pages Overrode findAll call and added ordering by ip, then port Modified: branches/HQ_4_2/src/org/hyperic/hq/appdef/server/session/AgentDAO.java =================================================================== --- branches/HQ_4_2/src/org/hyperic/hq/appdef/server/session/AgentDAO.java 2009-11-13 18:33:48 UTC (rev 13942) +++ branches/HQ_4_2/src/org/hyperic/hq/appdef/server/session/AgentDAO.java 2009-11-13 19:51:05 UTC (rev 13943) @@ -28,6 +28,7 @@ import java.util.List; import org.hibernate.Query; +import org.hibernate.criterion.Order; import org.hyperic.dao.DAOFactory; import org.hyperic.hibernate.PageInfo; import org.hyperic.hq.appdef.Agent; @@ -66,6 +67,14 @@ return ag; } + public List findAll() { + return getSession() + .createCriteria(Agent.class) + .addOrder(Order.asc("address")) + .addOrder(Order.asc("port")) + .list(); + } + public List findByIP(String ip) { String hql = "from Agent where address=:address"; return getSession() Modified: branches/HQ_4_2/src/org/hyperic/hq/appdef/server/session/AgentManagerEJBImpl.java =================================================================== --- branches/HQ_4_2/src/org/hyperic/hq/appdef/server/session/AgentManagerEJBImpl.java 2009-11-13 18:33:48 UTC (rev 13942) +++ branches/HQ_4_2/src/org/hyperic/hq/appdef/server/session/AgentManagerEJBImpl.java 2009-11-13 19:51:05 UTC (rev 13943) @@ -210,7 +210,7 @@ * @ejb:transaction type="Required" */ public List getAgents(){ - return new ArrayList(getAgentDAO().findAll()); + return getAgentDAO().findAll(); } /** |
From: <pn...@hy...> - 2009-11-13 18:34:03
|
Author: pnguyen Date: 2009-11-13 10:33:48 -0800 (Fri, 13 Nov 2009) New Revision: 13942 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=13942 Modified: branches/HQ_4_2/src/org/hyperic/hq/authz/server/session/ResourceGroupDAO.java Log: [HHQ-3473] Use service prototype instead of service Modified: branches/HQ_4_2/src/org/hyperic/hq/authz/server/session/ResourceGroupDAO.java =================================================================== --- branches/HQ_4_2/src/org/hyperic/hq/authz/server/session/ResourceGroupDAO.java 2009-11-13 18:31:35 UTC (rev 13941) +++ branches/HQ_4_2/src/org/hyperic/hq/authz/server/session/ResourceGroupDAO.java 2009-11-13 18:33:48 UTC (rev 13942) @@ -436,7 +436,7 @@ Integer protoType = prototype.getResourceType().getId(); if (protoType.equals(AuthzConstants.authzPlatformProto) || protoType.equals(AuthzConstants.authzServerProto) || - protoType.equals(AuthzConstants.authzService)) { + protoType.equals(AuthzConstants.authzServiceProto)) { hql += " or g.groupType = " + AppdefEntityConstants.APPDEF_TYPE_GROUP_ADHOC_PSS; } else if (protoType.equals(AuthzConstants.authzApplicationProto)) { |
From: <pn...@hy...> - 2009-11-13 18:31:47
|
Author: pnguyen Date: 2009-11-13 10:31:35 -0800 (Fri, 13 Nov 2009) New Revision: 13941 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=13941 Modified: trunk/src/org/hyperic/hq/authz/server/session/ResourceGroupDAO.java Log: [HHQ-3473] Use service prototype instead of service Modified: trunk/src/org/hyperic/hq/authz/server/session/ResourceGroupDAO.java =================================================================== --- trunk/src/org/hyperic/hq/authz/server/session/ResourceGroupDAO.java 2009-11-12 18:15:22 UTC (rev 13940) +++ trunk/src/org/hyperic/hq/authz/server/session/ResourceGroupDAO.java 2009-11-13 18:31:35 UTC (rev 13941) @@ -436,7 +436,7 @@ Integer protoType = prototype.getResourceType().getId(); if (protoType.equals(AuthzConstants.authzPlatformProto) || protoType.equals(AuthzConstants.authzServerProto) || - protoType.equals(AuthzConstants.authzService)) { + protoType.equals(AuthzConstants.authzServiceProto)) { hql += " or g.groupType = " + AppdefEntityConstants.APPDEF_TYPE_GROUP_ADHOC_PSS; } else if (protoType.equals(AuthzConstants.authzApplicationProto)) { |
From: <no...@gi...> - 2009-11-13 00:31:00
|
Branch: refs/heads/evolution Home: http://github.com/hyperic/hqapi Commit: cf36f6cee1d1ff1223513123a83528d5193acc85 http://github.com/hyperic/hqapi/commit/cf36f6cee1d1ff1223513123a83528d5193acc85 Author: Jennifer Hickey <jhickey@calculon.local> Date: 2009-11-12 (Thu, 12 Nov 2009) Changed paths: M hqu/hqapi1/app/EventController.groovy Log Message: ----------- Converted EventLogManagerEJB Commit: c397b6060455a79e73c8522b819e5ea58b47245d http://github.com/hyperic/hqapi/commit/c397b6060455a79e73c8522b819e5ea58b47245d Author: Jennifer Hickey <jhickey@calculon.local> Date: 2009-11-12 (Thu, 12 Nov 2009) Changed paths: M hqu/hqapi1/app/EventController.groovy Log Message: ----------- Merge branch 'HE-163' into evolution |
From: <no...@gi...> - 2009-11-12 20:09:40
|
Branch: refs/heads/evolution Home: http://github.com/hyperic/hqapi Commit: 1ed9c3955f182b2a4af741d7e41778f8bd0427b0 http://github.com/hyperic/hqapi/commit/1ed9c3955f182b2a4af741d7e41778f8bd0427b0 Author: Jennifer Hickey <jhickey@calculon.local> Date: 2009-11-12 (Thu, 12 Nov 2009) Changed paths: M hqu/hqapi1/app/ApplicationController.groovy Log Message: ----------- Updated AppdefBoss reference Commit: 97a6e3e1cef5430c8f3ecbfa4e6e22ec71dbb036 http://github.com/hyperic/hqapi/commit/97a6e3e1cef5430c8f3ecbfa4e6e22ec71dbb036 Author: Jennifer Hickey <jhickey@calculon.local> Date: 2009-11-12 (Thu, 12 Nov 2009) Log Message: ----------- Merge branch 'evolution' of gi...@gi...:hyperic/hqapi into evolution |
From: <sc...@hy...> - 2009-11-12 18:15:35
|
Author: scottmf Date: 2009-11-12 10:15:22 -0800 (Thu, 12 Nov 2009) New Revision: 13940 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=13940 Modified: branches/HQ_4_2/src/org/hyperic/hq/measurement/server/session/AvailabilityManagerEJBImpl.java Log: [HHQ-3505] fix potential for NonUniqueObjectExceptions in addData() flow Modified: branches/HQ_4_2/src/org/hyperic/hq/measurement/server/session/AvailabilityManagerEJBImpl.java =================================================================== --- branches/HQ_4_2/src/org/hyperic/hq/measurement/server/session/AvailabilityManagerEJBImpl.java 2009-11-12 18:14:37 UTC (rev 13939) +++ branches/HQ_4_2/src/org/hyperic/hq/measurement/server/session/AvailabilityManagerEJBImpl.java 2009-11-12 18:15:22 UTC (rev 13940) @@ -779,10 +779,18 @@ for (Iterator it=_removeMap.entrySet().iterator(); it.hasNext(); ) { Map.Entry entry = (Map.Entry)it.next(); AvailabilityDataRLE rle = (AvailabilityDataRLE)entry.getValue(); + // if we call remove() on an object which is already in the session + // hibernate will throw NonUniqueObjectExceptions + if (_dao.getSession().contains(rle)) { + _dao.getSession().evict(rle); + } _dao.remove(rle); } - // for some reason if flush is not run, then create() will throw - // Hibernate NonUniqueObjectExceptions + // addData() could be overwriting RLE data points (i.e. from 0.0 to 1.0) + // with the same ID. If this is the scenario, then we must run + // flush() in order to ensure that these old objects are not in the + // session when the equivalent create() on the same ID is run, + // thus avoiding NonUniqueObjectExceptions _dao.getSession().flush(); for (Iterator it=_createMap.entrySet().iterator(); it.hasNext(); ) { Map.Entry entry = (Map.Entry)it.next(); |
From: <sc...@hy...> - 2009-11-12 18:14:49
|
Author: scottmf Date: 2009-11-12 10:14:37 -0800 (Thu, 12 Nov 2009) New Revision: 13939 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=13939 Modified: trunk/src/org/hyperic/hq/measurement/server/session/AvailabilityManagerEJBImpl.java Log: [HHQ-3505] fix potential for NonUniqueObjectExceptions in addData() flow Modified: trunk/src/org/hyperic/hq/measurement/server/session/AvailabilityManagerEJBImpl.java =================================================================== --- trunk/src/org/hyperic/hq/measurement/server/session/AvailabilityManagerEJBImpl.java 2009-11-11 20:54:40 UTC (rev 13938) +++ trunk/src/org/hyperic/hq/measurement/server/session/AvailabilityManagerEJBImpl.java 2009-11-12 18:14:37 UTC (rev 13939) @@ -779,10 +779,18 @@ for (Iterator it=_removeMap.entrySet().iterator(); it.hasNext(); ) { Map.Entry entry = (Map.Entry)it.next(); AvailabilityDataRLE rle = (AvailabilityDataRLE)entry.getValue(); + // if we call remove() on an object which is already in the session + // hibernate will throw NonUniqueObjectExceptions + if (_dao.getSession().contains(rle)) { + _dao.getSession().evict(rle); + } _dao.remove(rle); } - // for some reason if flush is not run, then create() will throw - // Hibernate NonUniqueObjectExceptions + // addData() could be overwriting RLE data points (i.e. from 0.0 to 1.0) + // with the same ID. If this is the scenario, then we must run + // flush() in order to ensure that these old objects are not in the + // session when the equivalent create() on the same ID is run, + // thus avoiding NonUniqueObjectExceptions _dao.getSession().flush(); for (Iterator it=_createMap.entrySet().iterator(); it.hasNext(); ) { Map.Entry entry = (Map.Entry)it.next(); |
From: <bo...@hy...> - 2009-11-11 20:54:55
|
Author: bob Date: 2009-11-11 12:54:40 -0800 (Wed, 11 Nov 2009) New Revision: 13938 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=13938 Modified: branches/HQ_4_2/etc/version.properties Log: Release 4.2.1 build #1261 Modified: branches/HQ_4_2/etc/version.properties =================================================================== --- branches/HQ_4_2/etc/version.properties 2009-11-11 19:36:16 UTC (rev 13937) +++ branches/HQ_4_2/etc/version.properties 2009-11-11 20:54:40 UTC (rev 13938) @@ -1,3 +1,3 @@ -#Fri Oct 30 12:14:25 PDT 2009 +#Wed Nov 11 12:25:03 PST 2009 version=4.2.1 -build=1260 +build=1261 |
From: <bo...@hy...> - 2009-11-11 19:36:28
|
Author: bob Date: 2009-11-11 11:36:16 -0800 (Wed, 11 Nov 2009) New Revision: 13937 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=13937 Modified: branches/HQ_4_2/etc/version.properties Log: update verion to 4.2.1 Modified: branches/HQ_4_2/etc/version.properties =================================================================== --- branches/HQ_4_2/etc/version.properties 2009-11-11 19:16:17 UTC (rev 13936) +++ branches/HQ_4_2/etc/version.properties 2009-11-11 19:36:16 UTC (rev 13937) @@ -1,3 +1,3 @@ #Fri Oct 30 12:14:25 PDT 2009 -version=4.2.0 +version=4.2.1 build=1260 |
From: <do...@hy...> - 2009-11-11 19:16:30
|
Author: dougm Date: 2009-11-11 11:16:17 -0800 (Wed, 11 Nov 2009) New Revision: 13936 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=13936 Modified: trunk/src/org/hyperic/hq/common/shared/ProductProperties.java Log: (HHQ-3528) make sure ProductProperties.getProperties() finds the right files Modified: trunk/src/org/hyperic/hq/common/shared/ProductProperties.java =================================================================== --- trunk/src/org/hyperic/hq/common/shared/ProductProperties.java 2009-11-11 19:13:43 UTC (rev 13935) +++ trunk/src/org/hyperic/hq/common/shared/ProductProperties.java 2009-11-11 19:16:17 UTC (rev 13936) @@ -27,7 +27,9 @@ import java.io.IOException; import java.io.InputStream; +import java.net.URL; +import java.util.Enumeration; import java.util.Properties; import org.apache.commons.logging.Log; @@ -74,11 +76,39 @@ } private static void load(String name, boolean required) { - InputStream in = - ProductProperties.class.getClassLoader(). - getResourceAsStream(name); + //XXX unhardcode these filenames here and elsewhere + final String[] jars = { //we should find one or the other + "hq-product.jar", //agent side (including command-line) + "hq.jar" //server side + }; + ClassLoader loader = ProductProperties.class.getClassLoader(); + InputStream in = null; + try { //XXX must be better way other than renaming these files w/ an hq- prefix? + //HHQ-3528 make sure we find {version,product}.properties in the right place(s) + //also note AgentCommandsService.upgrade has its own way but only works for the agent + for (Enumeration urls = loader.getResources(name); urls.hasMoreElements(); ) { + URL url = (URL)urls.nextElement(); + for (int i=0; i<jars.length; i++) { + //example: url == file:/.../pdk/lib/hq-product.jar!/version.properties + if (url.getFile().endsWith(jars[i] + "!/" + name)) { + in = url.openStream(); + _log.debug("Found " + name + " via " + url); + break; + } + } + } + } catch (IOException e) { + //fallthru + } if (in == null) { + //fallback to the old fashioned way + if ((in = loader.getResourceAsStream(name)) != null) { + _log.debug("Found " + name + " via getResourceAsStream"); + } + } + + if (in == null) { if (required) { throw new IllegalStateException("Package not packed " + "correctly, missing: " + name); |
From: <do...@hy...> - 2009-11-11 18:09:29
|
Author: dougm Date: 2009-11-11 10:09:18 -0800 (Wed, 11 Nov 2009) New Revision: 13934 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=13934 Modified: trunk/src/org/hyperic/hq/product/util/PluginDumper.java Log: [HHQ-3528] add -v (version) option Modified: trunk/src/org/hyperic/hq/product/util/PluginDumper.java =================================================================== --- trunk/src/org/hyperic/hq/product/util/PluginDumper.java 2009-11-11 16:49:13 UTC (rev 13933) +++ trunk/src/org/hyperic/hq/product/util/PluginDumper.java 2009-11-11 18:09:18 UTC (rev 13934) @@ -46,6 +46,7 @@ import java.util.Properties; import org.hyperic.hq.agent.AgentConfig; +import org.hyperic.hq.common.shared.ProductProperties; import org.hyperic.hq.measurement.UnitsConvert; import org.hyperic.hq.product.AutoinventoryPluginManager; import org.hyperic.hq.product.CollectorExecutor; @@ -262,7 +263,7 @@ private void getopt(String[] args) { int opt; Getopt parser = - new Getopt("plugindumper", args, "hp:t:m:a:o:D:"); + new Getopt("plugindumper", args, "hvp:t:m:a:o:D:"); parser.setOpterr(false); PluginDumperConfig config = this.config; @@ -296,6 +297,10 @@ config.props.setProperty(key, val); config.defines.setProperty(key, val); break; + case 'v': + System.out.println(ProductProperties.getVersion() + + " (build #" + ProductProperties.getBuild() + ")"); + break; case 'h': default: config.help = true; |
From: <kp...@hy...> - 2009-11-11 16:49:27
|
Author: kparikh Date: 2009-11-11 08:49:13 -0800 (Wed, 11 Nov 2009) New Revision: 13933 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=13933 Added: tags/HQ_4_2_0_GA/ Log: Adding 4.2.0 GA Tag Copied: tags/HQ_4_2_0_GA (from rev 13918, branches/HQ_4_2) |
From: <no...@gi...> - 2009-11-11 03:58:37
|
Branch: refs/heads/evolution Home: http://github.com/hyperic/hqapi Commit: 8fe69785a53cc5ca1896e24c42a74ce5b8256b2e http://github.com/hyperic/hqapi/commit/8fe69785a53cc5ca1896e24c42a74ce5b8256b2e Author: Jennifer Hickey <jen...@sp...> Date: 2009-11-10 (Tue, 10 Nov 2009) Changed paths: M hqu/hqapi1/app/ApplicationController.groovy Log Message: ----------- HE-152 Converted AppdefBossEJB |
From: <do...@hy...> - 2009-11-10 22:59:06
|
Author: dougm Date: 2009-11-10 14:58:51 -0800 (Tue, 10 Nov 2009) New Revision: 13932 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=13932 Modified: trunk/src/org/hyperic/hq/product/Win32EventLogNotification.java Log: [HHQ-3522] Add 'category' to eventlog format options Modified: trunk/src/org/hyperic/hq/product/Win32EventLogNotification.java =================================================================== --- trunk/src/org/hyperic/hq/product/Win32EventLogNotification.java 2009-11-10 16:28:55 UTC (rev 13931) +++ trunk/src/org/hyperic/hq/product/Win32EventLogNotification.java 2009-11-10 22:58:51 UTC (rev 13932) @@ -101,6 +101,7 @@ user = "N/A"; } setProp(props, "user", user); + setProp(props, "category", record.getCategoryString()); msg = Metric.translate(this.format, props); } |
From: <do...@hy...> - 2009-11-10 01:11:02
|
Author: dougm Date: 2009-11-09 17:10:49 -0800 (Mon, 09 Nov 2009) New Revision: 13930 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=13930 Modified: trunk/src/org/hyperic/hq/product/Win32EventLogNotification.java Log: [HHQ-3522] Support user defined format of Windows Event Log messages Modified: trunk/src/org/hyperic/hq/product/Win32EventLogNotification.java =================================================================== --- trunk/src/org/hyperic/hq/product/Win32EventLogNotification.java 2009-11-06 01:27:44 UTC (rev 13929) +++ trunk/src/org/hyperic/hq/product/Win32EventLogNotification.java 2009-11-10 01:10:49 UTC (rev 13930) @@ -25,6 +25,8 @@ package org.hyperic.hq.product; +import java.util.Properties; + import org.hyperic.sigar.win32.EventLogNotification; import org.hyperic.sigar.win32.EventLogRecord; import org.hyperic.sigar.win32.EventLog; @@ -39,12 +41,20 @@ { public static final String PROP_EVENT_LOGS = "platform.log_track.eventlogs"; - + private static final String PROP_EVENT_FMT = + "platform.log_track.eventfmt"; private LogTrackPlugin plugin; + private String format; public Win32EventLogNotification(LogTrackPlugin plugin) { super(); this.plugin = plugin; + this.format = plugin.getManagerProperty(PROP_EVENT_FMT); + if (this.format != null) { + //override default message format + plugin.getLog().debug("Using " + PROP_EVENT_FMT + + "='" + this.format + "'"); + } } public abstract boolean matches(EventLogRecord record); @@ -59,13 +69,40 @@ return name; } + private void setProp(Properties props, String key, String val) { + if (val == null) { + val = "-"; + } + props.setProperty(key, val); + } + public void handleNotification(EventLogRecord record) { // Make time in milliseconds long generated = record.getTimeGenerated() * 1000; - // Message will include source name - String msg = record.getSource() + ": " + record.getMessage(); + String msg; + if (this.format == null) { + //Default - Message will include source name + msg = record.getSource() + ": " + record.getMessage(); + } + else { + //User defined, example: + //platform.log_track.eventfmt=%user%@%computer% %source%:%event%:%message% + Properties props = new Properties(); + setProp(props, "computer", record.getComputerName()); + setProp(props, "event", String.valueOf(record.getEventId() & 0xFFFF)); + setProp(props, "type", record.getEventTypeString()); + setProp(props, "log", record.getLogName()); + setProp(props, "message", record.getMessage()); + setProp(props, "source", record.getSource()); + String user = record.getUser(); + if (user == null) { + user = "N/A"; + } + setProp(props, "user", user); + msg = Metric.translate(this.format, props); + } TrackEvent event = this.plugin.newTrackEvent(generated, |
From: <no...@gi...> - 2009-11-09 23:50:05
|
Branch: refs/heads/evolution Home: http://github.com/hyperic/hqapi Commit: 75b68803616e69042ed1aba5d2eed3c203943d8f http://github.com/hyperic/hqapi/commit/75b68803616e69042ed1aba5d2eed3c203943d8f Author: Jennifer Hickey <jen...@sp...> Date: 2009-11-09 (Mon, 09 Nov 2009) Changed paths: M hqu/hqapi1/app/AlertdefinitionController.groovy Log Message: ----------- HE-131 Converted EventsBossEJB |
From: <no...@gi...> - 2009-11-06 23:57:48
|
Branch: refs/heads/master Home: http://github.com/hyperic/hqapi Commit: 92e8523ab5b8815342bf2dd5ff4e9161f97a55f4 http://github.com/hyperic/hqapi/commit/92e8523ab5b8815342bf2dd5ff4e9161f97a55f4 Author: pnguyen <pnguyen@10.2.0.125> Date: 2009-11-06 (Fri, 06 Nov 2009) Changed paths: M hqu/hqapi1/app/AlertdefinitionController.groovy M src/org/hyperic/hq/hqapi1/test/AlertDefinitionTestBase.java M xsd/HQApi1.xsd Log Message: ----------- Added recoverId to AlertCondition to better validate recovery alert definitions. Validate all of the child recovery alert definitions. |
From: <no...@gi...> - 2009-11-06 21:48:03
|
Branch: refs/heads/master Home: http://github.com/hyperic/hqapi Commit: 946453481aa9562b96c58523a627810541f96bb8 http://github.com/hyperic/hqapi/commit/946453481aa9562b96c58523a627810541f96bb8 Author: pnguyen <pnguyen@10.2.0.125> Date: 2009-11-06 (Fri, 06 Nov 2009) Changed paths: M src/org/hyperic/hq/hqapi1/test/AlertDefinitionTestBase.java M src/org/hyperic/hq/hqapi1/test/AlertFireRecovery_test.java M src/org/hyperic/hq/hqapi1/test/AlertTestBase.java M src/org/hyperic/hq/hqapi1/test/HierarchicalAlertingTestBase.java M src/org/hyperic/hq/hqapi1/test/MaintenanceGet_test.java M src/org/hyperic/hq/hqapi1/test/MaintenanceSchedule_test.java M src/org/hyperic/hq/hqapi1/test/MaintenanceTestBase.java Log Message: ----------- Added a maintenance test case with live alerts |
From: <tr...@hy...> - 2009-11-06 02:13:26
|
Author: trader Date: 2009-11-05 17:27:44 -0800 (Thu, 05 Nov 2009) New Revision: 13929 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=13929 Modified: trunk/src/org/hyperic/hq/measurement/agent/server/SenderThread.java Log: Small logic tweak, minimal performance impact since the Record object already is implemented to calculate hashcode once. I feel this is a more straightforward use of the Set interface. Modified: trunk/src/org/hyperic/hq/measurement/agent/server/SenderThread.java =================================================================== --- trunk/src/org/hyperic/hq/measurement/agent/server/SenderThread.java 2009-11-05 19:25:39 UTC (rev 13928) +++ trunk/src/org/hyperic/hq/measurement/agent/server/SenderThread.java 2009-11-06 01:27:44 UTC (rev 13929) @@ -379,9 +379,9 @@ { try { Record r = SenderThread.decodeRecord((String)it.next()); - if (!records.contains(r)) { - records.add(r); - } else { + boolean didNotAlreadyExist = records.add(r); + if (!didNotAlreadyExist) { + // nuke the dup if (debug) log.debug("Dropping duplicate entry for " + r); numUsed--; } |
From: <no...@gi...> - 2009-11-05 22:18:14
|
Branch: refs/heads/master Home: http://github.com/hyperic/hqapi Commit: fe1743bb3fd3272f9ba86aacf78d04c384533220 http://github.com/hyperic/hqapi/commit/fe1743bb3fd3272f9ba86aacf78d04c384533220 Author: pnguyen <pnguyen@10.2.0.125> Date: 2009-11-05 (Thu, 05 Nov 2009) Changed paths: M src/org/hyperic/hq/hqapi1/test/RoleGetRole_test.java Log Message: ----------- Guest role can have more than one user |
From: <no...@gi...> - 2009-11-05 21:56:29
|
Branch: refs/heads/master Home: http://github.com/hyperic/hqapi Commit: 7dbbab421c160ed2056ca627ab3446e29d7b7759 http://github.com/hyperic/hqapi/commit/7dbbab421c160ed2056ca627ab3446e29d7b7759 Author: pnguyen <pnguyen@10.2.0.125> Date: 2009-11-05 (Thu, 05 Nov 2009) Changed paths: M hqu/hqapi1/app/MaintenanceController.groovy M src/org/hyperic/hq/hqapi1/test/HQApiTestBase.java M src/org/hyperic/hq/hqapi1/test/MaintenanceGet_test.java M src/org/hyperic/hq/hqapi1/test/MaintenanceSchedule_test.java M src/org/hyperic/hq/hqapi1/test/MaintenanceTestBase.java M src/org/hyperic/hq/hqapi1/test/MaintenanceUnschedule_test.java M src/org/hyperic/hq/hqapi1/test/RoleTestBase.java Log Message: ----------- Added 5 maintenance permission test cases |
From: <gla...@hy...> - 2009-11-05 19:25:51
|
Author: glaullon Date: 2009-11-05 11:25:39 -0800 (Thu, 05 Nov 2009) New Revision: 13928 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=13928 Modified: trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/ConnectionPoolCollector.java trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/EJBCollector.java trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereCollector.java trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereDetector.java trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereProductPlugin.java trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereServerCollector.java trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereUtil.java Log: support WAS 7 Modified: trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/ConnectionPoolCollector.java =================================================================== --- trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/ConnectionPoolCollector.java 2009-11-05 19:25:20 UTC (rev 13927) +++ trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/ConnectionPoolCollector.java 2009-11-05 19:25:39 UTC (rev 13928) @@ -5,10 +5,10 @@ * Kit or the Hyperic Client Development Kit - this is merely considered * normal use of the program, and does *not* fall under the heading of * "derived work". - * + * * Copyright (C) [2004, 2005, 2006], Hyperic, Inc. * This file is part of HQ. - * + * * HQ is free software; you can redistribute it and/or modify * it under the terms version 2 of the GNU General Public License as * published by the Free Software Foundation. This program is distributed @@ -16,7 +16,7 @@ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 @@ -99,7 +99,7 @@ "j2eeType=JDBCResource," + "name=" + getModuleName() + "," + getProcessAttributes()); - + this.name = resolve(mServer, this.name); } Modified: trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/EJBCollector.java =================================================================== --- trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/EJBCollector.java 2009-11-05 19:25:20 UTC (rev 13927) +++ trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/EJBCollector.java 2009-11-05 19:25:39 UTC (rev 13928) @@ -5,10 +5,10 @@ * Kit or the Hyperic Client Development Kit - this is merely considered * normal use of the program, and does *not* fall under the heading of * "derived work". - * + * * Copyright (C) [2004, 2005, 2006], Hyperic, Inc. * This file is part of HQ. - * + * * HQ is free software; you can redistribute it and/or modify * it under the terms version 2 of the GNU General Public License as * published by the Free Software Foundation. This program is distributed @@ -16,7 +16,7 @@ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 @@ -47,7 +47,7 @@ "J2EEApplication=" + app + "," + "name=" + ejb + "," + getProcessAttributes()); - + this.name = resolve(mServer, this.name); } Modified: trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereCollector.java =================================================================== --- trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereCollector.java 2009-11-05 19:25:20 UTC (rev 13927) +++ trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereCollector.java 2009-11-05 19:25:39 UTC (rev 13928) @@ -5,10 +5,10 @@ * Kit or the Hyperic Client Development Kit - this is merely considered * normal use of the program, and does *not* fall under the heading of * "derived work". - * + * * Copyright (C) [2004, 2005, 2006], Hyperic, Inc. * This file is part of HQ. - * + * * HQ is free software; you can redistribute it and/or modify * it under the terms version 2 of the GNU General Public License as * published by the Free Software Foundation. This program is distributed @@ -16,7 +16,7 @@ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 @@ -73,13 +73,13 @@ protected String getServerAttributes() { return "J2EEServer=" + getServerName() + "," + - "node=" + getNodeName(); + "node=" + getNodeName(); } protected String getProcessAttributes() { return "process=" + getServerName() + "," + - "node=" + getNodeName(); + "node=" + getNodeName(); } protected void init() throws PluginException { @@ -124,7 +124,7 @@ log.error(e.getMessage(), e); return null; } - + } protected ObjectName resolve(AdminClient mServer, ObjectName name) @@ -185,7 +185,7 @@ log.error("Unsupported stat type: " + stat.getName() + "/" + stat.getClass().getName()); return MetricValue.VALUE_NONE; - } + } } protected double getStatCount(Stats stats, String metric) { @@ -200,7 +200,7 @@ for (int i=0; i<attrs.length; i++) { String[] entry = attrs[i]; String statKey = entry[0]; - String pmiKey = entry.length == 1 ? statKey : entry[1]; + String pmiKey = entry.length == 1 ? statKey : entry[1]; double val = getStatCount(stats, statKey); if (val == MetricValue.VALUE_NONE) { continue; Modified: trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereDetector.java =================================================================== --- trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereDetector.java 2009-11-05 19:25:20 UTC (rev 13927) +++ trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereDetector.java 2009-11-05 19:25:39 UTC (rev 13928) @@ -32,6 +32,7 @@ import java.io.IOException; import java.io.Reader; +import java.util.Arrays; import java.util.ArrayList; import java.util.List; import java.util.Properties; @@ -63,7 +64,7 @@ WebsphereProductPlugin.PROP_ADMIN_HOST }; - protected Log log = + static protected Log log = LogFactory.getLog(WebsphereDetector.class.getName()); private static final String PTQL_QUERY = @@ -116,6 +117,8 @@ } private File findServerIndex() { + log.debug("[findServerIndex] installpath='"+this.installpath+"'"); + //any serverindex.xml will do. File[] cells = new File(this.installpath + "/config/cells").listFiles(); @@ -124,6 +127,8 @@ return null; } + log.debug("[findServerIndex] cells="+Arrays.asList(cells)); + for (int i=0; i<cells.length; i++) { File[] nodes = new File(cells[i], "nodes").listFiles(); @@ -135,6 +140,7 @@ for (int j=0; j<nodes.length; j++) { File index = new File(nodes[j], "serverindex.xml"); if (index.exists() && index.canRead()) { + log.debug("[findServerIndex] index='"+index.getAbsolutePath()+"'"); return index; } } @@ -361,52 +367,49 @@ static final String VERSION_START = "<version>"; static final String VERSION_END = "</version>"; - protected String getComponentVersion(File file) { + protected static String getComponentVersion(File file) { Reader reader = null; + String res = ""; try { reader = new FileReader(file); - BufferedReader buffer = - new BufferedReader(reader); + BufferedReader buffer = new BufferedReader(reader); String line; while ((line = buffer.readLine()) != null) { line = line.trim(); - if (line.length() == 0) { - continue; + int ix = line.indexOf(VERSION_END); + if (line.startsWith(VERSION_START) && (ix != -1)) { + res = line.substring(VERSION_START.length(), ix).trim(); } - int ix; - if (!(line.startsWith(VERSION_START) && - ((ix = line.indexOf(VERSION_END)) != -1))) - { - continue; - } - - return line.substring(VERSION_START.length(), ix).trim(); } - - return null; } catch (IOException e) { - return null; + if (log.isDebugEnabled()) { + log.error("Error getting the WAS version: " + e.getMessage(), e); + } + res = null; } finally { if (reader != null) { try { reader.close(); - } catch (IOException e) {} + } catch (IOException e) { + } } } + return res; } protected boolean isComponentVersion(File file) { String version = getComponentVersion(file); - if (version == null) { - return false; - } + log.debug("version= '"+version+"' type='"+getTypeInfo().getVersion()+"'"); return version.startsWith(getTypeInfo().getVersion()); } protected List getServerList(File serverDir, String version) throws PluginException { + + log.debug("[getServerList] ("+version+") "+serverDir); + File controlScript = null; if (!isServiceControl()) { @@ -532,7 +535,7 @@ for (int i=0; i<processes.size(); i++) { Process process = (Process)processes.get(i); - List found = getServerList(new File(process.installRoot), null); + List found = getServerList(new File(process.serverRoot), null); if (found != null) { servers.addAll(found); } Modified: trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereProductPlugin.java =================================================================== --- trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereProductPlugin.java 2009-11-05 19:25:20 UTC (rev 13927) +++ trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereProductPlugin.java 2009-11-05 19:25:39 UTC (rev 13928) @@ -5,10 +5,10 @@ * Kit or the Hyperic Client Development Kit - this is merely considered * normal use of the program, and does *not* fall under the heading of * "derived work". - * + * * Copyright (C) [2004, 2005, 2006], Hyperic, Inc. * This file is part of HQ. - * + * * HQ is free software; you can redistribute it and/or modify * it under the terms version 2 of the GNU General Public License as * published by the Free Software Foundation. This program is distributed @@ -16,7 +16,7 @@ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 @@ -50,7 +50,7 @@ import org.hyperic.sigar.win32.Win32Exception; public class WebsphereProductPlugin extends ProductPlugin { - + public static final String NAME = "websphere"; public static final String SERVER_NAME = "WebSphere"; @@ -78,7 +78,7 @@ public static final String PROP_SERVER_NODE = "server.node"; public static final String PROP_SERVER_NAME = "server.name"; public static final String PROP_SERVER_PORT = "server.port"; - + public static final String PROP_THRPOOL_NAME = "thrpool"; public static final String PROP_CONNPOOL_NAME = "connpool"; public static final String PROP_APP_NAME = "app"; @@ -102,7 +102,8 @@ "5.1.0.0", "5.0.0.0", "6.0.0.0", - "6.1.0.0" + "6.1.0.0", + "7.0.0.0" }; private static Log log = LogFactory.getLog("WebsphereProductPlugin"); @@ -124,7 +125,7 @@ } String javaHome = System.getProperty("java.home"); - + File dir = new File(javaHome); //exists in both 4.0 and 5.0 @@ -219,7 +220,7 @@ } if (dir == null) { - log.debug("Unable to determine " + PROP_INSTALLPATH); + log.debug("Unable to determine " + PROP_INSTALLPATH); return null; } else { @@ -251,12 +252,12 @@ for (int j=0; j<jars.length; j++) { if (!jars[j].endsWith(".jar")) { continue; + } + + log.debug("Classpath += " + dir + jars[j]); + path.add(dir + jars[j]); } - - log.debug("Classpath += " + dir + jars[j]); - path.add(dir + jars[j]); } - } //jar names minus version "_6.1.0.jar" private void addClassPathOSGi(List path, @@ -273,10 +274,9 @@ new File(dir).list(new FilenameFilter() { public boolean accept(File dir, String name) { int ix = name.indexOf('_'); - if (ix == -1) { - return false; + if (ix != -1) { + name = name.substring(0, ix); } - name = name.substring(0, ix); return wantedJars.get(name) != null; } }); @@ -307,7 +307,7 @@ continue; } InputStream entryStream = jar.getInputStream(entry); - + os.putNextEntry(entry); while ((n = entryStream.read(buffer)) != -1) { os.write(buffer, 0, n); @@ -362,12 +362,12 @@ if (jar.isDirectory() || !jars[j].endsWith(".jar")) { continue; } - + if (jars[j].startsWith("com.ibm.ws.webservices.thinclient")) { // skip continue; } - + log.debug("classpath += " + jar); if (jars[j].startsWith("com.ibm.ws.runtime_")) { jar = runtimeJarHack(jar); @@ -381,17 +381,55 @@ private String[] getClassPathOSGi(String installDir) { ArrayList path = new ArrayList(); - final String[] plugins = { - "com.ibm.ws.runtime", - "com.ibm.ws.security.crypto", - "org.eclipse.osgi", - }; - addClassPathOSGi(path, installDir + "/plugins/", plugins); + String v = WebsphereDetector.getComponentVersion(new File(installDir, "properties/version/WAS.product")); + if (v.startsWith("6")) { - final String[] runtimes = { - "com.ibm.ws.webservices.thinclient", - }; - addClassPathOSGi(path, installDir + "/runtimes/", runtimes); + final String[] lib = { + "bootstrap.jar", + "j2ee.jar", + "launchclient.jar", + "mail-impl.jar" + }; + addClassPathOSGi(path, installDir + "/lib/", lib); + + final String[] plugins = { + "com.ibm.ws.bootstrap", + "com.ibm.ws.emf", + "com.ibm.ws.security.crypto", + "com.ibm.ws.wccm", + "org.eclipse.core.runtime", + "org.eclipse.osgi", + "com.ibm.ws.runtime",}; + addClassPathOSGi(path, installDir + "/plugins/", plugins); + + final String[] runtimes = { + "com.ibm.ws.admin.client",}; + addClassPathOSGi(path, installDir + "/runtimes/", runtimes); + + } else if (v.startsWith("7")) { + final String[] lib = { + "bootstrap.jar",}; + addClassPathOSGi(path, installDir + "/lib/", lib); + + final String[] plugins = { + "com.ibm.ffdc.jar", + "com.ibm.ws.security.crypto.jar", + "com.ibm.ws.admin.core.jar", + "com.ibm.ws.runtime.jar", + "com.ibm.ws.emf.jar", + "org.eclipse.emf.ecore.jar", + "org.eclipse.emf.common.jar", + "com.ibm.ws.prereq.soap.jar", + "com.ibm.ws.prereq.javamail.jar", + "com.ibm.wsfp.main.jar", + "javax.j2ee.management.jar",}; + addClassPathOSGi(path, installDir + "/plugins/", plugins); + } else { + if (log.isDebugEnabled()) { + log.error("Unknown version '" + v + "'"); + } + } + path.add("pdk/lib/mx4j/hq-jmx.jar"); String[] cp = new String[path.size()]; path.toArray(cp); @@ -433,17 +471,17 @@ installDir + File.separator + "properties" + File.separator + "sas.client.props"; - String corbaConfig = + String corbaConfig = managerProps.getProperty("websphere.CORBA.ConfigURL", defaultCorbaConfig); System.setProperty("com.ibm.CORBA.ConfigURL", "file:" + corbaConfig); - String defaultSoapProps = + String defaultSoapProps = "properties" + File.separator + "soap.client.props"; - File installPropertiesDir = + File installPropertiesDir = getInstallPropertiesDir(installDir, defaultSoapProps); String soapConfig = null; File soapConfigFile = null; @@ -451,16 +489,16 @@ String defaultSoapConfig = installPropertiesDir.getPath(); log.debug("default soap config is " + defaultSoapConfig); - soapConfig = + soapConfig = managerProps.getProperty("websphere.SOAP.ConfigURL", defaultSoapConfig); soapConfigFile = new File(soapConfig); hasSoapConfig = soapConfigFile.exists(); } - + if (hasSoapConfig) { - log.debug("Using soap properties: " + soapConfig); + log.debug("Using soap properties: " + soapConfig); System.setProperty("com.ibm.SOAP.ConfigURL", "file:" + soapConfig); } @@ -479,7 +517,7 @@ new File(soapConfigFile.getParent(), "ssl.client.props"); } - + if (sslConfigFile != null && sslConfigFile.exists()) { log.debug("Using ssl properties: " + sslConfigFile); System.setProperty("com.ibm.SSL.ConfigURL", @@ -571,21 +609,21 @@ "pdk/lib/mx4j/hq-jmx.jar" }; } - + File getInstallPropertiesDir(String installDir, String lookFor) { File result = getInstallPropertiesDirForWAS61(lookFor); - + if (result == null) { result = getInstallPropertiesDirForWAS60(installDir, lookFor); } - + return result; } - + File getInstallPropertiesDirForWAS61(String lookFor) { - + File result = null; - + List servers = getServerProcessList(); if (servers.size() != 0) { for (Iterator it = servers.iterator(); it.hasNext(); ) { @@ -603,16 +641,16 @@ } } } - + return result; } - + List getServerProcessList() { return WebsphereDetector.getServerProcessList(); } File getInstallPropertiesDirForWAS60(String installDir, String lookFor) { - + File result = null; File profileDir = new File(installDir + File.separator + "profiles"); @@ -649,7 +687,7 @@ } } } - + return result; } } Modified: trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereServerCollector.java =================================================================== --- trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereServerCollector.java 2009-11-05 19:25:20 UTC (rev 13927) +++ trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereServerCollector.java 2009-11-05 19:25:39 UTC (rev 13928) @@ -87,26 +87,6 @@ this.name = null; } } - else if (module.equals("servletSessionsModule")) { - this.name = null; //XXX - setSource(module); - } - else if (module.equals("webappModule")) { - this.name = null; //XXX - setSource(module); - } - else if (module.equals("beanModule")) { - this.name = null; //XXX - setSource(module); - } - else if (module.equals("threadPoolModule")) { - this.name = null; //XXX - setSource(module); - } - else if (module.equals("connectionPoolModule")) { - this.name = null; //XXX - setSource(module); - } } public void collect() { Modified: trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereUtil.java =================================================================== --- trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereUtil.java 2009-11-05 19:25:20 UTC (rev 13927) +++ trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereUtil.java 2009-11-05 19:25:39 UTC (rev 13928) @@ -5,10 +5,10 @@ * Kit or the Hyperic Client Development Kit - this is merely considered * normal use of the program, and does *not* fall under the heading of * "derived work". - * + * * Copyright (C) [2004, 2005, 2006], Hyperic, Inc. * This file is part of HQ. - * + * * HQ is free software; you can redistribute it and/or modify * it under the terms version 2 of the GNU General Public License as * published by the Free Software Foundation. This program is distributed @@ -16,7 +16,7 @@ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 @@ -60,14 +60,14 @@ private static HashMap cache = new HashMap(); private static Log log = LogFactory.getLog("WebSphereUtil"); - + // WAS doesn't expose these anywhere we've found yet private static final String TRUST_STORE = "javax.net.ssl.trustStore"; private static final String KEY_STORE = "javax.net.ssl.keyStore"; private static final String TRUST_STORE_PWD = "javax.net.ssl.trustStorePassword"; private static final String KEY_STORE_PWD = "javax.net.ssl.keyStorePassword"; - public static Object getRemoteMBeanValue(Metric metric) + public static Object getRemoteMBeanValue(Metric metric) throws MetricNotFoundException, MetricUnreachableException, PluginException { @@ -75,7 +75,7 @@ return getRemoteMBeanValue(metric, metric.getAttributeName()); } - public static Object getRemoteMBeanValue(Metric metric, String attributeName) + public static Object getRemoteMBeanValue(Metric metric, String attributeName) throws MetricNotFoundException, MetricUnreachableException, PluginException { @@ -89,7 +89,7 @@ } catch (MalformedObjectNameException e) { throw new MetricInvalidException(e.getMessage(), e); } - + try { return mServer.getAttribute(objName, metric.getAttributeName()); @@ -117,7 +117,7 @@ throws MetricUnreachableException { Properties props = getAdminProperties(cfg); - + if (log.isDebugEnabled()) { log.debug("Attempting to create admin client with props " + props + " from config " + cfg); @@ -147,26 +147,26 @@ String port = cfg.getProperty(WebsphereProductPlugin.PROP_ADMIN_PORT, "8880"); - + Properties props = new Properties(); - + props.setProperty(AdminClient.CONNECTOR_TYPE, AdminClient.CONNECTOR_TYPE_SOAP); - + props.setProperty(AdminClient.CONNECTOR_HOST, host); - + props.setProperty(AdminClient.CONNECTOR_PORT, port); - + String user = cfg.getProperty(AdminClient.USERNAME, ""); String pass = cfg.getProperty(AdminClient.PASSWORD, ""); - + // user and pass cannot be null because getProperty() is called // with default values if (!user.equals("") && !pass.equals("")) { props.setProperty(AdminClient.USERNAME, user); props.setProperty(AdminClient.PASSWORD, pass); props.setProperty(AdminClient.CONNECTOR_SECURITY_ENABLED, "true"); - + // Set the ssl props, if they're available. As of this writing, there are no // publicly-available constants for the prop keys, so they're kept in this source file. String trustStore = cfg.getProperty(TRUST_STORE); @@ -181,7 +181,7 @@ props.setProperty(KEY_STORE_PWD, keyStorePwd); } } - + return props; } @@ -220,7 +220,7 @@ MetricNotFoundException { double count = 0; - + try { Set beans = mServer.queryNames(query, null); for (Iterator it=beans.iterator(); it.hasNext();) { @@ -273,7 +273,7 @@ if (log.isDebugEnabled()) { log.debug(name + " resolved to: " + fullName); } - + return fullName; } catch (Exception e) { String msg = @@ -343,7 +343,7 @@ */ public static Object invoke(String objectName, Properties props, - String method, + String method, Object[] args, String[] sig) throws PluginException { |