FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
netdata/python.d/apache.chart.py at master · johnfelipe/netdata · GitHub
johnfelipe
/
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
/
apache.chart.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
124 lines (113 loc) · 4.24 KB
Breadcrumbs
netdata
/
python.d
/
apache.chart.py
Copy path
File metadata and controls
124 lines (113 loc) · 4.24 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# -*- coding: utf-8 -*-
# Description: apache netdata python.d module
# Author: Pawel Krupa (paulfantom)
from
base
import
UrlService
# default module values (can be overridden per job in `config`)
# update_every = 2
priority
=
60000
retries
=
60
# default job configuration (overridden by python.d.plugin)
# config = {'local': {
# 'update_every': update_every,
# 'retries': retries,
# 'priority': priority,
# 'url': 'http://www.apache.org/server-status?auto'
# }}
# charts order (can be overridden if you want less charts, or different order)
ORDER
=
[
'requests'
,
'connections'
,
'conns_async'
,
'net'
,
'workers'
,
'reqpersec'
,
'bytespersec'
,
'bytesperreq'
]
CHARTS
=
{
'bytesperreq'
: {
'options'
: [
None
,
'apache Lifetime Avg. Response Size'
,
'bytes/request'
,
'statistics'
,
'apache.bytesperreq'
,
'area'
],
'lines'
: [
[
"size_req"
]
]},
'workers'
: {
'options'
: [
None
,
'apache Workers'
,
'workers'
,
'workers'
,
'apache.workers'
,
'stacked'
],
'lines'
: [
[
"idle"
],
[
"idle_servers"
,
'idle'
],
[
"busy"
],
[
"busy_servers"
,
'busy'
]
]},
'reqpersec'
: {
'options'
: [
None
,
'apache Lifetime Avg. Requests/s'
,
'requests/s'
,
'statistics'
,
'apache.reqpersec'
,
'area'
],
'lines'
: [
[
"requests_sec"
]
]},
'bytespersec'
: {
'options'
: [
None
,
'apache Lifetime Avg. Bandwidth/s'
,
'kilobytes/s'
,
'statistics'
,
'apache.bytesperreq'
,
'area'
],
'lines'
: [
[
"size_sec"
,
None
,
'absolute'
,
1
,
1000
]
]},
'requests'
: {
'options'
: [
None
,
'apache Requests'
,
'requests/s'
,
'requests'
,
'apache.requests'
,
'line'
],
'lines'
: [
[
"requests"
,
None
,
'incremental'
]
]},
'net'
: {
'options'
: [
None
,
'apache Bandwidth'
,
'kilobytes/s'
,
'bandwidth'
,
'apache.net'
,
'area'
],
'lines'
: [
[
"sent"
,
None
,
'incremental'
]
]},
'connections'
: {
'options'
: [
None
,
'apache Connections'
,
'connections'
,
'connections'
,
'apache.connections'
,
'line'
],
'lines'
: [
[
"connections"
]
]},
'conns_async'
: {
'options'
: [
None
,
'apache Async Connections'
,
'connections'
,
'connections'
,
'apache.conns_async'
,
'stacked'
],
'lines'
: [
[
"keepalive"
],
[
"closing"
],
[
"writing"
]
]}
}
ASSIGNMENT
=
{
"BytesPerReq"
:
'size_req'
,
"IdleWorkers"
:
'idle'
,
"IdleServers"
:
'idle_servers'
,
"BusyWorkers"
:
'busy'
,
"BusyServers"
:
'busy_servers'
,
"ReqPerSec"
:
'requests_sec'
,
"BytesPerSec"
:
'size_sec'
,
"Total Accesses"
:
'requests'
,
"Total kBytes"
:
'sent'
,
"ConnsTotal"
:
'connections'
,
"ConnsAsyncKeepAlive"
:
'keepalive'
,
"ConnsAsyncClosing"
:
'closing'
,
"ConnsAsyncWriting"
:
'writing'
}
class
Service
(
UrlService
):
def
__init__
(
self
,
configuration
=
None
,
name
=
None
):
UrlService
.
__init__
(
self
,
configuration
=
configuration
,
name
=
name
)
self
.
order
=
ORDER
self
.
definitions
=
CHARTS
self
.
url
=
self
.
configuration
.
get
(
'url'
,
'http://localhost/server-status?auto'
)
def
check
(
self
):
if
UrlService
.
check
(
self
):
if
'idle_servers'
in
self
.
_data_from_check
:
self
.
__module__
=
'lighttpd'
for
chart
in
self
.
definitions
:
opts
=
self
.
definitions
[
chart
][
'options'
]
opts
[
1
]
=
opts
[
1
].
replace
(
'apache'
,
'lighttpd'
)
opts
[
4
]
=
opts
[
4
].
replace
(
'apache'
,
'lighttpd'
)
return
True
return
False
def
_get_data
(
self
):
"""
Format data received from http request
:return: dict
"""
raw_data
=
self
.
_get_raw_data
()
if
not
raw_data
:
return
None
data
=
dict
()
for
row
in
raw_data
.
split
(
'
\n
'
):
tmp
=
row
.
split
(
":"
)
if
tmp
[
0
]
in
ASSIGNMENT
:
try
:
data
[
ASSIGNMENT
[
tmp
[
0
]]]
=
int
(
float
(
tmp
[
1
]))
except
(
IndexError
,
ValueError
):
continue
return
data
or
None
Back
|
FazBrowse Home
|
New Git URL