Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
830f268c
authored
Feb 03, 2014
by
Gregory Nagy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed import
parent
da3f97fa
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
20 deletions
+20
-20
circle/monitor/calvin/calvin.py
+20
-20
circle/monitor/calvin/calvin/__init__.py
+0
-0
No files found.
circle/monitor/calvin/calvin
/calvin
.py
→
circle/monitor/calvin/calvin.py
View file @
830f268c
...
...
@@ -17,16 +17,16 @@ class GraphiteHandler:
def
put
(
self
,
query
):
self
.
__queries
.
append
(
query
)
def
clean
UpQ
ueries
(
self
):
def
clean
_up_q
ueries
(
self
):
self
.
__queries
=
[]
def
clean
UpR
esponses
(
self
):
def
clean
_up_r
esponses
(
self
):
self
.
__responses
=
[]
def
is
E
mpty
(
self
):
def
is
_e
mpty
(
self
):
return
len
(
self
.
__queries
)
is
0
def
generate
A
ll
(
self
):
def
generate
_a
ll
(
self
):
"""
Regenerate the queries before sending.
"""
...
...
@@ -43,12 +43,12 @@ class GraphiteHandler:
url_base
=
"http://
%
s:
%
s/render?"
%
(
self
.
__server_name
,
self
.
__server_port
)
for
query
in
self
.
__queries
:
response
=
requests
.
get
(
url_base
+
query
.
get
G
enerated
())
if
query
.
get
F
ormat
()
is
"json"
:
response
=
requests
.
get
(
url_base
+
query
.
get
_g
enerated
())
if
query
.
get
_f
ormat
()
is
"json"
:
self
.
__responses
.
append
(
response
.
json
())
# DICT
else
:
self
.
__responses
.
append
(
response
)
self
.
clean
UpQ
ueries
()
self
.
clean
_up_q
ueries
()
def
pop
(
self
):
"""
...
...
@@ -76,7 +76,7 @@ class Query:
self
.
__response_format
=
"json"
self
.
__generated
=
""
def
set
T
arget
(
self
,
target
):
def
set
_t
arget
(
self
,
target
):
"""
Hostname of the target we should get the information from.
After the hostname you should use the domain the target is in.
...
...
@@ -85,16 +85,16 @@ class Query:
"""
self
.
__target
=
'.'
.
join
(
target
.
split
(
'.'
)[::
-
1
])
def
get
T
arget
(
self
):
def
get
_t
arget
(
self
):
return
self
.
__target
def
set
M
etric
(
self
,
metric
):
def
set
_m
etric
(
self
,
metric
):
self
.
__metric
=
metric
def
get
M
etric
(
self
):
def
get
_m
etric
(
self
):
return
self
.
__metric
def
set
AbsoluteS
tart
(
self
,
year
,
month
,
day
,
hour
,
minute
):
def
set
_absolute_s
tart
(
self
,
year
,
month
,
day
,
hour
,
minute
):
"""
Function for setting the time you want to get the reports from.
"""
...
...
@@ -102,7 +102,7 @@ class Query:
raise
self
.
__start
=
hour
+
":"
+
minute
+
"_"
+
year
+
month
+
day
def
set
RelativeS
tart
(
self
,
value
,
scale
):
def
set
_relative_s
tart
(
self
,
value
,
scale
):
"""
Function for setting the time you want to get the reports from.
"""
...
...
@@ -111,10 +111,10 @@ class Query:
raise
self
.
__start
=
"-"
+
str
(
value
)
+
scale
def
get
S
tart
(
self
):
def
get
_s
tart
(
self
):
return
self
.
__start
def
set
AbsoluteE
nd
(
self
,
year
,
month
,
day
,
hour
,
minute
):
def
set
_absolute_e
nd
(
self
,
year
,
month
,
day
,
hour
,
minute
):
"""
Function for setting the time until you want to get the reports from.
"""
...
...
@@ -122,7 +122,7 @@ class Query:
raise
self
.
__end
=
hour
+
":"
+
minute
+
"_"
+
year
+
month
+
day
def
set
RelativeE
nd
(
self
,
value
,
scale
):
def
set
_relative_e
nd
(
self
,
value
,
scale
):
"""
Function for setting the time until you want to get the reports from.
"""
...
...
@@ -131,10 +131,10 @@ class Query:
raise
self
.
__end
=
"-"
+
str
(
value
)
+
scale
def
get
E
nd
(
self
):
def
get
_e
nd
(
self
):
return
self
.
__end
def
set
F
ormat
(
self
,
fmat
):
def
set
_f
ormat
(
self
,
fmat
):
"""
Function for setting the format of the response from the server.
Valid values: ["csv", "raw", "json"]
...
...
@@ -144,7 +144,7 @@ class Query:
raise
self
.
__response_format
=
fmat
def
get
F
ormat
(
self
):
def
get
_f
ormat
(
self
):
return
self
.
__response_format
def
generate
(
self
):
...
...
@@ -162,7 +162,7 @@ class Query:
self
.
__generated
=
tmp
return
self
.
__generated
def
get
G
enerated
(
self
):
def
get
_g
enerated
(
self
):
"""
Returns the generated query string.
Throws exception if it haven't been done yet.
...
...
circle/monitor/calvin/calvin/__init__.py
deleted
100644 → 0
View file @
da3f97fa
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment