Projet

Général

Profil

Révision 5d09d494

ID5d09d49499bb7dd330e17370981ed30442f90f2e
Parent 52a6d10b
Enfant 072743b5

Ajouté par Bushmills il y a presque 14 ans

Initial version

Voir les différences:

plugins/other/logins
1
#!/bin/sh
2

  
3
do_config()  {
4
graph=(          2            # number of graphs.
5
   label  draw  colour        # graph setup
6
   logins AREA  40ff40        #   1st graph setup data
7
   users  LINE2 ff0080        #   2nd graph setup data
8
)
9

  
10
cat << EOF
11
graph_title Users Online
12
graph_vlabel Number of users and logins
13
graph_category logins
14
graph_args --base 1000 -l 0
15
graph_scale no
16
EOF
17

  
18
# can go into an include file
19
labels=$((${#graph[*]}/(graph+1)))
20
for ((i=0; i<graph; i++)); do    
21
   for ((j=0; j<labels; j++)); do 
22
      conf=$((i*labels+labels+1))
23
      echo "${graph[conf]}.${graph[j+1]} ${graph[conf+j]}"    
24
   done
25
done
26
}
27

  
28
do_fetch()  {
29
   echo "logins.value $(who | wc -l)"
30
   echo "users.value $(who | sed 's/ .*//' | sort -u | wc -l)"
31
}
32

  
33
do_${1:-fetch}
34
exit 0

Formats disponibles : Unified diff