Class PDH
- java.lang.Object
-
- com.santaba.agent.groovyapi.win32.PDH
-
public class PDH extends java.lang.Object
This will provide PDH related operations.property name property note pdh.user the username for pdh requests (Will prefer to use this property) pdh.pass the username for pdh requests (Will prefer to use this property) wmi.user / wmiuser the username for pdh requests wmi.pass / wmipass the password for pdh requests
Example:
import com.santaba.agent.groovyapi.win32.PDH import com.santaba.agent.groovyapi.win32.PDHSession // for the host which monitored by current collector String processorTime = PDH.getCounter("YourHost", "\\Processor(_Total)\\% Processor Time"); println processorTime; // for the host which NOT monitored by current collector // open a PDH sesion PDHSession session = PDH.open("TheHost", "username", "password"); // query processorTime2 = session.getCounter("\\Processor(_Total)\\% Processor Time"); println processorTime2;
-
-
Constructor Summary
Constructors Constructor Description PDH()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.lang.String
getCounter(java.lang.String host, java.lang.String counter)
Get a single counter from the given host
This will only apply to the host which is monitored by current collector.static java.lang.String
getCounter(java.lang.String host, java.lang.String counter, long timeoutSeconds)
Get a single counter from the given host with timeout
This will only apply to the host which is monitored by current collector.static java.util.List<java.lang.String>
getCounters(java.lang.String host, java.util.List<java.lang.String> counters)
Get values for a list of counters from the given host
This will only apply to the host which is monitored by current collector.static java.util.List<java.lang.String>
getCounters(java.lang.String host, java.util.List<java.lang.String> counters, long timeoutSeconds)
Get values for a list of counters from the given host
This will only apply to the host which is monitored by current collector.static java.lang.String
getDiscover(java.lang.String host, java.lang.String category)
Get a single counter from the given host
This will only apply to the host which is monitored by current collector.static java.lang.String
getDiscover(java.lang.String host, java.lang.String category, long timeoutSeconds)
Get a single counter from the given host with timeout
This will only apply to the host which is monitored by current collector.static java.lang.String
getEnum(java.lang.String host, java.lang.String object)
Get a object from the given host
This will only apply to the host which is monitored by current collector.static java.lang.String
getEnum(java.lang.String host, java.lang.String object, long timeoutSeconds)
Get a object from the given host with timeout
This will only apply to the host which is monitored by current collector.static java.lang.String
getRatioCounter(java.lang.String host, java.lang.String counter)
Get a single ratio counter from the given host
This will only apply to the host which is monitored by current collector.static java.lang.String
getRatioCounter(java.lang.String host, java.lang.String counter, long timeoutSeconds)
Get a single ratio counter from the given host
This will only apply to the host which is monitored by current collector.static java.util.List<java.lang.String>
getRatioCounters(java.lang.String host, java.util.List<java.lang.String> counters)
Get values for a list of ratio counters from the given host
This will only apply to the host which is monitored by current collector.static java.util.List<java.lang.String>
getRatioCounters(java.lang.String host, java.util.List<java.lang.String> counters, long timeoutSeconds)
Get values for a list of ratio counters from the given host
This will only apply to the host which is monitored by current collector.static PDHSession
open(java.lang.String host)
Deprecated.static PDHSession
open(java.lang.String host, java.lang.String username, java.lang.String password)
open a PDH session with username or password provided
-
-
-
Method Detail
-
open
@Deprecated public static PDHSession open(java.lang.String host)
Deprecated.Open a PDH session, using host's property for user & password- Parameters:
host
- - host to connect to- Returns:
- a PDH session object representing the session for interaction This will only apply for the hosts monitored by current collector. use other static methods like get* instead.
-
open
public static PDHSession open(java.lang.String host, java.lang.String username, java.lang.String password)
open a PDH session with username or password provided- Parameters:
host
- PDH host urlusername
- Auth usernamepassword
- Auth password- Returns:
- PDHSession object
-
getCounter
public static java.lang.String getCounter(java.lang.String host, java.lang.String counter) throws java.io.IOException, java.lang.InterruptedException, java.util.concurrent.ExecutionException
Get a single counter from the given host
This will only apply to the host which is monitored by current collector.- Parameters:
host
- - host to connect tocounter
- - counter to get- Returns:
- - value of counter, in string format
- Throws:
java.io.IOException
java.lang.InterruptedException
java.util.concurrent.ExecutionException
-
getCounter
public static java.lang.String getCounter(java.lang.String host, java.lang.String counter, long timeoutSeconds) throws java.io.IOException, java.lang.InterruptedException, java.util.concurrent.ExecutionException
Get a single counter from the given host with timeout
This will only apply to the host which is monitored by current collector.- Parameters:
host
- PDH host urlcounter
- Counter of pdhtimeoutSeconds
- Timeout(seconds)- Returns:
- - value of counter, in string format
- Throws:
java.io.IOException
- If some other I/O error occursjava.lang.InterruptedException
- If wait request interruptjava.util.concurrent.ExecutionException
- If wait request execution failed
-
getCounters
public static java.util.List<java.lang.String> getCounters(java.lang.String host, java.util.List<java.lang.String> counters) throws java.io.IOException, java.lang.InterruptedException, java.util.concurrent.ExecutionException
Get values for a list of counters from the given host
This will only apply to the host which is monitored by current collector.- Parameters:
host
- - host to connect tocounters
- - counters to get- Returns:
- - values of counters, in given order of counters parameters
- Throws:
java.io.IOException
java.lang.InterruptedException
java.util.concurrent.ExecutionException
-
getCounters
public static java.util.List<java.lang.String> getCounters(java.lang.String host, java.util.List<java.lang.String> counters, long timeoutSeconds) throws java.io.IOException, java.lang.InterruptedException, java.util.concurrent.ExecutionException
Get values for a list of counters from the given host
This will only apply to the host which is monitored by current collector.- Parameters:
host
- - host to connect tocounters
- - counters to gettimeoutSeconds
- timeout (seconds)- Returns:
- - values of counters, in given order of counters parameters
- Throws:
java.io.IOException
java.lang.InterruptedException
java.util.concurrent.ExecutionException
-
getDiscover
public static java.lang.String getDiscover(java.lang.String host, java.lang.String category) throws java.io.IOException, java.lang.InterruptedException, java.util.concurrent.ExecutionException
Get a single counter from the given host
This will only apply to the host which is monitored by current collector.- Parameters:
host
- - host to connect tocategory
- - category to get- Returns:
- - value of counter, in string format
- Throws:
java.io.IOException
java.lang.InterruptedException
java.util.concurrent.ExecutionException
-
getDiscover
public static java.lang.String getDiscover(java.lang.String host, java.lang.String category, long timeoutSeconds) throws java.io.IOException, java.lang.InterruptedException, java.util.concurrent.ExecutionException
Get a single counter from the given host with timeout
This will only apply to the host which is monitored by current collector.- Parameters:
host
- PDH host urlcategory
- category of pdhtimeoutSeconds
- Timeout(seconds)- Returns:
- - value of category, in string format
- Throws:
java.io.IOException
- If some other I/O error occursjava.lang.InterruptedException
- If wait request interruptjava.util.concurrent.ExecutionException
- If wait request execution failed
-
getEnum
public static java.lang.String getEnum(java.lang.String host, java.lang.String object) throws java.io.IOException, java.lang.InterruptedException, java.util.concurrent.ExecutionException
Get a object from the given host
This will only apply to the host which is monitored by current collector.- Parameters:
host
- - host to connect toobject
- - object to get- Returns:
- - value of object, in string format
- Throws:
java.io.IOException
java.lang.InterruptedException
java.util.concurrent.ExecutionException
-
getEnum
public static java.lang.String getEnum(java.lang.String host, java.lang.String object, long timeoutSeconds) throws java.io.IOException, java.lang.InterruptedException, java.util.concurrent.ExecutionException
Get a object from the given host with timeout
This will only apply to the host which is monitored by current collector.- Parameters:
host
- PDH host urlobject
- object of pdhtimeoutSeconds
- Timeout(seconds)- Returns:
- - value of object, in string format
- Throws:
java.io.IOException
- If some other I/O error occursjava.lang.InterruptedException
- If wait request interruptjava.util.concurrent.ExecutionException
- If wait request execution failed
-
getRatioCounter
public static java.lang.String getRatioCounter(java.lang.String host, java.lang.String counter) throws java.io.IOException, java.lang.InterruptedException, java.util.concurrent.ExecutionException
Get a single ratio counter from the given host
This will only apply to the host which is monitored by current collector.- Parameters:
host
- - host to connect tocounter
- - ratio counter to get- Returns:
- - value of counter, in string format
- Throws:
java.io.IOException
java.lang.InterruptedException
java.util.concurrent.ExecutionException
-
getRatioCounter
public static java.lang.String getRatioCounter(java.lang.String host, java.lang.String counter, long timeoutSeconds) throws java.io.IOException, java.lang.InterruptedException, java.util.concurrent.ExecutionException
Get a single ratio counter from the given host
This will only apply to the host which is monitored by current collector.- Parameters:
host
- - host to connect tocounter
- - ratio counter to gettimeoutSeconds
- timeout (seconds)- Returns:
- - value of counter, in string format
- Throws:
java.io.IOException
java.lang.InterruptedException
java.util.concurrent.ExecutionException
-
getRatioCounters
public static java.util.List<java.lang.String> getRatioCounters(java.lang.String host, java.util.List<java.lang.String> counters) throws java.io.IOException, java.lang.InterruptedException, java.util.concurrent.ExecutionException
Get values for a list of ratio counters from the given host
This will only apply to the host which is monitored by current collector.- Parameters:
host
- - host to connect tocounters
- - ratio counters to get- Returns:
- - values of ratio counters, in given order of ratio counters parameters
- Throws:
java.io.IOException
java.lang.InterruptedException
java.util.concurrent.ExecutionException
-
getRatioCounters
public static java.util.List<java.lang.String> getRatioCounters(java.lang.String host, java.util.List<java.lang.String> counters, long timeoutSeconds) throws java.io.IOException, java.lang.InterruptedException, java.util.concurrent.ExecutionException
Get values for a list of ratio counters from the given host
This will only apply to the host which is monitored by current collector.- Parameters:
host
- - host to connect tocounters
- - ratio counters to gettimeoutSeconds
- timeout (seconds)- Returns:
- - values of ratio counters, in given order of ratio counters parameters
- Throws:
java.io.IOException
java.lang.InterruptedException
java.util.concurrent.ExecutionException
-
-