Projet

Général

Profil

Révision 8c941ed9

ID8c941ed9afd046f2c49e9a36d61b90b1202f308d
Parent c3e4adb1
Enfant 28cf364e

Ajouté par Lapo Luchini il y a presque 14 ans

Initial version

Voir les différences:

plugins/other/uptime
1
#!/bin/sh
2
#
3
# Plugin to get system uptime and kernel age
4
#
5
# Magic markers - optional - used by installation scripts and
6
# munin-config:
7
#
8
#%# family=manual
9
#%# capabilities=autoconf
10

  
11
if [ "$1" = "autoconf" ]; then
12
        echo "yes"
13
        exit 0
14
fi
15

  
16
if [ "$1" = "config" ]; then
17

  
18
        cat <<EOT
19
graph_title Uptime
20
graph_args --base 1000 -l 0
21
graph_vlabel days
22
graph_category System
23
compile.label kernel age
24
compile.type GAUGE
25
compile.min 0
26
compile.max 1000
27
compile.draw AREA
28
uptime.label uptime
29
uptime.type GAUGE
30
uptime.min 0
31
uptime.max 1000
32
uptime.draw AREA
33
EOT
34
        exit 0
35
fi
36

  
37
LANG=C
38
(
39
  /bin/date -j +'%s'
40
  /bin/date -jf '%a %b %d %T %Z %Y' \
41
    "`/sbin/sysctl kern.version | /usr/bin/sed -Ee '2,9d;s/^kern.version: [^:]+: //'`" +'%s'
42
  /sbin/sysctl kern.boottime | /usr/bin/sed -Ee 's/.* sec = ([0-9+].*)\,.*/\1/'
43
) | /usr/bin/awk '
44
BEGIN {
45
  getline; now=$0;
46
  getline; compile=$0
47
  getline; boot=$0;
48
  printf "compile.value %.3f\n", (now-compile)/86400
49
  printf "uptime.value %.3f\n", (now-boot)/86400
50
}'

Formats disponibles : Unified diff