Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
How to run pt-kill from cron
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Atle  
View profile  
 More options Jan 25 2012, 1:14 am
From: Atle <acv...@gmail.com>
Date: Tue, 24 Jan 2012 22:14:58 -0800 (PST)
Local: Wed, Jan 25 2012 1:14 am
Subject: How to run pt-kill from cron
Unless I am missing something, pt-kill refuses to run from cron as it
requires STDIN to be available.

This is the command I run: PTDEBUG=1 /usr/local/bin/pt-kill --config /
etc/percona-toolkit/pt-kill-cleaner.conf

The config contains these non-sensitive pieces of information:
daemonize
log=/var/log/pt-kill.log
print
kill
pid=/var/run/pt-kill.pid
match-user=foobar
match-command=Query
busy-time=5
idle-time=30
interval=2
victims=all
wait-after-kill=2

Executed from the shell, the command runs fine and the process
daemonizes as expected.

Executed from crontab, the command runs one iteration and then exits.
Some of the output:
# pt_kill:3810 16106 Reading files -
..
# pt_kill:3810 16106 Checking processlist
# pt_kill:3810 16106 Processlist returned no queries
# pt_kill:3810 16106 Checking processlist
# pt_kill:3810 16106 /usr/local/bin/pt-kill ending
# Daemon:1631 16106 Removed PID file

As STDIN is not available to it the process tries to read STDIN,
fails, then exits.

The same behavior exhibits for both daemonize and without.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jervin R  
View profile  
 More options Feb 8 2012, 8:11 am
From: Jervin R <jervin.r...@percona.com>
Date: Wed, 8 Feb 2012 05:11:48 -0800 (PST)
Local: Wed, Feb 8 2012 8:11 am
Subject: Re: How to run pt-kill from cron
Why do you need to do it from cron - pt-kill is like a watchdog
process keeping an eye on processlist. IMHO, its better to keep it
always running instead of running from time to time, the latter can
miss or be delayed in killing a process. Also, if you use daemonize on
cron and pt-kill works as you expected you'll get a number of pt-kill
processes running!

On Jan 25, 2:14 pm, Atle <acv...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel Nichter  
View profile  
 More options Feb 8 2012, 10:21 am
From: Daniel Nichter <dan...@percona.com>
Date: Wed, 8 Feb 2012 08:21:54 -0700
Local: Wed, Feb 8 2012 10:21 am
Subject: Re: How to run pt-kill from cron
This was fixed in Percona Toolkit 2.0.3: https://bugs.launchpad.net/percona-toolkit/+bug/894255

Le 24 janv. 2012 à 23:14, Atle a écrit :


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Filippo  
View profile  
 More options Feb 9 2012, 11:25 pm
From: Filippo <fvit...@gmail.com>
Date: Thu, 9 Feb 2012 20:25:55 -0800 (PST)
Local: Thurs, Feb 9 2012 11:25 pm
Subject: Re: How to run pt-kill from cron
Hi Daniel,

I am running the latest version of pt-kill (2.0.3) on Solaris 10 and I
have the same issue.

I believe the problem is related to this check:
pt-kill:3546
   if ( !-t STDIN ) {
      PTDEBUG && _d("STDIN is piped");
      @ARGV = ('-');
   }

No matter if I specified "--daemonize", STDIN is not /dev/tty then the
code:
pt-kill:3590
   if ( @ARGV ) {
      PTDEBUG && _d('Getting processlist from files:', @ARGV);

is executed instead of the expected:
pt-kill:3626
   else {
      PTDEBUG && _d('Getting processlist from MySQL');

I am not a PERL developer but I believe something like this should fix
this issue:
-   if ( !-t STDIN ) {
+   if ( !$o->get('daemonize') && !-t STDIN ) {

Cheers
Filippo

On Feb 9, 2:21 am, Daniel Nichter <dan...@percona.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel Nichter  
View profile  
 More options Feb 10 2012, 10:50 am
From: Daniel Nichter <dan...@percona.com>
Date: Fri, 10 Feb 2012 08:50:31 -0700
Local: Fri, Feb 10 2012 10:50 am
Subject: Re: How to run pt-kill from cron
Filippo,

You are correct.  This was fixed in https://code.launchpad.net/~percona-toolkit-dev/percona-toolkit/fix-s... but that branch was not merged, therefore it was not actually in 2.0.3.  Sorry for the confusion.  I'll merge this branch and it will be released for real in 2.0.4.  Until then, I'll reply with a download link for the updated pt-kill once it's merged...

-Daniel

Le 9 févr. 2012 à 21:25, Filippo a écrit :


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel Nichter  
View profile  
 More options Feb 10 2012, 11:22 am
From: Daniel Nichter <dan...@percona.com>
Date: Fri, 10 Feb 2012 09:22:36 -0700
Local: Fri, Feb 10 2012 11:22 am
Subject: Re: How to run pt-kill from cron
This is now in the 2.0 branch: http://bazaar.launchpad.net/~percona-toolkit-dev/percona-toolkit/2.0/...

There's a download link on that page.  Note that generally we don't suggest downloading directly from trunk because the code is frequently changing, but in this particular case, I don't foresee any serious changes to pt-kill.  When this is released in 2.0.4, early next month probably, you should get the official release, too.

-Daniel

Le 10 févr. 2012 à 08:50, Daniel Nichter a écrit :


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »