Skip to content

Commit

Permalink
Make dcgm-exporter listen address configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
Deezzir committed Sep 11, 2024
1 parent 5be4161 commit 349ee7a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
8 changes: 7 additions & 1 deletion snap/hooks/configure
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@
# Register config options if unset,
# so users can see available options by running
# `sudo snap get dcgm`.
[ -z "$(snapctl get nv-hostengine-port)" ] && snapctl set nv-hostengine-port=
if [ -z "$(snapctl get nv-hostengine-port)" ]; then
snapctl set nv-hostengine-port=""
fi

if [ -z "$(snapctl get dcgm_exporter_listen)" ]; then
snapctl set dcgm_exporter_listen=""
fi
14 changes: 14 additions & 0 deletions snap/local/run_dcgm_exporter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -euo pipefail

# Build the argument list for the dcgm-exporter command
args=()

# Add the dcgm-exporter-port option if it is set. Default: “:9400”
dcgm_exporter_listen="$(snapctl get dcgm_exporter_listen)"

if [ -n "$dcgm_exporter_listen" ]; then
args+=("-a" "$dcgm_exporter_listen")
fi

exec "$SNAP/bin/dcgm-exporter" "${args[@]}"
4 changes: 2 additions & 2 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@ package-repositories:

apps:
dcgm-exporter:
command: bin/dcgm-exporter
command: run_dcgm_exporter.sh
plugs:
- network-bind
- opengl
daemon: simple
install-mode: disable
restart-condition: on-failure
restart-delay: 2s
dcgmi:
command: usr/bin/dcgmi
plugs:
Expand Down Expand Up @@ -61,6 +60,7 @@ parts:
override-build: |
craftctl default
chmod +x run_nv_hostengine.sh
chmod +x run_dcgm_exporter.sh
dcgm-exporter:
plugin: go
stage-packages: [datacenter-gpu-manager]
Expand Down

0 comments on commit 349ee7a

Please sign in to comment.