/usr/share/munin/plugins/threads is in munin-node 1.4.6-3ubuntu3.4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | #!/bin/sh
# -*- sh -*-
# vim: ft=sh
: << =cut
=head1 NAME
threads - Plugin to monitor the number of threads on Linux
=head1 CONFIGURATION
No configuration
=head1 AUTHOR
Lars Strand
=head1 LICENSE
GNU GPL
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
if [ "$1" = "autoconf" ]; then
grep -q '^Threads' /proc/$$/status && echo "yes" || echo "no"
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title Number of threads'
#echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel number of threads'
echo 'graph_category processes'
echo 'graph_info This graph shows the number of threads.'
echo 'threads.label threads'
echo 'threads.draw LINE2'
echo 'threads.info The current number of threads.'
exit 0
fi
# -s suppresses errors about files that vanished before they could
# be read. It isn't entirely portable, but GNU grep should be a given on
# Linux. Sadly awk has no such equivalent option or we could skip grep
# altogether
grep -s '^Threads' /proc/[0-9]*/status | awk '{ sum += $2; } END { print "threads.value", sum; }'
|