Projet

Général

Profil

Révision 55401f04

ID55401f04c411af9bddf6dbbe91a0733bd260b438
Parent 2b7eaf95
Enfant 0bf4041d

Ajouté par Julien Francoz il y a presque 14 ans

Initial version

Voir les différences:

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

  
3
# Julien Francoz CoCoZ <julien@francoz.net>
4

  
5
# graph memory usage detail for a process using /proc/$PID/status
6
# create a link to this plugin with the syntax proc_yourprocessname_status
7
# example : proc_master_status pour postfix master process
8

  
9
cmd=`basename "$0"`
10
process=`echo "$cmd"| cut -d'_' -f 2`
11
pid=`pgrep -o -x "$process"`
12
#echo $pid
13

  
14
if [ "$1" = "autoconf" ]; then
15
	if [ -r /proc/$pid/status ]; then
16
		echo yes
17
		exit 0
18
	else
19
		echo no
20
		exit 1
21
	fi
22
fi
23

  
24
if [ "$1" = "config" ]; then
25

  
26
	echo "graph_title Memory usage for process $process"
27
	echo "graph_order VmExe VmLib VmStk VmData VmRSS VmSize"
28
	echo 'graph_vlabel Ko'
29
	echo 'graph_scale no'
30
	echo "graph_info This graph display memory usage for a process"
31
	echo 'graph_category system'
32
	echo 'graph_period second'
33

  
34
	echo 'VmExe.label VmExe'
35
	echo 'VmExe.draw AREA'
36
	echo "VmExe.info The size of the executable segment" 
37
	
38
	echo 'VmLib.label VmLib'
39
	echo 'VmLib.draw STACK'
40
	echo 'VmLib.info The size of the library code'
41
	
42
	echo 'VmStk.label VmStk'
43
	echo 'VmStk.draw STACK'
44
	echo 'VmStk.info The stack size'
45
	
46
	echo 'VmLck.label VmLck'
47
	echo 'VmLck.draw STACK'
48
	echo 'VmLck.info The amount of locked memory'
49
	
50
	echo 'VmData.label VmData'
51
	echo 'VmData.draw STACK'
52
	echo 'VmData.info The size of the Data segment'
53
	
54
	echo 'VmRSS.label VmRSS'
55
	echo 'VmRSS.draw LINE2'
56
	echo 'VmRSS.info The amount of memory mapped in RAM ( instead of swapped out)'
57
	
58
	echo 'VmSize.label VmSize'
59
	echo 'VmSize.draw LINE2'
60
	echo 'VmSize.info The size of the virtual memory allocated to the process'
61
	exit 0
62
fi
63

  
64
cat /proc/$pid/status |grep -E '^Vm' | sed -e 's/:/.value/' -e 's/\s\+kB$//' -e 's/\s\+/ /'

Formats disponibles : Unified diff