update
This commit is contained in:
1 parent
0690285147
commit
5618cd2738
154 files changed
+5021
-3161
No files matched your search
+12
-12
@@ -50,16 +50,16 @@ func (h *SNMPHandler) ListDevices(c *gin.Context) {
|
||||
// POST /api/v1/snmp/devices
|
||||
func (h *SNMPHandler) CreateDevice(c *gin.Context) {
|
||||
var req struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
IP string `json:"ip" binding:"required"`
|
||||
Port int `json:"port"`
|
||||
SnmpVersion string `json:"snmp_version"`
|
||||
Version string `json:"version"`
|
||||
Community string `json:"community"`
|
||||
TemplateID uint `json:"template_id"`
|
||||
DeviceType string `json:"device_type"`
|
||||
Vendor string `json:"vendor"`
|
||||
Description string `json:"description"`
|
||||
Name string `json:"name" binding:"required"`
|
||||
IP string `json:"ip" binding:"required"`
|
||||
Port int `json:"port"`
|
||||
SnmpVersion string `json:"snmp_version"`
|
||||
Version string `json:"version"`
|
||||
Community string `json:"community"`
|
||||
TemplateID uint `json:"template_id"`
|
||||
DeviceType string `json:"device_type"`
|
||||
Vendor string `json:"vendor"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, model.Response{Code: 400, Message: err.Error()})
|
||||
@@ -172,8 +172,8 @@ func (h *SNMPHandler) GetSNMPStats(c *gin.Context) {
|
||||
h.db.Model(&model.SNMPDevice{}).Where("status = ?", "online").Count(&online)
|
||||
|
||||
c.JSON(http.StatusOK, model.Response{Code: 200, Data: gin.H{
|
||||
"total": total,
|
||||
"online": online,
|
||||
"total": total,
|
||||
"online": online,
|
||||
"abnormal": total - online,
|
||||
}})
|
||||
}
|
||||
Reference in new issue
Block a user