FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
netdata/python.d/apache_cache.chart.py at master · johnulist/netdata · GitHub
johnulist
/
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_cache.chart.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
60 lines (52 loc) · 1.58 KB
Breadcrumbs
netdata
/
python.d
/
apache_cache.chart.py
Copy path
File metadata and controls
60 lines (52 loc) · 1.58 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
# -*- coding: utf-8 -*-
# Description: apache cache netdata python.d module
# Author: Pawel Krupa (paulfantom)
from
base
import
LogService
priority
=
60000
retries
=
60
# update_every = 3
ORDER
=
[
'cache'
]
CHARTS
=
{
'cache'
: {
'options'
: [
None
,
'apache cached responses'
,
'percent cached'
,
'cached'
,
'apache_cache.cache'
,
'stacked'
],
'lines'
: [
[
"hit"
,
'cache'
,
"percentage-of-absolute-row"
],
[
"miss"
,
None
,
"percentage-of-absolute-row"
],
[
"other"
,
None
,
"percentage-of-absolute-row"
]
]}
}
class
Service
(
LogService
):
def
__init__
(
self
,
configuration
=
None
,
name
=
None
):
LogService
.
__init__
(
self
,
configuration
=
configuration
,
name
=
name
)
if
len
(
self
.
log_path
)
==
0
:
self
.
log_path
=
"/var/log/apache2/cache.log"
self
.
order
=
ORDER
self
.
definitions
=
CHARTS
def
_get_data
(
self
):
"""
Parse new log lines
:return: dict
"""
try
:
raw
=
self
.
_get_raw_data
()
if
raw
is
None
:
return
None
elif
not
raw
:
return
{
'hit'
:
0
,
'miss'
:
0
,
'other'
:
0
}
except
(
ValueError
,
AttributeError
):
return
None
hit
=
0
miss
=
0
other
=
0
for
line
in
raw
:
if
"cache hit"
in
line
:
hit
+=
1
elif
"cache miss"
in
line
:
miss
+=
1
else
:
other
+=
1
return
{
'hit'
:
hit
,
'miss'
:
miss
,
'other'
:
other
}
Back
|
FazBrowse Home
|
New Git URL