Projet

Général

Profil

Révision b21206c6

IDb21206c68cb2ec7885522a15a11687da0fb4cd67
Parent b44d8093
Enfant b5595716

Ajouté par Andreas Perhab il y a environ 4 ans

systemd_mem: add env option to monitor all services

Voir les différences:

plugins/systemd/systemd_mem
15 15

  
16 16
env.services defaults to "munin-node".
17 17

  
18
As an alternative you can use all_services to display memory for all running systemd services
19
   [systemd_mem]
20
   env.all_services true
21

  
22
all_services shows memory for all running units of type service.
23

  
18 24
=head1 VERSION
19 25

  
20
1.0
26
1.1
21 27

  
22
=head1 AUTHOR
28
=head1 AUTHORS
23 29

  
24 30
Paul Alexandrow <paul@alexandrow.org>
31
Andreas Perhab <a.perhab@wtioit.at>
25 32

  
26 33
=head1 LICENSE
27 34

  
......
51 58

  
52 59
. "$MUNIN_LIBDIR/plugins/plugin.sh"
53 60

  
61
for_services() {
62
    if [ "$all_services" != "" ]; then
63
        systemctl --type=service --state=running --no-pager --no-legend --output=short-precise \
64
          | awk '{sub(".service$", "", $1); print $1}'
65
    else
66
        echo ${services:-"munin-node"}
67
    fi
68
}
69

  
54 70
output_config() {
55 71
    echo "graph_title Systemd Service Memory Usage"
56 72
    echo "graph_info Memory usage for selected services as reported by systemctl"
57 73
    echo "graph_vlabel bytes"
58 74
    echo "graph_args --base 1024 --lower-limit 0"
59 75
    echo "graph_category memory"
60
    for service in ${services:-"munin-node"}; do
76
    for service in $(for_services); do
61 77
        clean_name="$(clean_fieldname "$service")"
62 78
        description=$(systemctl show "$service" --property=Description | cut -d '=' -f 2)
63 79
        warning=$(systemctl show "$service" --property=MemoryHigh | cut -d '=' -f 2)
......
77 93
}
78 94

  
79 95
output_values() {
80
    for service in ${services:-"munin-node"}; do
96
    for service in $(for_services); do
81 97
        clean_name="$(clean_fieldname "$service")"
82 98
        usage=$(systemctl show "$service" --property=MemoryCurrent | cut -d '=' -f 2)
83 99
        if [ "$usage" = "[not set]" ]; then

Formats disponibles : Unified diff