PUT /devices

Contents[Hide]

Permite modificar la definición de los dispositivos dados de alta.

 

 

PUT /devices.json Actualiza los campos especificados.
PUT /devices.json/12.json Actualiza los campos especificados del dispositivo con id=12
PUT /devices.json/192.168.1.1.json Actualiza los campos especificados del dispositivo con ip=192.168.1.1

 

El dispositivo se debe identificar mediante:

  • Su id.

  • Su dirección IP.

 

1. Campos modificables

 

NombreTipoValores posiblesDescripción
name Texto Cualquiera Nombre del dispositivo
domain Texto Cualquiera Dominio del dispositivo
ip Texto Cualquiera Dirección IP del dispositivo
type Texto Cualquiera Tipo del dispositivo (definido por el usuario)
snmpversion Entero 0:sin SNMP | 1:version 1 | 2:version 2 | 3:version 3 Versión SNMP del dispositivo
snmpcommunity Texto Cualquiera Comunidad SNMP (solo para snmpversion 1 o 2)
geo Texto Cualquiera Geolocalizacion en formato Google Maps
critic Entero 25: baja | 50: media | 75: alta | 100: máxima Criticidad
correlated Entero Cualquiera Id del dispositivo del que depende
status Entero 0:activo | 1:inactivo | 2:mantenimiento Estado del dispositivo
profile Texto Cualquiera Perfil al que pertenece el dispositivo
Campos de usuario Texto Cualquiera Campo de usuario definido por el usuario

 


2. Códigos de respuesta

 

CódigoDescripción
200 Resultado correcto
400 Error en la petición.
401 Error de autenticación.
403 Error por falta de permisos.
500 Error interno del servidor

 

3. Valor devuelto

Devuelve un vector de datos indicando el código de respuesta de la operación y el id del dispositivo modificado.

4. Ejemplos

 

root@cnm:/tmp# curl -ki "https://localhost/onm/api/1.0/auth/token.json?u=admin&p=cnm123"
HTTP/1.1 200 OK
Date: Fri, 19 Sep 2014 12:18:13 GMT
Server: Apache/2.2.16 (Debian) PHP/5.3.3-7 with Suhosin-Patch proxy_html/3.0.1 mod_ssl/2.2.16 OpenSSL/0.9.8o mod_perl/2.0.4 Perl/v5.10.1
X-Powered-By: PHP/5.3.3-7
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
:
Vary: Accept-Encoding
Content-Length: 59
Content-Type: text/html; charset=utf-8

{"status":0,"sessionid":"54612852362cb699d9a590bcda7b8011","expires_in":180}

root@cnm:/tmp# curl -ki -g -H "Authorization:54612852362cb699d9a590bcda7b8011" -X GET "https://localhost/onm/api/1.0/devices.json?cnm_page_size=1&cnm_sort=-id"
HTTP/1.1 200 OK
Date: Fri, 19 Sep 2014 12:18:18 GMT
Server: Apache/2.2.16 (Debian) PHP/5.3.3-7 with Suhosin-Patch proxy_html/3.0.1 mod_ssl/2.2.16 OpenSSL/0.9.8o mod_perl/2.0.4 Perl/v5.10.1
X-Powered-By: PHP/5.3.3-7
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
:
Vary: Accept-Encoding
Content-Length: 1008
Content-Type: text/html; charset=utf-8

[{"id":"1","profile":"Global","name":"cnm-devel","snmpsyslocation":"\"CPD (edit \/etc\/snmp\/snmpd.conf)\"","switch":"0","snmpsysclass":".1.3.6.1.4.1.8072.3.2.10","critic":"75","domain":"s30labsi.com","ip":"10.2.254.222","type":"Servidor Linux","xagentversion":"-","status":"0","snmpsysoid":".1.3.6.1.4.1.8072.3.2.10","network":"10.2.254.0\/24","snmpsysdesc":"\"Linux cnm-devel 2.6.32-5-amd64 #1 SMP Wed Jan 12 03:40:32 UTC 2011 x86_64\"","geo":"40.32793,-3.83450","correlated":"0","snmpcommunity":"public","snmpversion":"2","entity":"0","sysloc":"\"CPD (edit \/etc\/snmp\/snmpd.conf)\"","mac":"c6:8a:28:d0:8d:30","macvendor":"","yellowalerts":"0","orangealerts":"0","redalerts":"0","bluealerts":"0","metrics":"6","Acceso":"https:\/\/10.2.254.222\nhttps:\/\/10.2.254.222\/onm\/mob","Acceso (credenciales)":"admin\/cnm123","Descripcion":"Equipo principal de desarrollo de CNM","Fabricante":"S30Labs","Grupo":"Monitorizaci\u00f3n","Link":"-","Proveedor":"S30Labs","Responsable interno":"SSV","Tipo":"Virtual"}]

root@cnm:/tmp# curl -ki -H "Authorization: 54612852362cb699d9a590bcda7b8011" -X PUT "https://localhost/onm/api/1.0/devices/1.json" -d "critic=100" -d "form[Responsable interno]=FML"
HTTP/1.1 200 OK
Date: Fri, 19 Sep 2014 12:18:32 GMT
Server: Apache/2.2.16 (Debian) PHP/5.3.3-7 with Suhosin-Patch proxy_html/3.0.1 mod_ssl/2.2.16 OpenSSL/0.9.8o mod_perl/2.0.4 Perl/v5.10.1
X-Powered-By: PHP/5.3.3-7
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
:
Vary: Accept-Encoding
Content-Length: 28
Content-Type: text/html; charset=utf-8

{"rc":0,"rcstr":"","id":"1"}

root@cnm:/tmp# curl -ki -g -H "Authorization:54612852362cb699d9a590bcda7b8011" -X GET "https://localhost/onm/api/1.0/devices.json?cnm_page_size=1&cnm_sort=-id"
HTTP/1.1 200 OK
Date: Fri, 19 Sep 2014 12:18:42 GMT
Server: Apache/2.2.16 (Debian) PHP/5.3.3-7 with Suhosin-Patch proxy_html/3.0.1 mod_ssl/2.2.16 OpenSSL/0.9.8o mod_perl/2.0.4 Perl/v5.10.1
X-Powered-By: PHP/5.3.3-7
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
:
Vary: Accept-Encoding
Content-Length: 1008
Content-Type: text/html; charset=utf-8

[{"id":"1","profile":"Global","name":"cnm-devel","snmpsyslocation":"\"CPD (edit \/etc\/snmp\/snmpd.conf)\"","switch":"0","snmpsysclass":".1.3.6.1.4.1.8072.3.2.10","critic":"100","domain":"s30labsi.com","ip":"10.2.254.222","type":"Servidor Linux","xagentversion":"-","status":"0","snmpsysoid":".1.3.6.1.4.1.8072.3.2.10","network":"10.2.254.0\/24","snmpsysdesc":"\"Linux cnm-devel 2.6.32-5-amd64 #1 SMP Wed Jan 12 03:40:32 UTC 2011 x86_64\"","geo":"40.32793,-3.83450","correlated":"0","snmpcommunity":"public","snmpversion":"2","entity":"0","sysloc":"\"CPD (edit \/etc\/snmp\/snmpd.conf)\"","mac":"c6:8a:28:d0:8d:30","macvendor":"","yellowalerts":"0","orangealerts":"0","redalerts":"0","bluealerts":"0","metrics":"6","Acceso":"https:\/\/10.2.254.222\nhttps:\/\/10.2.254.222\/onm\/mob","Acceso (credenciales)":"admin\/cnm123","Descripcion":"Equipo principal de desarrollo de CNM","Fabricante":"S30Labs","Grupo":"Monitorizaci\u00f3n","Link":"-","Proveedor":"S30Labs","Responsable interno":"FML","Tipo":"Virtual"}]

 

 

 

 

 

Más en esta categoría: « POST /events POST /devices »

Iniciar sesión

Back to Top