Projet

Général

Profil

Révision 83323a47

ID83323a47273eb462cb14964135387c2cdb0b2a82
Parent 26e497fc
Enfant a8c2b8af

Ajouté par Sebastian L il y a environ 5 ans

loolwsd: Monitor libreoffice online usage

- Open documents and active views
- Memory usage

Voir les différences:

plugins/loolwsd/loolwsd
1
#!/bin/sh
2

  
3
set -e
4

  
5
: << =cut
6

  
7
=head1 NAME
8

  
9
loolwsd - Monitor usage (open documents and active views) and memory
10
usage of libreoffice online
11

  
12
=head1 APPLICABLE SYSTEMS
13

  
14
LibreOffice Online or Collabora Online or Collabora Online Development 
15
Edition
16

  
17
=head1 CONFIGURATION
18

  
19
Requires installed curl.
20

  
21
Set username, password of admin user and if required an url in your 
22
munin-node configuration. Default url is 
23
http://127.0.0.1:9980/lool/getMetrics
24

  
25
[loolwsd]
26
env.username <lool_admin>
27
env.password <lool_password>
28
env.url <lool_getmetrics_url>
29

  
30
You can set an administative user for loolwsd by invoking
31

  
32
loolconfig set-admin-password
33

  
34
=head1 AUTHOR
35

  
36
Copyright (C) 2020 Sebastian L. (https://momou.ch)
37

  
38
=head1 LICENSE
39

  
40
GPLv2
41

  
42
=head1 MAGIC MARKERS
43

  
44
 #%# family=manual
45
 #%# capabilities=autoconf
46

  
47
=cut
48

  
49
. "$MUNIN_LIBDIR/plugins/plugin.sh"
50

  
51
STATS_URL=${url:-"http://127.0.0.1:9980/lool/getMetrics"}
52
USERNAME="${username:-}"
53
PASSWORD="${password:-}"
54

  
55
case $1 in
56
    autoconf)
57
        if [ -x /usr/bin/loolwsd ]; then
58
		if [ -x /usr/bin/curl ]; then
59
			curl -s -f -m 2 -I -u "$USERNAME:$PASSWORD" "$STATS_URL" | grep -iq "Content-Type: text/plain" && echo "yes" && exit 0 || echo "no (invalid or empty response from loolwsd ($STATS_URL)" && exit 0
60
		else
61
			echo "no (/usr/bin/curl not found)" && exit 0
62
		fi
63
        else
64
		echo "no (/usr/bin/loolwsd not found)"
65
		exit 0
66
        fi
67
        ;;
68

  
69
   config)
70
	echo "multigraph loolwsd_usage"
71
	echo "graph_title Libreoffice Online Usage"
72
	echo "graph_vlabel open documents / active views"
73
	echo "graph_info This graph shows currently open documents and active views."
74
	echo "graph_args --base 1000 --lower-limit 0"
75
	echo "documents.label open documents"
76
	echo "documents.info Current number of open documents"
77
	echo "documents.min 0"
78
	echo "active_views.label active views"
79
	echo "active_views.info Current number of active views"
80
	echo "active_views.min 0"
81
	echo "multigraph loolwsd_memory"
82
	echo "graph_title Libreoffice Online Memory Usage"
83
	echo "graph_vlabel memory usage of libreoffice online"
84
	echo "graph_info This graph shows currently used memory of libreoffice online."
85
	echo "graph_args --base 1000 --lower-limit 0"
86
	echo "memory.label used memory"
87
	echo "memory.info Currently used memory of libreoffice online"
88
	echo "memory.min 0"
89
	exit 0
90
        ;;
91

  
92
esac
93

  
94
STATS=$(curl -s -f -u "$USERNAME:$PASSWORD" "$STATS_URL")
95
echo "multigraph loolwsd_usage"
96
echo "documents.value $(echo "$STATS" | grep kit_assigned_count | cut -d " " -f 2)"
97
echo "active_views.value $(echo "$STATS" | grep document_active_views_active_count_total | cut -d " " -f 2)"
98
echo "multigraph loolwsd_memory"
99
echo "memory.value $(echo "$STATS" | grep global_memory_used_bytes | cut -d " " -f 2)"

Formats disponibles : Unified diff