Skip to content

Commit

Permalink
improve: asset tag webui integration
Browse files Browse the repository at this point in the history
  • Loading branch information
paepckehh committed Jan 10, 2025
1 parent 7be0643 commit 3a4cf89
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion api.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

// global exported consts
const SemVer = "v0.1.54"
const SemVer = "v0.1.55"

// global var
var (
Expand Down
4 changes: 2 additions & 2 deletions example-env-config-complex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export OPN_SLEEP='60'
export OPN_DEBUG='1'
export OPN_SYNC_PKG='1'
export OPN_HTTPD_SERVER='127.0.0.1:6464'
# export OPN_HTTPD_COLOR_FG='black'
# export OPN_HTTPD_COLOR_BG='orange'
export OPN_HTTPD_COLOR_FG='black'
export OPN_HTTPD_COLOR_BG='orange'
export OPN_RSYSLOG_ENABLE='1'
export OPN_RSYSLOG_SERVER='192.168.122.1:5140'
export OPN_GRAFANA_WEBUI='http://localhost:9090'
Expand Down
2 changes: 2 additions & 0 deletions example-env-config-unifi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export OPN_PATH='/tmp/opn'
export OPN_SLEEP='60'
export OPN_DEBUG='1'
export OPN_SYNC_PKG='1'
export OPN_RSYSLOG_ENABLE='1'
export OPN_RSYSLOG_SERVER='192.168.122.1:5140'
export OPN_HTTPD_SERVER='127.0.0.1:6464'
export OPN_GRAFANA_WEBUI='http://localhost:9090'
export OPN_GRAFANA_DASHBOARD_FREEBSD='Kczn-jPZz/node-exporter-freebsd'
Expand Down
Binary file modified resources/screenshot02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions srv.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,17 @@ func srv(config *OPNCall) error {
switch len(s) {
case 1:
if len(s[0]) > 0 {
status := _na + " <b>Member: </b> " + s[0] + " <b>Version: </b>n/a <b>Last Seen: </b>n/a<br>"
status := _na + " <b>Member: </b> " + s[0] + " <b>Version: </b>n/a <b>Last Seen: </b>n/a"
hive = append(hive, status)
}
case 2:
if len(s[0]) > 0 && len(s[1]) > 0 {
status := _na + " <b>Member: </b> " + s[0] + " <b>Version: </b>n/a <b>Last Seen: </b>n/a <b>AssetTag: </b>" + s[1] + "<br>"
status := _na + " <b>Member: </b> " + s[0] + " <b>Version: </b>n/a <b>Last Seen: </b>n/a </td><td><b>Tag: </b>" + s[1]
hive = append(hive, status)
}
default:
status := _na + " <b>configuration error, please fix configuration line: </b> " + server
hive = append(hive, status)
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions status.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@ func setOPNStatus(config *OPNCall, server, tag string, id int, ts time.Time, not
linkCurrent := "<a href=\"./files/" + server + "/current.xml\"" + _nwin + "><button><b>[current.xml]</b></button></a>"
linkArchive := "<a href=\"./files/" + server + "/" + archive + "\" " + _nwin + "><button><b>[archive]</b></button></a>"
links := " " + linkCurrent + " " + linkArchive
tags := ""
if tag != "" {
tags = " <button><b>[" + tag + "]</b></button>"
tag = " </td><td><b>" + tag + "</b>"
}
status := state + _b + linkUI + _b + linkVS + " <button><b>Last Seen:" + seen + "</b></button>" + tags + links + "<br>"
status := state + _b + linkUI + _b + linkVS + " <button><b>Last Seen:" + seen + "</b></button>" + links + tag
hiveMutex.Lock()
hive[id] = status
hiveMutex.Unlock()
Expand Down

0 comments on commit 3a4cf89

Please sign in to comment.