pt-stalk before_collect triggers will not fire when --no-collect is specified
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/
2015_08_26_10_06_44 Not running with root privileges!
2015_08_26_10_06_44 Check results: ./pt_stalk_
2015_08_26_10_06_54 Check results: ./pt_stalk_
2015_08_26_10_07_04 Check results: ./pt_stalk_
2015_08_26_10_07_14 Check results: ./pt_stalk_
2015_08_26_10_07_24 Check results: ./pt_stalk_
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/
2015_08_26_10_10_21 Not running with root privileges!
2015_08_26_10_10_21 Check results: ./pt_stalk_
2015_08_26_10_10_31 Check results: ./pt_stalk_
2015_08_26_10_10_41 Check results: ./pt_stalk_
2015_08_26_10_10_51 Check results: ./pt_stalk_
2015_08_26_10_11_01 Check results: ./pt_stalk_
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!
Confirmed as a feature request.
root@desktop: /usr/bin# cat pt-stalk | head -1104 | tail -4 /usr/bin#
before_collect() {
:
touch /tmp/foo
}
root@desktop:
nilnandan@ desktop: ~/Downloads/ pt-stalk$ sudo pt-stalk --no-stalk --threshold=1 --cycles=5 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= 08_28_13_ 13_45 Caught signal, exiting desktop: ~/Downloads/ pt-stalk$
[sudo] password for nilnandan:
2015_08_28_13_13_39 Starting /usr/bin/pt-stalk --function=status --variable=
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_
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@
nilnandan@ desktop: /tmp$ ll foo desktop: /tmp$
-rw-r--r-- 1 root root 0 Aug 28 13:13 foo
nilnandan@
nilnandan@ desktop: ~/Downloads/ pt-stalk$ sudo pt-stalk --no-stalk --threshold=1 --cycles=5 --no-collect 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= 08_28_13_ 17_43 Caught signal, exiting desktop: ~/Downloads/ pt-stalk$
2015_08_28_13_14_53 Starting /usr/bin/pt-stalk --function=status --variable=
^C2015_
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@