|
Hyperic HQ Plugin API v. 4.4.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hyperic.hq.product.GenericPlugin
org.hyperic.hq.product.ServerDetector
public abstract class ServerDetector
Encapsulate the know-how to determine all kinds of server-specific information about a single type of server.
Field Summary | |
---|---|
protected static java.lang.String |
AUTOINVENTORY_NAME
|
protected static java.lang.String |
INSTALLPATH
|
protected static java.lang.String |
INSTALLPATH_MATCH
|
protected static java.lang.String |
INSTALLPATH_NOMATCH
|
protected static java.lang.String |
INVENTORY_ID
|
protected static java.lang.String |
VERSION_FILE
|
Fields inherited from class org.hyperic.hq.product.GenericPlugin |
---|
config, FILE_DELIM, FILE_DELIM_ESC, PROP_NAME |
Constructor Summary | |
---|---|
ServerDetector()
|
Method Summary | |
---|---|
protected ServerResource |
createServerResource(java.lang.String installpath)
Initialize an ServerResource with default values. |
protected ServiceResource |
createServiceResource(java.lang.String type)
|
RuntimeResourceReport |
discoverResources(int serverId,
AIPlatformValue platform,
ConfigResponse config)
Deprecated. - Plugins should not use this method. |
protected java.util.List |
discoverServers(ConfigResponse config)
Override to discover servers for the server type of the plugin instance. |
protected java.util.List |
discoverServices(ConfigResponse config)
Override to discover services for the server type of the plugin instance. |
protected java.util.Set |
discoverServiceTypes(ConfigResponse config)
|
protected java.io.File |
findVersionFile(java.io.File dir,
java.util.regex.Pattern pattern)
|
protected java.lang.String |
formatAutoInventoryName(java.lang.String type,
ConfigResponse parentConfig,
ConfigResponse config,
ConfigResponse cprops)
Format the auto-inventory name as defined by the plugin, for example: |
protected java.lang.String |
formatName(java.lang.String name,
ConfigResponse parentConfig,
ConfigResponse config,
ConfigResponse cprops)
|
protected static java.lang.String |
getCanonicalPath(java.lang.String installpath)
Fixup the installpath. |
protected ConfigSchema |
getConfigSchema(java.lang.String name,
int type)
|
java.lang.String |
getConnectionProtocol(java.lang.String port)
|
protected org.w3c.dom.Document |
getDocument(java.io.File file)
DocumentBuilder.parse() wrapper |
protected java.lang.String |
getListenAddress(long port)
|
protected java.lang.String |
getListenAddress(java.lang.String port)
|
AutoinventoryPluginManager |
getManager()
|
protected static java.lang.String |
getParentDir(java.lang.String path)
|
protected static java.lang.String |
getParentDir(java.lang.String path,
int levels)
|
protected static long[] |
getPids(java.lang.String query)
Wrapper for Sigar's ProcessFinder.find method. |
protected static java.lang.String[] |
getProcArgs(long pid)
Wrapper for Sigar.getProcArgs which catches SigarException and returns a String[] with length 0 if the SigarException is caught. |
protected static java.lang.String |
getProcCwd(long pid)
Attempt to get the current working directory of a process. |
protected static java.lang.String |
getProcExe(long pid)
|
protected static java.lang.String |
getProcExe(long pid,
java.lang.String name)
Attempt to find the absolute name of the process executable. |
protected static java.util.List |
getProcModules(long pid)
Wrapper for Sigar.getProcModules which catches SigarException and returns a String[] with length 0 if the SigarException is caught. |
java.util.List |
getRegistryScanKeys()
Helper for RegistryServerDetector implementors. |
RuntimeDiscoverer |
getRuntimeDiscoverer()
Deprecated. - Plugins should not use this method. |
ServerSignature |
getServerSignature()
The server signature is defined by plugins in etc/hq-plugin.xml if the plugin implements FileServerDetector or RegistryServerDetector. |
java.util.List |
getServiceConfigs(java.lang.String type)
|
java.util.Map |
getServiceInventoryPlugins()
|
protected static org.hyperic.sigar.SigarProxy |
getSigar()
|
java.lang.String |
getTypeProperty(java.lang.String type,
java.lang.String name)
Get a value defined by a <property> tag in the plugin's hq-plugin.xml, within a <server> or <service> tag for this plugin's type. |
protected java.lang.String |
getXPathValue(java.io.File file,
java.lang.String xpath)
|
protected java.lang.String |
getXPathValue(org.w3c.dom.Node node,
java.lang.String xpath)
XPathAPI.eval() wrapper. |
void |
init(PluginManager manager)
Called when the plugin is loaded on the server and on the agent side. |
protected boolean |
isInstallTypeVersion(java.lang.String installpath)
Test if server type version filters apply: VERSION_FILE - Return true if given file exists within installpath INSTALLPATH_MATCH - Return true if installpath matches given substring INSTALLPATH_NOMATCH - Return false if installpath matches given substring |
boolean |
isRuntimeDiscoverySupported()
If plugins do not override discoverServers or discoverServices, returning false here will prevent those methods from being called. |
boolean |
isSSLPort(java.lang.String port)
|
boolean |
isWin32ServiceRunning(java.lang.String name)
|
protected void |
setControlConfig(ServerResource server,
ConfigResponse config)
Merge default values from server's control ConfigSchema and saves to ServerResource.setControlConfig. |
protected void |
setControlConfig(ServiceResource service,
ConfigResponse config)
Merge default values from services's control ConfigSchema and saves to ServiceResource.setControlConfig. |
protected void |
setCustomProperties(ConfigResponse cprops)
|
protected void |
setCustomProperties(ServerResource server,
ConfigResponse config)
Merge default values from server's Custom Properties schema and saves to ServerResource.setCustomProperties. |
protected void |
setDescription(java.lang.String description)
|
protected void |
setMeasurementConfig(ServerResource server,
ConfigResponse config)
Merge default values from server's measurement ConfigSchema and saves to ServerResource.setMeasurementConfig. |
protected void |
setMeasurementConfig(ServiceResource service,
ConfigResponse config)
Merge default values from service's measurement ConfigSchema and saves to ServiceResource.setMeasurementConfig. |
protected void |
setProductConfig(ServerResource server,
ConfigResponse config)
Merge default values from server's product ConfigSchema and saves to ServerResource.setProductConfig. |
protected void |
setProductConfig(ServiceResource service,
ConfigResponse config)
Merge default values from service's product ConfigSchema and saves to ServiceResource.setProductConfig. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String VERSION_FILE
protected static final java.lang.String INSTALLPATH_MATCH
protected static final java.lang.String INSTALLPATH_NOMATCH
protected static final java.lang.String INSTALLPATH
protected static final java.lang.String INVENTORY_ID
protected static final java.lang.String AUTOINVENTORY_NAME
Constructor Detail |
---|
public ServerDetector()
Method Detail |
---|
public RuntimeDiscoverer getRuntimeDiscoverer()
discoverServers(org.hyperic.util.config.ConfigResponse)
,
discoverServices(org.hyperic.util.config.ConfigResponse)
public boolean isRuntimeDiscoverySupported()
public RuntimeResourceReport discoverResources(int serverId, AIPlatformValue platform, ConfigResponse config) throws PluginException
RuntimeDiscoverer
discoverResources
in interface RuntimeDiscoverer
serverId
- The server ID to use when constructing
AIServerValue objects and other resources to put into the
RuntimeResourceReport.platform
- The current platform. This should be
used when detecting servers on the current platform.config
- The config response to use when querying
for resources.
PluginException
- TODOdiscoverServers(org.hyperic.util.config.ConfigResponse)
,
discoverServices(org.hyperic.util.config.ConfigResponse)
,
discoverServiceTypes(org.hyperic.util.config.ConfigResponse)
protected void setDescription(java.lang.String description)
protected void setCustomProperties(ConfigResponse cprops)
protected java.util.List discoverServers(ConfigResponse config) throws PluginException
config
- Configuration of the parent server resource.
PluginException
- If an error occured during discovery.discoverServices(org.hyperic.util.config.ConfigResponse)
,
ServerResource
protected java.util.List discoverServices(ConfigResponse config) throws PluginException
config
- Configuration of the parent server resource.
PluginException
- If an error occured during discovery.protected java.util.Set discoverServiceTypes(ConfigResponse config) throws PluginException
PluginException
public void init(PluginManager manager) throws PluginException
GenericPlugin
init
in class GenericPlugin
manager
- The plugin manager for this plugin type.
PluginException
public AutoinventoryPluginManager getManager()
public java.lang.String getTypeProperty(java.lang.String type, java.lang.String name)
GenericPlugin
Same as:
getProperty(type + "." + name);
getTypeProperty
in class GenericPlugin
public java.util.List getRegistryScanKeys()
public ServerSignature getServerSignature()
protected java.io.File findVersionFile(java.io.File dir, java.util.regex.Pattern pattern)
protected boolean isInstallTypeVersion(java.lang.String installpath)
installpath
- The server instance installpath
protected ServerResource createServerResource(java.lang.String installpath)
installpath
- Used to set InstallPath and Identifierprotected ServiceResource createServiceResource(java.lang.String type)
protected java.lang.String formatName(java.lang.String name, ConfigResponse parentConfig, ConfigResponse config, ConfigResponse cprops)
protected java.lang.String formatAutoInventoryName(java.lang.String type, ConfigResponse parentConfig, ConfigResponse config, ConfigResponse cprops)
type
- The resource type name used to lookup AUTOINVENTORY_NAMEparentConfig
- The platform or server configurationconfig
- The server or services configurationcprops
- Custom properties
protected static java.lang.String getParentDir(java.lang.String path)
FileUtil.getParentDir(String)
protected static java.lang.String getParentDir(java.lang.String path, int levels)
FileUtil.getParentDir(String, int)
protected static java.lang.String getCanonicalPath(java.lang.String installpath)
protected static org.hyperic.sigar.SigarProxy getSigar()
protected java.lang.String getListenAddress(java.lang.String port)
protected java.lang.String getListenAddress(long port)
protected static java.lang.String[] getProcArgs(long pid)
pid
- Process identifier
protected static java.util.List getProcModules(long pid)
pid
- Process identifierprotected static java.lang.String getProcExe(long pid)
protected static java.lang.String getProcExe(long pid, java.lang.String name)
null
is returned.
pid
- Process identifiername
- Binary base name to match against
protected static java.lang.String getProcCwd(long pid)
null
is returned.
pid
- Process identifier
protected static long[] getPids(java.lang.String query)
query
- SIGAR Process Table Query
public boolean isWin32ServiceRunning(java.lang.String name)
name
- The Service name shown in the Windows service panel
Properties General tab, not the Display name. For example,
"Terminal Services" is the Display name, "TermService" is the
Service name that should be used here.
public boolean isSSLPort(java.lang.String port)
public java.lang.String getConnectionProtocol(java.lang.String port)
protected org.w3c.dom.Document getDocument(java.io.File file) throws java.io.IOException
file
- File to parse
java.io.IOException
- For any exceptionprotected java.lang.String getXPathValue(org.w3c.dom.Node node, java.lang.String xpath)
node
- Node to searchxpath
- XPath string
protected java.lang.String getXPathValue(java.io.File file, java.lang.String xpath)
protected ConfigSchema getConfigSchema(java.lang.String name, int type)
protected void setProductConfig(ServerResource server, ConfigResponse config)
protected void setMeasurementConfig(ServerResource server, ConfigResponse config)
protected void setCustomProperties(ServerResource server, ConfigResponse config)
protected void setControlConfig(ServerResource server, ConfigResponse config)
protected void setProductConfig(ServiceResource service, ConfigResponse config)
protected void setMeasurementConfig(ServiceResource service, ConfigResponse config)
protected void setControlConfig(ServiceResource service, ConfigResponse config)
public java.util.Map getServiceInventoryPlugins()
public java.util.List getServiceConfigs(java.lang.String type)
|
Hyperic HQ Plugin API v. 4.4.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |