Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
monitor-client
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0fb681e6
authored
Oct 26, 2016
by
Szabolcs Gelencser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle empty storage table infos result. Get time from local time
for vm metrics. Log sent metrics.
parent
f1cf131d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
10 deletions
+7
-10
src/azureperformancecounters.py
+1
-1
src/client.py
+6
-9
No files found.
src/azureperformancecounters.py
View file @
0fb681e6
...
@@ -62,7 +62,7 @@ class AzureVmPerformanceCounters(object):
...
@@ -62,7 +62,7 @@ class AzureVmPerformanceCounters(object):
headers
=
{
"Authorization"
:
'Bearer '
+
self
.
accessToken
}
headers
=
{
"Authorization"
:
'Bearer '
+
self
.
accessToken
}
json_output
=
requests
.
get
(
list_metrics_url
,
headers
=
headers
)
.
json
()
json_output
=
requests
.
get
(
list_metrics_url
,
headers
=
headers
)
.
json
()
if
json_output
.
has_key
(
"value"
):
if
json_output
.
has_key
(
"value"
)
and
len
(
json_output
[
"value"
])
>
0
:
return
json_output
[
"value"
]
return
json_output
[
"value"
]
else
:
else
:
return
None
return
None
...
...
src/client.py
View file @
0fb681e6
...
@@ -196,9 +196,7 @@ class Client:
...
@@ -196,9 +196,7 @@ class Client:
'vm.
%(name)
s.memory.usage
%(value)
f
%(time)
d'
%
{
'vm.
%(name)
s.memory.usage
%(value)
f
%(time)
d'
%
{
'name'
:
vm
.
name
,
'name'
:
vm
.
name
,
'value'
:
vm_counters
[
"memory_usage"
][
"value"
],
'value'
:
vm_counters
[
"memory_usage"
][
"value"
],
'time'
:
self
.
datetime_to_time
(
'time'
:
time
.
time
(),
vm_counters
[
"memory_usage"
][
"timestamp"
],
),
}
}
)
)
...
@@ -207,9 +205,7 @@ class Client:
...
@@ -207,9 +205,7 @@ class Client:
'vm.
%(name)
s.cpu.percent
%(value)
f
%(time)
d'
%
{
'vm.
%(name)
s.cpu.percent
%(value)
f
%(time)
d'
%
{
'name'
:
vm
.
name
,
'name'
:
vm
.
name
,
'value'
:
vm_counters
[
"processor_usage"
][
"value"
],
'value'
:
vm_counters
[
"processor_usage"
][
"value"
],
'time'
:
self
.
datetime_to_time
(
'time'
:
time
.
time
(),
vm_counters
[
"processor_usage"
][
"timestamp"
],
),
}
}
)
)
...
@@ -223,9 +219,7 @@ class Client:
...
@@ -223,9 +219,7 @@ class Client:
'name'
:
vm
.
name
,
'name'
:
vm
.
name
,
'interface'
:
"eth0"
,
'interface'
:
"eth0"
,
'metric'
:
pc_name
,
'metric'
:
pc_name
,
'time'
:
self
.
datetime_to_time
(
'time'
:
time
.
time
(),
vm_counters
[
pc_name
][
"timestamp"
],
),
'data'
:
vm_counters
[
pc_name
][
"value"
],
'data'
:
vm_counters
[
pc_name
][
"value"
],
}
}
)
)
...
@@ -238,6 +232,9 @@ class Client:
...
@@ -238,6 +232,9 @@ class Client:
}
}
)
)
logger
.
info
(
"current metrics:"
)
logger
.
info
(
metrics
)
return
metrics
return
metrics
@staticmethod
@staticmethod
...
...
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