pt-stalk before_collect triggers will not fire when --no-collect is specified

Bug #1489026 reported by David
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Toolkit moved to https://jira.percona.com/projects/PT
Confirmed
Undecided
Unassigned

Bug Description

This is more likely a feature request than a bug, but the before_collect triggers do not fire when threshold + cycles = fire , but only if the collect process itself is invoked , which could be interpreted to contradict to what is specified in the documentation:

"before_collect

Called when the trigger occurs, before running a --collect subprocesses in the background."

I would like to leverage pt-stalk to do some ad-hoc specific monitoring of custom counts (via the --function option) and then collect some custom data (via --plugins) without dumping all of the data collected by pt-stalk

Details -

plugin :

From the example page :

before_collect() {
   touch /tmp/foo
}

Log output for failed trigger fire:

2015_08_26_10_06_44 Starting /mysql/software/pt/bin/pt-stalk --function=./pt_stalk_user --variable=Threads_running --threshold=1 --match= --cycles=5 --interval=10 --iterations= --run-time=30 --sleep=5 --dest=/var/lib/pt-stalk --prefix= --notify-by-email= --log=./pt-stalk.log --pid=./pid --plugin=./pt_stalk_collect
2015_08_26_10_06_44 Not running with root privileges!
2015_08_26_10_06_44 Check results: ./pt_stalk_user(Threads_running)=2, matched=yes, cycles_true=1
2015_08_26_10_06_54 Check results: ./pt_stalk_user(Threads_running)=2, matched=yes, cycles_true=2
2015_08_26_10_07_04 Check results: ./pt_stalk_user(Threads_running)=2, matched=yes, cycles_true=3
2015_08_26_10_07_14 Check results: ./pt_stalk_user(Threads_running)=2, matched=yes, cycles_true=4
2015_08_26_10_07_24 Check results: ./pt_stalk_user(Threads_running)=2, matched=yes, cycles_true=5
2015_08_26_10_07_24 Collect 1 triggered
2015_08_26_10_07_24 Collect 1 done

Log output for successful trigger-fire:

2015_08_26_10_10_21 Starting /mysql/software/pt/bin/pt-stalk --function=./pt_stalk_user --variable=Threads_running --threshold=1 --match= --cycles=5 --interval=10 --iterations= --run-time=30 --sleep=5 --dest=. --prefix= --notify-by-email= --log=./pt-stalk.log --pid=./pid --plugin=./pt_stalk_collect
2015_08_26_10_10_21 Not running with root privileges!
2015_08_26_10_10_21 Check results: ./pt_stalk_user(Threads_running)=2, matched=yes, cycles_true=1
2015_08_26_10_10_31 Check results: ./pt_stalk_user(Threads_running)=2, matched=yes, cycles_true=2
2015_08_26_10_10_41 Check results: ./pt_stalk_user(Threads_running)=2, matched=yes, cycles_true=3
2015_08_26_10_10_51 Check results: ./pt_stalk_user(Threads_running)=2, matched=yes, cycles_true=4
2015_08_26_10_11_01 Check results: ./pt_stalk_user(Threads_running)=2, matched=yes, cycles_true=5
2015_08_26_10_11_01 Collect 1 triggered
2015_08_26_10_11_01 Collect 1 PID 26643
2015_08_26_10_11_01 Collect 1 done

The log in example one says that the 'Collect 1 " event is triggered, but must then branch when encountering the "--no-collect' option, before parsing any plugin files

It is a small thing, but it would be useful!

Thanks!

Tags: pt-stalk
Revision history for this message
Nilnandan Joshi (nilnandan-joshi) wrote :

Confirmed as a feature request.

root@desktop:/usr/bin# cat pt-stalk | head -1104 | tail -4
before_collect() {
   :
touch /tmp/foo
}
root@desktop:/usr/bin#

nilnandan@desktop:~/Downloads/pt-stalk$ sudo pt-stalk --no-stalk --threshold=1 --cycles=5
[sudo] password for nilnandan:
2015_08_28_13_13_39 Starting /usr/bin/pt-stalk --function=status --variable=Threads_running --threshold=1 --match= --cycles=0 --interval=1 --iterations= --run-time=30 --sleep=300 --dest=/var/lib/pt-stalk --prefix= --notify-by-email= --log=/var/log/pt-stalk.log --pid=/var/run/pt-stalk.pid --plugin=
2015_08_28_13_13_39 Not stalking; collect triggered immediately
2015_08_28_13_13_39 Collect 1 triggered
2015_08_28_13_13_39 Collect 1 PID 8985
2015_08_28_13_13_39 Collect 1 done
2015_08_28_13_13_39 Sleeping 300 seconds after collect
^C2015_08_28_13_13_45 Caught signal, exiting
2015_08_28_13_13_45 All subprocesses have finished
2015_08_28_13_13_45 Exiting because OKTORUN is false
2015_08_28_13_13_45 /usr/bin/pt-stalk exit status 1
nilnandan@desktop:~/Downloads/pt-stalk$

nilnandan@desktop:/tmp$ ll foo
-rw-r--r-- 1 root root 0 Aug 28 13:13 foo
nilnandan@desktop:/tmp$

nilnandan@desktop:~/Downloads/pt-stalk$ sudo pt-stalk --no-stalk --threshold=1 --cycles=5 --no-collect
2015_08_28_13_14_53 Starting /usr/bin/pt-stalk --function=status --variable=Threads_running --threshold=1 --match= --cycles=5 --interval=1 --iterations= --run-time=30 --sleep=300 --dest=/var/lib/pt-stalk --prefix= --notify-by-email= --log=/var/log/pt-stalk.log --pid=/var/run/pt-stalk.pid --plugin=
^C2015_08_28_13_17_43 Caught signal, exiting
2015_08_28_13_17_43 All subprocesses have finished
2015_08_28_13_17_43 Exiting because OKTORUN is false
2015_08_28_13_17_44 /usr/bin/pt-stalk exit status 1
nilnandan@desktop:~/Downloads/pt-stalk$

Changed in percona-toolkit:
status: New → Confirmed
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PT-1301

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.