some ptql doc

This commit is contained in:
Doug MacEachern 2004-07-23 19:52:26 +00:00
parent 7bb6238e14
commit f4bbb2f167
2 changed files with 42 additions and 2 deletions

View File

@ -2,20 +2,24 @@
#commands in this file are run just as they would be if they #commands in this file are run just as they would be if they
#were typed in by hand in the shell prompt. #were typed in by hand in the shell prompt.
#find weblogic nodes #find weblogic nodes (-1 means last index in the array)
alias wlfind ptql State.Name.eq=java,Args.-1.eq=weblogic.Server alias wlfind ptql State.Name.eq=java,Args.-1.eq=weblogic.Server
#find jboss #find jboss
alias jbfind ptql State.Name.eq=java,Args.-1.eq=org.jboss.Main alias jbfind ptql State.Name.eq=java,Args.-1.eq=org.jboss.Main
#find ers apache worker or prefork httpsd #find ers apache worker or prefork httpsd
#($1 is the return value of the first query in the string)
alias erfind ptql State.Name.sw=httpsd.,State.Name.Pne=$1 alias erfind ptql State.Name.sw=httpsd.,State.Name.Pne=$1
#find ant processes (ant hangs on me sometimes) #find ant processes (ant hangs on me sometimes)
#(* matches any value in the array)
alias hant ptql State.Name.eq=java,Args.*.eq=org.apache.tools.ant.Main alias hant ptql State.Name.eq=java,Args.*.eq=org.apache.tools.ant.Main
#my HQ agent #my HQ agent
#(user.name is in System.getProperties)
alias myag ptql CredName.User.eq=$user.name,State.Name.eq=java,Args.-1.ew=SpiderAgent alias myag ptql CredName.User.eq=$user.name,State.Name.eq=java,Args.-1.ew=SpiderAgent
#find all java procs except the shell itself #find all java procs except the shell itself
#($$ is the current process id)
alias java ptql State.Name.eq=java,Pid.Pid.ne=$$ alias java ptql State.Name.eq=java,Pid.Pid.ne=$$

View File

@ -24,6 +24,42 @@ import org.apache.bcel.generic.ObjectType;
import org.apache.bcel.generic.PUSH; import org.apache.bcel.generic.PUSH;
import org.apache.bcel.generic.Type; import org.apache.bcel.generic.Type;
/**
* Build a Process Query using a PTQL string.
*
* Queries must be in the following format:
* <pre>
* Class.Attribute.operator=value
* </pre>
* Where:
* <ul>
* <li> <b>Class</b> is the name of the Sigar class minus the Proc prefix.
* <li> <b>Attribute</b> is an attribute of the given <b>Class</b>,
* index into an array or key in a Map class.
* <li> <b>operator</b> is one of the following for String values:
* <ul>
* <li> <b>eq</b> - Equal to <b>value</b>
* <li> <b>ne</b> - Not Equal to <b>value</b>
* <li> <b>ew</b> - Ends with <b>value</b>
* <li> <b>sw</b> - Starts with <b>value</b>
* <li> <b>ct</b> - Contains <b>value</b> (substring)
* <li> <b>re</b> - Regular expression <b>value</b> matches
* </ul>
* <li> <b>operator</b> is one of the following for numeric values:
* <ul>
* <li> <b>eq</b> - Equal to <b>value</b>
* <li> <b>ne</b> - Not Equal to <b>value</b>
* <li> <b>gt</b> - Greater than <b>value</b>
* <li> <b>ge</b> - Greater than or equal <b>value</b>
* <li> <b>lt</b> - Less than <b>value</b>
* <li> <b>le</b> - Less than or equal <b>value</b>
* </ul>
* </ul>
* Multiple queries must delimited by a comma.
* <p>
* Examples can be found in the sigar-bin/lib/.sigar_shellrc file of
* the Sigar distribution.
*/
public class ProcessQueryBuilder { public class ProcessQueryBuilder {
//set true during development to dump generated //set true during development to dump generated
@ -75,7 +111,7 @@ public class ProcessQueryBuilder {
//branches of query method //branches of query method
private ArrayList branches = new ArrayList(); private ArrayList branches = new ArrayList();
public static final boolean COMPAT_1_4; static final boolean COMPAT_1_4;
static { static {
//long //long