Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HPCasCode
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hpc-team
HPCasCode
Commits
1a442c78
Commit
1a442c78
authored
6 years ago
by
Gin Tan
Browse files
Options
Downloads
Plain Diff
Merge branch 'collectd' into 'master'
Collectd See merge request hpc-team/ansible_cluster_in_a_box!213
parents
baed119d
cc87b3ae
No related branches found
Branches containing commit
No related tags found
1 merge request
!213
Collectd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
roles/collectd/templates/cuda_collectd.py.j2
+21
-4
21 additions, 4 deletions
roles/collectd/templates/cuda_collectd.py.j2
with
21 additions
and
4 deletions
roles/collectd/templates/cuda_collectd.py.j2
+
21
−
4
View file @
1a442c78
#!/usr/bin/env python
#!/usr/bin/env python
import
collectd
try
:
import
collectd
from
collectd
import
Values
except
:
from
fakeCollectd
import
Values
import
subprocess
import
subprocess
import
xml.etree.ElementTree
as
ET
import
xml.etree.ElementTree
as
ET
def
read
(
data
=
None
):
def
read
(
data
=
None
):
vl
=
collectd
.
Values
(
type
=
'
gauge
'
)
vl
=
Values
(
type
=
'
gauge
'
)
vl
.
plugin
=
'
cuda
'
vl
.
plugin
=
'
cuda
'
out
=
subprocess
.
check_output
([
'
nvidia-smi
'
,
'
-q
'
,
'
-x
'
])
out
=
subprocess
.
check_output
([
'
nvidia-smi
'
,
'
-q
'
,
'
-x
'
])
...
@@ -30,6 +35,18 @@ def read(data=None):
...
@@ -30,6 +35,18 @@ def read(data=None):
values
=
[
1e6
*
float
(
gpu
.
find
(
'
utilization/gpu_util
'
).
text
.
split
()[
0
])])
values
=
[
1e6
*
float
(
gpu
.
find
(
'
utilization/gpu_util
'
).
text
.
split
()[
0
])])
except
:
except
:
pass
pass
try
:
collectd
.
register_read
(
read
)
vl
.
dispatch
(
type
=
'
gauge
'
,
type_instance
=
'
power_state
'
,
values
=
[
int
(
gpu
.
find
(
'
power_readings/power_state
'
).
text
.
split
()[
0
][
1
:])])
except
:
pass
try
:
vl
.
dispatch
(
type
=
'
gauge
'
,
type_instance
=
'
power_draw
'
,
values
=
[
float
(
gpu
.
find
(
'
power_readings/power_draw
'
).
text
.
split
()[
0
])])
except
:
pass
try
:
collectd
.
register_read
(
read
)
except
:
readtest
()
This diff is collapsed.
Click to expand it.
Gin Tan
@gintan
mentioned in commit
08156dc0
·
4 years ago
mentioned in commit
08156dc0
mentioned in commit 08156dc0d4fa47ac7a10e3ea89d586b6e538205c
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment