FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
netdata/python.d/dovecot.chart.py at master · suker413/netdata · GitHub
suker413
/
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
/
dovecot.chart.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
135 lines (126 loc) · 4.68 KB
Breadcrumbs
netdata
/
python.d
/
dovecot.chart.py
Copy path
File metadata and controls
135 lines (126 loc) · 4.68 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
125
126
127
128
129
130
131
132
133
134
135
# -*- coding: utf-8 -*-
# Description: dovecot netdata python.d module
# Author: Pawel Krupa (paulfantom)
from
base
import
SocketService
# 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
=
[
'sessions'
,
'logins'
,
'commands'
,
'faults'
,
'context_switches'
,
'io'
,
'net'
,
'syscalls'
,
'lookup'
,
'cache'
,
'auth'
,
'auth_cache'
]
CHARTS
=
{
'sessions'
: {
'options'
: [
None
,
"Dovecot Active Sessions"
,
'number'
,
'sessions'
,
'dovecot.sessions'
,
'line'
],
'lines'
: [
[
'num_connected_sessions'
,
'active sessions'
,
'absolute'
]
]},
'logins'
: {
'options'
: [
None
,
"Dovecot Logins"
,
'number'
,
'logins'
,
'dovecot.logins'
,
'line'
],
'lines'
: [
[
'num_logins'
,
'logins'
,
'absolute'
]
]},
'commands'
: {
'options'
: [
None
,
"Dovecot Commands"
,
"commands"
,
'commands'
,
'dovecot.commands'
,
'line'
],
'lines'
: [
[
'num_cmds'
,
'commands'
,
'absolute'
]
]},
'faults'
: {
'options'
: [
None
,
"Dovecot Page Faults"
,
"faults"
,
'page faults'
,
'dovecot.faults'
,
'line'
],
'lines'
: [
[
'min_faults'
,
'minor'
,
'absolute'
],
[
'maj_faults'
,
'major'
,
'absolute'
]
]},
'context_switches'
: {
'options'
: [
None
,
"Dovecot Context Switches"
,
''
,
'context switches'
,
'dovecot.context_switches'
,
'line'
],
'lines'
: [
[
'vol_cs'
,
'volountary'
,
'absolute'
],
[
'invol_cs'
,
'involountary'
,
'absolute'
]
]},
'io'
: {
'options'
: [
None
,
"Dovecot Disk I/O"
,
'kilobytes/s'
,
'disk'
,
'dovecot.io'
,
'area'
],
'lines'
: [
[
'disk_input'
,
'read'
,
'incremental'
,
1
,
1024
],
[
'disk_output'
,
'write'
,
'incremental'
,
-
1
,
1024
]
]},
'net'
: {
'options'
: [
None
,
"Dovecot Network Bandwidth"
,
'kilobits/s'
,
'network'
,
'dovecot.net'
,
'area'
],
'lines'
: [
[
'read_bytes'
,
'read'
,
'incremental'
,
8
,
1024
],
[
'write_bytes'
,
'write'
,
'incremental'
,
-
8
,
1024
]
]},
'syscalls'
: {
'options'
: [
None
,
"Dovecot Number of SysCalls"
,
'syscalls/s'
,
'system'
,
'dovecot.syscalls'
,
'line'
],
'lines'
: [
[
'read_count'
,
'read'
,
'incremental'
],
[
'write_count'
,
'write'
,
'incremental'
]
]},
'lookup'
: {
'options'
: [
None
,
"Dovecot Lookups"
,
'number/s'
,
'lookups'
,
'dovecot.lookup'
,
'stacked'
],
'lines'
: [
[
'mail_lookup_path'
,
'path'
,
'incremental'
],
[
'mail_lookup_attr'
,
'attr'
,
'incremental'
]
]},
'cache'
: {
'options'
: [
None
,
"Dovecot Cache Hits"
,
'hits/s'
,
'cache'
,
'dovecot.cache'
,
'line'
],
'lines'
: [
[
'mail_cache_hits'
,
'hits'
,
'incremental'
]
]},
'auth'
: {
'options'
: [
None
,
"Dovecot Authentications"
,
'attempts'
,
'logins'
,
'dovecot.auth'
,
'stacked'
],
'lines'
: [
[
'auth_successes'
,
'ok'
,
'absolute'
],
[
'auth_failures'
,
'failed'
,
'absolute'
]
]},
'auth_cache'
: {
'options'
: [
None
,
"Dovecot Authentication Cache"
,
'number'
,
'cache'
,
'dovecot.auth_cache'
,
'stacked'
],
'lines'
: [
[
'auth_cache_hits'
,
'hit'
,
'absolute'
],
[
'auth_cache_misses'
,
'miss'
,
'absolute'
]
]}
}
class
Service
(
SocketService
):
def
__init__
(
self
,
configuration
=
None
,
name
=
None
):
SocketService
.
__init__
(
self
,
configuration
=
configuration
,
name
=
name
)
self
.
request
=
"EXPORT
\t
global
\r
\n
"
self
.
host
=
None
# localhost
self
.
port
=
None
# 24242
# self._keep_alive = True
self
.
unix_socket
=
"/var/run/dovecot/stats"
self
.
order
=
ORDER
self
.
definitions
=
CHARTS
def
_get_data
(
self
):
"""
Format data received from socket
:return: dict
"""
try
:
raw
=
self
.
_get_raw_data
()
except
(
ValueError
,
AttributeError
):
return
None
if
raw
is
None
:
self
.
debug
(
"dovecot returned no data"
)
return
None
data
=
raw
.
split
(
'
\n
'
)[:
2
]
desc
=
data
[
0
].
split
(
'
\t
'
)
vals
=
data
[
1
].
split
(
'
\t
'
)
# ret = dict(zip(desc, vals))
ret
=
{}
for
i
in
range
(
len
(
desc
)):
try
:
#d = str(desc[i])
#if d in ('user_cpu', 'sys_cpu', 'clock_time'):
# val = float(vals[i])
#else:
# val = int(vals[i])
#ret[d] = val
ret
[
str
(
desc
[
i
])]
=
int
(
vals
[
i
])
except
ValueError
:
pass
if
len
(
ret
)
==
0
:
return
None
return
ret
Back
|
FazBrowse Home
|
New Git URL