Softlayer中添加监视器的鉴权方法异常
Authentication method exception for adding a monitor in Softlayer
我正在使用 Softlayer java 客户端实现添加监视器。
一旦执行 creatObject(),它 returns 验证错误。请检查下面我的示例代码,如果您发现任何疑问,请告诉我。
我的用户id是超级用户(IBMxxxxx),没有设置权限。
错误:com.softlayer.api.ApiException$内部:无法创建类型为 SoftLayer_Network_Monitor_Version1_Query_Host 的新对象。确保身份验证方法正确。(代码:SoftLayer_Exception,状态:500)
private void AddMonitoringInfo() {
Long hardwareId = new Long(848429);
// Define Ip Address
String ipAddress = "173.192.36.250";
// Define Query Type (1 = SERVICE PING, 17 = SLOW PING)
Long queryTypeId = new Long(1);
// Define Response action id (1 = Do Nothing, 2 = Notify Users)
Long responseActionId = new Long(2);
// Define waitCycles 0 = Immediately, 1 = 5 Minutes, 2 = 10 Minutes, etc
Long waitCycles = new Long(1);
// Define SoftLayer_Network_Monitor_Version1_Query_Host service
Host.Service hostService = Host.service(client);
// Build a SoftLayer_Network_Monitor_Version1_Query_Host object that you
// wish to create
Host templateObject = new Host();
templateObject.setHardwareId(hardwareId);
templateObject.setIpAddress(ipAddress);
templateObject.setQueryTypeId(queryTypeId);
templateObject.setResponseActionId(responseActionId);
templateObject.setWaitCycles(waitCycles);
try {
Host result = hostService.createObject(templateObject);
Gson gson = new Gson();
System.out.println("Result : " + gson.toJson(result));
} catch (Exception e) {
System.out.println("Error: " + e);
}
}
您遇到的问题与权限有关。
请检查您尝试创建监视器的用户是否启用了管理设备监视权限。
我正在使用 Softlayer java 客户端实现添加监视器。 一旦执行 creatObject(),它 returns 验证错误。请检查下面我的示例代码,如果您发现任何疑问,请告诉我。 我的用户id是超级用户(IBMxxxxx),没有设置权限。
错误:com.softlayer.api.ApiException$内部:无法创建类型为 SoftLayer_Network_Monitor_Version1_Query_Host 的新对象。确保身份验证方法正确。(代码:SoftLayer_Exception,状态:500)
private void AddMonitoringInfo() {
Long hardwareId = new Long(848429);
// Define Ip Address
String ipAddress = "173.192.36.250";
// Define Query Type (1 = SERVICE PING, 17 = SLOW PING)
Long queryTypeId = new Long(1);
// Define Response action id (1 = Do Nothing, 2 = Notify Users)
Long responseActionId = new Long(2);
// Define waitCycles 0 = Immediately, 1 = 5 Minutes, 2 = 10 Minutes, etc
Long waitCycles = new Long(1);
// Define SoftLayer_Network_Monitor_Version1_Query_Host service
Host.Service hostService = Host.service(client);
// Build a SoftLayer_Network_Monitor_Version1_Query_Host object that you
// wish to create
Host templateObject = new Host();
templateObject.setHardwareId(hardwareId);
templateObject.setIpAddress(ipAddress);
templateObject.setQueryTypeId(queryTypeId);
templateObject.setResponseActionId(responseActionId);
templateObject.setWaitCycles(waitCycles);
try {
Host result = hostService.createObject(templateObject);
Gson gson = new Gson();
System.out.println("Result : " + gson.toJson(result));
} catch (Exception e) {
System.out.println("Error: " + e);
}
}
您遇到的问题与权限有关。
请检查您尝试创建监视器的用户是否启用了管理设备监视权限。