Ori.livneh has submitted this change and it was merged. Change subject: admin/ori: make 'reqs' continuously update ......................................................................
admin/ori: make 'reqs' continuously update Make reqs tail the apache2 access log file with the most recent mtime into `pv`, to provide a continusouly-updating view of average and current requests per second on the host. Change-Id: I867bb64622d984741c5f70b52960eb8d2768ef65 --- M modules/admin/files/home/ori/.bash_profile 1 file changed, 6 insertions(+), 4 deletions(-) Approvals: Ori.livneh: Verified; Looks good to me, approved diff --git a/modules/admin/files/home/ori/.bash_profile b/modules/admin/files/home/ori/.bash_profile index 1bced07..85a2286 100644 --- a/modules/admin/files/home/ori/.bash_profile +++ b/modules/admin/files/home/ori/.bash_profile @@ -64,7 +64,12 @@ repackage() { sudo dpkg-buildpackage -b -uc; } psmem() { sudo "$HOME/.bin/ps_mem.py" "${@}"; } where() { find . -iname \*"$*"\* ; } -reqs() { curl -s 127.0.0.1/server-status | grep -Po '\d+(?= requests currently being processed)'; } +reqs() { + # Find the apache2 log file with the most recent mtime that isn't an error log. + local log_file="$(sudo find /var/log/apache2 -type f -name '*.log' \ + -not -name '*error*' -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" ")" + sudo tail -f "$log_file" | pv -lraN "apache2 reqs/sec (current/average)" >/dev/null +} service() { sudo service "$@"; } perf() { sudo perf "$@"; } gdbh() { sudo gdb -p "$(pidof -s hhvm)"; } @@ -75,9 +80,6 @@ sudo() { command sudo -E "$@"; } hbnt() { /usr/bin/comm -23 "$1" "$2"; } # Here but not there (lines in $1 that are not in $2) bhat() { /usr/bin/comm -12 "$1" "$2"; } # Both here and there (lines common to both $1 and $2) - -# DWIM: If cd argument is a file, cd to the file's directory. -cd() { if [ ! -d "$1" ]; then builtin cd "$(dirname "$1")"; else builtin cd "$1"; fi; } cleanup() { mkdir -p ~/old -- To view, visit https://gerrit.wikimedia.org/r/285581 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I867bb64622d984741c5f70b52960eb8d2768ef65 Gerrit-PatchSet: 3 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Ori.livneh <o...@wikimedia.org> Gerrit-Reviewer: Alex Monk <kren...@gmail.com> Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits