refactor: 重构 zabbix 功能到集成模块中
This commit is contained in:
24
integration/zabbixagent/gin_handler.go
Normal file
24
integration/zabbixagent/gin_handler.go
Normal file
@ -0,0 +1,24 @@
|
||||
package zabbixagent
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"onvif-agent/router/handler/onvif"
|
||||
)
|
||||
|
||||
func ONVIFDeviceDiscovery(c *gin.Context) {
|
||||
type ZBXDevice struct {
|
||||
Xaddr string `json:"{#XADDR}"`
|
||||
}
|
||||
|
||||
arr := make([]ZBXDevice, 0)
|
||||
for xaddr := range onvif.Conns {
|
||||
arr = append(arr, ZBXDevice{
|
||||
Xaddr: xaddr,
|
||||
})
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"data": arr,
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user