root / plugins / libreoffice / loolwsd @ a8c2b8af
Historique | Voir | Annoter | Télécharger (2,71 ko)
| 1 | 83323a47 | Sebastian L | #!/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 | a8c2b8af | Lars Kruse | echo "graph_category appserver" |
| 73 | 83323a47 | Sebastian L | echo "graph_vlabel open documents / active views" |
| 74 | echo "graph_info This graph shows currently open documents and active views." |
||
| 75 | echo "graph_args --base 1000 --lower-limit 0" |
||
| 76 | echo "documents.label open documents" |
||
| 77 | echo "documents.info Current number of open documents" |
||
| 78 | echo "documents.min 0" |
||
| 79 | echo "active_views.label active views" |
||
| 80 | echo "active_views.info Current number of active views" |
||
| 81 | echo "active_views.min 0" |
||
| 82 | echo "multigraph loolwsd_memory" |
||
| 83 | echo "graph_title Libreoffice Online Memory Usage" |
||
| 84 | a8c2b8af | Lars Kruse | echo "graph_category appserver" |
| 85 | 83323a47 | Sebastian L | echo "graph_vlabel memory usage of libreoffice online" |
| 86 | echo "graph_info This graph shows currently used memory of libreoffice online." |
||
| 87 | echo "graph_args --base 1000 --lower-limit 0" |
||
| 88 | echo "memory.label used memory" |
||
| 89 | echo "memory.info Currently used memory of libreoffice online" |
||
| 90 | echo "memory.min 0" |
||
| 91 | exit 0 |
||
| 92 | ;; |
||
| 93 | |||
| 94 | esac |
||
| 95 | |||
| 96 | STATS=$(curl -s -f -u "$USERNAME:$PASSWORD" "$STATS_URL") |
||
| 97 | echo "multigraph loolwsd_usage" |
||
| 98 | echo "documents.value $(echo "$STATS" | grep kit_assigned_count | cut -d " " -f 2)" |
||
| 99 | echo "active_views.value $(echo "$STATS" | grep document_active_views_active_count_total | cut -d " " -f 2)" |
||
| 100 | echo "multigraph loolwsd_memory" |
||
| 101 | echo "memory.value $(echo "$STATS" | grep global_memory_used_bytes | cut -d " " -f 2)" |
