<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Henrik Stoerner wrote:
<blockquote cite="mid20051115154234.GA26641@hswn.dk" type="cite">
  <pre wrap="">On Tue, Nov 15, 2005 at 09:08:28AM -0600, Adam Scheblein wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Greetings,

I have modified the ps in all my clients so that it also sends out 
per-process cpu usage, and now am trying to use a regular perl 
expression in the search for processes with a certain usage percentage.  
Here is what i have:
%(8\d{2}\.\d{2})|(9[0-4]\.\d{2}) and %(9[5-9]\.\d{2})|(1\d{2}\.\d{2}) as 
2 of my searches
    </pre>
  </blockquote>
  <pre wrap=""><!---->
I think you have an error in that first expression - the "8\d{2}" seems
wrong, if you want it to match number 80-89. It should be "8\d" without
the "{2}".

  </pre>
</blockquote>
OK -- i checked my rules, and realized that i typed them into the
e-mail wrong -- here is a direct cut/paste<br>
PROC %(8\d\.\d{2})|(9[0-4]\.\d{2}) 0 0 yellow<br>
PROC %(9[5-9]\.\d{2})|(1\d{2}\.\d{2}) 0 0 red<br>
<br>
After i pasted this i realized that i was also pulling IP addresses, so
i changed the rules to this:<br>
PROC %\s+((8\d\.\d{2})|(9[0-4]\.\d{2}))\s+ 0 0 yellow<br>
PROC %\s+((9[5-9]\.\d{2})|(1\d{2}\.\d{2}))\s+ 0 0 red<br>
<br>
<br>
Which now work, but seems to be acting strange because when it finds a
bad process it reports this(keep in mind that these are sorted by cpu
usage and nothing has been edited/cut out):<br>
<pre>red %\s+((9[5-9]\.\d{2})|(1\d{2}\.\d{2}))\s+ (found 7, req. at most 0)

adam     18178 18176 99.63 11:19:16 pts/3       02:00 -bash
root        19     0  0.55  Nov  8  ?           05:29 vxfsd</pre>
so i am not sure where the "found 7" is coming from, when clearly there
is only 1...<br>
<br>
Thanks,<br>
Adam<br>
<blockquote cite="mid20051115154234.GA26641@hswn.dk" type="cite">
  <pre wrap=""></pre>
  <blockquote type="cite">
    <pre wrap="">These don't work however, because they pull up everything that is 8.xx 
8x.xx 9.xx 9x.xx 1.xx 1x.xx and 1xx.xx
    </pre>
  </blockquote>
  <pre wrap=""><!---->
I'm not sure what data you're feeding it, but I tried with this setup in
hobbit-clients.cfg:

HOST=localhost
        PROC %(8\d\.\d{2})|(9[0-4]\.\d{2}) 0 0
        PROC %(9[5-9]\.\d{2})|(1\d{2}\.\d{2}) 0 0

This will give a red if any of the commands in the "ps" listing has the
percentages 80-94 or 95-100. Now let's test it:

$ bbcmd hobbitd_client --test
Hostname (.=end, ?=dump, !=reload) [localhost]: localhost
Test (cpu, mem, disk, proc): proc
ps command string: 82.31 ls
ps command string:
Process %(8\d\.\d{2})|(9[0-4]\.\d{2}) color red: Count=1, min=0, max=0
Process %(9[5-9]\.\d{2})|(1\d{2}\.\d{2}) color green: Count=0, min=0, max=0

Good, the ps commandline string "82.31 ls" is matched as it should be.

Hostname (.=end, ?=dump, !=reload) [localhost]:
Test (cpu, mem, disk, proc): proc
ps command string: 8.29 ls
ps command string:
Process %(8\d\.\d{2})|(9[0-4]\.\d{2}) color green: Count=0, min=0, max=0
Process %(9[5-9]\.\d{2})|(1\d{2}\.\d{2}) color green: Count=0, min=0, max=0

And the string "8.29 ls" is not matched. 

Hostname (.=end, ?=dump, !=reload) [localhost]:
Test (cpu, mem, disk, proc): proc
ps command string: 100.00 muncher
ps command string:
Process %(8\d\.\d{2})|(9[0-4]\.\d{2}) color green: Count=0, min=0, max=0
Process %(9[5-9]\.\d{2})|(1\d{2}\.\d{2}) color red: Count=1, min=0, max=0

"100.00 muncher" is also matched

Hostname (.=end, ?=dump, !=reload) [localhost]:
Test (cpu, mem, disk, proc): proc
ps command string: 1.00 low
ps command string:
Process %(8\d\.\d{2})|(9[0-4]\.\d{2}) color green: Count=0, min=0, max=0
Process %(9[5-9]\.\d{2})|(1\d{2}\.\d{2}) color green: Count=0, min=0, max=0

But "1.00 low" is now matched.


So either your rules are different from what I've used, or your ps
output is unlike that which I used. I think you'll need to post some
more details for us to figure out what the problem is.


Regards,
Henrik


To unsubscribe from the hobbit list, send an e-mail to
<a class="moz-txt-link-abbreviated" href="mailto:hobbit-unsubscribe@hswn.dk">hobbit-unsubscribe@hswn.dk</a>


  </pre>
</blockquote>
<br>
</body>
</html>