|
Hyperic HQ Plugin API v. 5.8.0 | |||||||||
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 String |
AUTOINVENTORY_NAME
|
protected static String |
INSTALLPATH
|
protected static String |
INVENTORY_ID
|
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(String installpath)
Initialize an ServerResource with default values. |
protected ServiceResource |
createServiceResource(String type)
|
RuntimeResourceReport |
discoverResources(int serverId,
AIPlatformValue platform,
org.hyperic.util.config.ConfigResponse config)
Deprecated. - Plugins should not use this method. |
protected List |
discoverServers(org.hyperic.util.config.ConfigResponse config)
Override to discover servers for the server type of the plugin instance. |
protected List |
discoverServices(org.hyperic.util.config.ConfigResponse config)
Override to discover services for the server type of the plugin instance. |
protected Set |
discoverServiceTypes(org.hyperic.util.config.ConfigResponse config)
|
protected File |
findVersionFile(File dir,
Pattern pattern)
|
protected String |
formatAutoInventoryName(String type,
org.hyperic.util.config.ConfigResponse parentConfig,
org.hyperic.util.config.ConfigResponse config,
org.hyperic.util.config.ConfigResponse cprops)
Format the auto-inventory name as defined by the plugin, for example: |
protected String |
formatName(String name,
org.hyperic.util.config.ConfigResponse parentConfig,
org.hyperic.util.config.ConfigResponse config,
org.hyperic.util.config.ConfigResponse cprops)
|
protected static String |
getCanonicalPath(String installpath)
Fixup the installpath. |
protected org.hyperic.util.config.ConfigSchema |
getConfigSchema(String name,
int type)
|
String |
getConnectionProtocol(String port)
|
protected Document |
getDocument(File file)
DocumentBuilder.parse() wrapper |
protected String |
getListenAddress(long port)
|
protected String |
getListenAddress(String port)
|
AutoinventoryPluginManager |
getManager()
|
protected static String |
getParentDir(String path)
|
protected static String |
getParentDir(String path,
int levels)
|
protected static long[] |
getPids(String query)
Wrapper for Sigar's ProcessFinder.find method. |
protected static 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 String |
getProcCwd(long pid)
Attempt to get the current working directory of a process. |
protected static String |
getProcExe(long pid)
|
protected static String |
getProcExe(long pid,
String name)
Attempt to find the absolute name of the process executable. |
protected static List |
getProcModules(long pid)
Wrapper for Sigar.getProcModules which catches SigarException and returns a String[] with length 0 if the SigarException is caught. |
List |
getRegistryScanKeys()
Helper for RegistryServerDetector implementors. |
RuntimeDiscoverer |
getRuntimeDiscoverer()
Deprecated. - Plugins should not use this method. |
int |
getScanOrder()
|
ServerSignature |
getServerSignature()
The server signature is defined by plugins in etc/hq-plugin.xml if the plugin implements FileServerDetector or RegistryServerDetector. |
List |
getServiceConfigs(String type)
|
Map |
getServiceInventoryPlugins()
|
protected static org.hyperic.sigar.SigarProxy |
getSigar()
|
String |
getTypeProperty(String type,
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 String |
getXPathValue(File file,
String xpath)
|
protected String |
getXPathValue(Node node,
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(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(String port)
|
boolean |
isWin32ServiceRunning(String name)
|
void |
setAutoApproveConfig(org.hyperic.util.AutoApproveConfig autoApproveConfig)
|
protected void |
setControlConfig(ServerResource server,
org.hyperic.util.config.ConfigResponse config)
Merge default values from server's control ConfigSchema and saves to ServerResource.setControlConfig. |
protected void |
setControlConfig(ServiceResource service,
org.hyperic.util.config.ConfigResponse config)
Merge default values from services's control ConfigSchema and saves to ServiceResource.setControlConfig. |
protected void |
setCustomProperties(org.hyperic.util.config.ConfigResponse cprops)
|
protected void |
setCustomProperties(ServerResource server,
org.hyperic.util.config.ConfigResponse config)
Merge default values from server's Custom Properties schema and saves to ServerResource.setCustomProperties. |
protected void |
setDescription(String description)
|
protected void |
setMeasurementConfig(ServerResource server,
org.hyperic.util.config.ConfigResponse config)
Merge default values from server's measurement ConfigSchema and saves to ServerResource.setMeasurementConfig. |
protected void |
setMeasurementConfig(ServiceResource service,
org.hyperic.util.config.ConfigResponse config)
Merge default values from service's measurement ConfigSchema and saves to ServiceResource.setMeasurementConfig. |
protected void |
setProductConfig(ServerResource server,
org.hyperic.util.config.ConfigResponse config)
Merge default values from server's product ConfigSchema and saves to ServerResource.setProductConfig. |
protected void |
setProductConfig(ServiceResource service,
org.hyperic.util.config.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 String INSTALLPATH
protected static final String INVENTORY_ID
protected static final String AUTOINVENTORY_NAME
Constructor Detail |
---|
public ServerDetector()
Method Detail |
---|
public void setAutoApproveConfig(org.hyperic.util.AutoApproveConfig autoApproveConfig)
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, org.hyperic.util.config.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(String description)
protected void setCustomProperties(org.hyperic.util.config.ConfigResponse cprops)
protected List discoverServers(org.hyperic.util.config.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 List discoverServices(org.hyperic.util.config.ConfigResponse config) throws PluginException
config
- Configuration of the parent server resource.
PluginException
- If an error occured during discovery.protected Set discoverServiceTypes(org.hyperic.util.config.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 String getTypeProperty(String type, String name)
GenericPlugin
Same as:
getProperty(type + "." + name);
getTypeProperty
in class GenericPlugin
public List getRegistryScanKeys()
public ServerSignature getServerSignature()
protected File findVersionFile(File dir, Pattern pattern)
protected boolean isInstallTypeVersion(String installpath)
installpath
- The server instance installpath
protected ServerResource createServerResource(String installpath)
installpath
- Used to set InstallPath and Identifierprotected ServiceResource createServiceResource(String type)
protected String formatName(String name, org.hyperic.util.config.ConfigResponse parentConfig, org.hyperic.util.config.ConfigResponse config, org.hyperic.util.config.ConfigResponse cprops)
protected String formatAutoInventoryName(String type, org.hyperic.util.config.ConfigResponse parentConfig, org.hyperic.util.config.ConfigResponse config, org.hyperic.util.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 String getParentDir(String path)
FileUtil.getParentDir(String)
protected static String getParentDir(String path, int levels)
FileUtil.getParentDir(String, int)
protected static String getCanonicalPath(String installpath)
protected static org.hyperic.sigar.SigarProxy getSigar()
protected String getListenAddress(String port)
protected String getListenAddress(long port)
protected static String[] getProcArgs(long pid)
pid
- Process identifier
protected static List getProcModules(long pid)
pid
- Process identifierprotected static String getProcExe(long pid)
protected static String getProcExe(long pid, String name)
null
is returned.
pid
- Process identifiername
- Binary base name to match against
protected static String getProcCwd(long pid)
null
is returned.
pid
- Process identifier
protected static long[] getPids(String query)
query
- SIGAR Process Table Query
public boolean isWin32ServiceRunning(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(String port)
public String getConnectionProtocol(String port)
protected Document getDocument(File file) throws IOException
file
- File to parse
IOException
- For any exceptionprotected String getXPathValue(Node node, String xpath)
node
- Node to searchxpath
- XPath string
protected String getXPathValue(File file, String xpath)
protected org.hyperic.util.config.ConfigSchema getConfigSchema(String name, int type)
protected void setProductConfig(ServerResource server, org.hyperic.util.config.ConfigResponse config)
protected void setMeasurementConfig(ServerResource server, org.hyperic.util.config.ConfigResponse config)
protected void setCustomProperties(ServerResource server, org.hyperic.util.config.ConfigResponse config)
protected void setControlConfig(ServerResource server, org.hyperic.util.config.ConfigResponse config)
protected void setProductConfig(ServiceResource service, org.hyperic.util.config.ConfigResponse config)
protected void setMeasurementConfig(ServiceResource service, org.hyperic.util.config.ConfigResponse config)
protected void setControlConfig(ServiceResource service, org.hyperic.util.config.ConfigResponse config)
public Map getServiceInventoryPlugins()
public List getServiceConfigs(String type)
public int getScanOrder()
|
Hyperic HQ Plugin API v. 5.8.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |