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
e6736688
authored
Nov 11, 2013
by
Nagy Gergő
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed test code formatting
parent
76948cf4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
11 deletions
+9
-11
circle/monitor/calvin/examples/basic.py
+6
-8
circle/monitor/calvin/examples/test.py
+3
-3
No files found.
circle/monitor/calvin/examples/basic.py
View file @
e6736688
...
...
@@ -6,16 +6,16 @@ server_port = "8080"
query
=
Query
()
query
.
setTarget
(
"1889.foo.fook.fookie.com.DOMAIN"
)
query
.
setMetric
(
"cpu.usage"
)
query
.
setFormat
(
"json"
)
#
Not neccesary, default is json
query
.
setRelativeStart
(
1
,
"minutes"
)
#
Current cpu usage
query
.
setFormat
(
"json"
)
#Not neccesary, default is json
query
.
setRelativeStart
(
1
,
"minutes"
)
#Current cpu usage
query
.
generate
()
#
print(query.getGenerated())
#print(query.getGenerated())
print
(
query
.
getStart
())
#
query.setAbsoluteStart("1889", "04", "20", "00", "00")
#
query.setRelativeEnd(...)
#
query.setAbsoluteEnd(...)
#query.setAbsoluteStart("1889", "04", "20", "00", "00")
#query.setRelativeEnd(...)
#query.setAbsoluteEnd(...)
handler
=
GraphiteHandler
(
server_name
,
server_port
)
...
...
@@ -25,5 +25,3 @@ response = handler.pop()
print
(
response
[
"target"
])
print
(
response
[
"datapoints"
])
circle/monitor/calvin/examples/test.py
View file @
e6736688
...
...
@@ -7,12 +7,12 @@ query.setMetric("cpu.usage")
query
.
setAbsoluteStart
(
"2013"
,
"10"
,
"23"
,
"00"
,
"00"
)
query
.
generate
()
handler
=
GraphiteHandler
(
"10.9.1.209"
)
handler
=
GraphiteHandler
(
"10.9.1.209"
)
times
=
int
(
input
(
"How many requests do you intend to send? [postive integer] "
))
global_start
=
datetime
.
datetime
.
now
()
for
i
in
range
(
1
,
times
):
for
i
in
range
(
1
,
times
):
local_start
=
datetime
.
datetime
.
now
()
handler
.
put
(
query
)
handler
.
send
()
...
...
@@ -24,5 +24,5 @@ print("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*")
print
(
"Summary:"
)
print
(
global_end
-
global_start
)
print
(
"AVG:"
)
print
((
global_end
-
global_start
)
/
times
)
print
((
global_end
-
global_start
)
/
times
)
print
(
"*-*-*-*-*-*-*-*-*-*-*-*-*-*-*"
)
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