On Tue, Nov 15, 2005 at 09:08:28AM -0600, Adam Scheblein wrote:
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
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}".
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
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