Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
507267b5
authored
Nov 11, 2013
by
Nagy Gergő
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Formating fixed.
parent
ed351d66
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
circle/monitor/calvin/src/calvin.py
+13
-10
No files found.
circle/monitor/calvin/src/calvin.py
View file @
507267b5
import
json
,
requests
import
requests
class
GraphiteHandler
:
class
GraphiteHandler
:
def
__init__
(
self
,
server_name
=
"localhost"
,
server_port
=
"8080"
):
def
__init__
(
self
,
server_name
=
"localhost"
,
server_port
=
"8080"
):
self
.
__server_name
=
server_name
self
.
__server_name
=
server_name
self
.
__server_port
=
server_port
self
.
__server_port
=
server_port
self
.
__queries
=
[]
self
.
__queries
=
[]
...
@@ -34,11 +35,12 @@ class GraphiteHandler:
...
@@ -34,11 +35,12 @@ class GraphiteHandler:
Important: After sending queries to the server the fifo will lost its
Important: After sending queries to the server the fifo will lost its
content.
content.
"""
"""
url_base
=
"http://
%
s:
%
s/render?"
%
(
self
.
__server_name
,
self
.
__server_port
)
url_base
=
"http://
%
s:
%
s/render?"
%
(
self
.
__server_name
,
self
.
__server_port
)
for
query
in
self
.
__queries
:
for
query
in
self
.
__queries
:
response
=
requests
.
get
(
url_base
+
query
.
getGenerated
())
response
=
requests
.
get
(
url_base
+
query
.
getGenerated
())
if
query
.
getFormat
()
is
"json"
:
if
query
.
getFormat
()
is
"json"
:
self
.
__responses
.
append
(
response
.
json
()
[
0
])
#
DICT
self
.
__responses
.
append
(
response
.
json
()
)
#
DICT
else
:
else
:
self
.
__responses
.
append
(
response
)
self
.
__responses
.
append
(
response
)
self
.
cleanUpQueries
()
self
.
cleanUpQueries
()
...
@@ -52,6 +54,7 @@ class GraphiteHandler:
...
@@ -52,6 +54,7 @@ class GraphiteHandler:
except
:
except
:
print
(
"There is no more responses."
)
print
(
"There is no more responses."
)
class
Query
:
class
Query
:
def
__init__
(
self
):
def
__init__
(
self
):
...
@@ -90,7 +93,7 @@ class Query:
...
@@ -90,7 +93,7 @@ class Query:
"""
"""
Function for setting the time you want to get the reports from.
Function for setting the time you want to get the reports from.
"""
"""
if
(
len
(
year
)
>
4
or
len
(
year
)
<
2
):
if
(
len
(
year
)
>
4
or
len
(
year
)
<
2
):
raise
raise
self
.
__start
=
hour
+
":"
+
minute
+
"_"
+
year
+
month
+
day
self
.
__start
=
hour
+
":"
+
minute
+
"_"
+
year
+
month
+
day
...
@@ -98,7 +101,8 @@ class Query:
...
@@ -98,7 +101,8 @@ class Query:
"""
"""
Function for setting the time you want to get the reports from.
Function for setting the time you want to get the reports from.
"""
"""
if
scale
not
in
[
"years"
,
"months"
,
"days"
,
"hours"
,
"minutes"
,
"seconds"
]:
if
(
scale
not
in
[
"years"
,
"months"
,
"days"
,
"hours"
,
"minutes"
,
"seconds"
]):
raise
raise
self
.
__start
=
"-"
+
str
(
value
)
+
scale
self
.
__start
=
"-"
+
str
(
value
)
+
scale
...
@@ -109,7 +113,7 @@ class Query:
...
@@ -109,7 +113,7 @@ class Query:
"""
"""
Function for setting the time until you want to get the reports from.
Function for setting the time until you want to get the reports from.
"""
"""
if
(
len
(
year
)
>
4
or
len
(
year
)
<
2
):
if
(
len
(
year
)
>
4
or
len
(
year
)
<
2
):
raise
raise
self
.
__end
=
hour
+
":"
+
minute
+
"_"
+
year
+
month
+
day
self
.
__end
=
hour
+
":"
+
minute
+
"_"
+
year
+
month
+
day
...
@@ -117,7 +121,8 @@ class Query:
...
@@ -117,7 +121,8 @@ class Query:
"""
"""
Function for setting the time until you want to get the reports from.
Function for setting the time until you want to get the reports from.
"""
"""
if
scale
not
in
[
"years"
,
"months"
,
"days"
,
"hours"
,
"minutes"
,
"seconds"
]:
if
(
scale
not
in
[
"years"
,
"months"
,
"days"
,
"hours"
,
"minutes"
,
"seconds"
]):
raise
raise
self
.
__end
=
"-"
+
str
(
value
)
+
scale
self
.
__end
=
"-"
+
str
(
value
)
+
scale
...
@@ -160,5 +165,3 @@ class Query:
...
@@ -160,5 +165,3 @@ class Query:
if
len
(
self
.
__generated
)
is
0
:
if
len
(
self
.
__generated
)
is
0
:
raise
raise
return
self
.
__generated
return
self
.
__generated
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