FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
netdata/python.d/tomcat.chart.py at master · bosencoding/netdata · GitHub
bosencoding
/
netdata
Public
forked from
netdata/netdata
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
netdata
/
python.d
/
tomcat.chart.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
78 lines (70 loc) · 2.6 KB
Breadcrumbs
netdata
/
python.d
/
tomcat.chart.py
Copy path
File metadata and controls
78 lines (70 loc) · 2.6 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# -*- coding: utf-8 -*-
# Description: tomcat netdata python.d module
# Author: Pawel Krupa (paulfantom)
from
base
import
UrlService
import
xml
.
etree
.
ElementTree
as
ET
# phone home...
# default module values (can be overridden per job in `config`)
# update_every = 2
priority
=
60000
retries
=
60
# charts order (can be overridden if you want less charts, or different order)
ORDER
=
[
'accesses'
,
'volume'
,
'threads'
,
'jvm'
]
CHARTS
=
{
'accesses'
: {
'options'
: [
None
,
"tomcat requests"
,
"requests/s"
,
"statistics"
,
"tomcat.accesses"
,
"area"
],
'lines'
: [
[
"accesses"
]
]},
'volume'
: {
'options'
: [
None
,
"tomcat volume"
,
"KB/s"
,
"volume"
,
"tomcat.volume"
,
"area"
],
'lines'
: [
[
"volume"
,
None
,
'incremental'
]
]},
'threads'
: {
'options'
: [
None
,
"tomcat threads"
,
"current threads"
,
"statistics"
,
"tomcat.threads"
,
"line"
],
'lines'
: [
[
"current"
,
None
,
"absolute"
],
[
"busy"
,
None
,
"absolute"
]
]},
'jvm'
: {
'options'
: [
None
,
"JVM Free Memory"
,
"MB"
,
"statistics"
,
"tomcat.jvm"
,
"area"
],
'lines'
: [
[
"jvm"
,
None
,
"absolute"
]
]}
}
class
Service
(
UrlService
):
def
__init__
(
self
,
configuration
=
None
,
name
=
None
):
UrlService
.
__init__
(
self
,
configuration
=
configuration
,
name
=
name
)
if
len
(
self
.
url
)
==
0
:
self
.
url
=
"http://localhost:8080/manager/status?XML=true"
self
.
order
=
ORDER
self
.
definitions
=
CHARTS
# get port from url
self
.
port
=
0
for
i
in
self
.
url
.
split
(
'/'
):
try
:
int
(
i
[
-
1
])
self
.
port
=
i
.
split
(
':'
)[
-
1
]
break
except
:
pass
if
self
.
port
==
0
:
self
.
port
=
80
def
_get_data
(
self
):
"""
Format data received from http request
:return: dict
"""
try
:
raw
=
self
.
_get_raw_data
()
data
=
ET
.
fromstring
(
raw
)
memory
=
data
.
find
(
'./jvm/memory'
)
threads
=
data
.
find
(
"./connector[@name='
\"
http-bio-"
+
str
(
self
.
port
)
+
"
\"
']/threadInfo"
)
requests
=
data
.
find
(
"./connector[@name='
\"
http-bio-"
+
str
(
self
.
port
)
+
"
\"
']/requestInfo"
)
return
{
'accesses'
:
requests
.
attrib
[
'requestCount'
],
'volume'
:
requests
.
attrib
[
'bytesSent'
],
'current'
:
threads
.
attrib
[
'currentThreadCount'
],
'busy'
:
threads
.
attrib
[
'currentThreadsBusy'
],
'jvm'
:
memory
.
attrib
[
'free'
]}
except
(
ValueError
,
AttributeError
):
return
None
Back
|
FazBrowse Home
|
New Git URL