0
웹 사이트를 통해 Nagios 서버에 연결하여 Nagios 서버의 호스트 상태를 표시하려고합니다.웹 사이트를 통해 Nagios Api에 연결하기
나는 curl 명령을 실행했으며 json 응답을 받았으며 작동합니다. 하지만 지금은 웹 애플 리케이션에 연결하려고하면 jQuery는 나에게 401 허락되지 않은 오류를 준다.
jquery-3.1.0.js:9392 GET http://41.87.218.55/nagios/cgi-bin/objectjson.cgi?query=hostlist&parenthost=none&childhost=none 401 (Unauthorized)
send @ jquery-3.1.0.js:9392
ajax @ jquery-3.1.0.js:8999
getData @ myJavaAng.js:187
(anonymous function) @ myJavaAng.js:203
내 코드 :
function getData() {
var name, code;
var serviceURL = "http://test:[email protected]/nagios/cgi-bin/objectjson.cgi?query=hostlist&parenthost=none&childhost=none";
$.support.cors = true;
$.ajax({
type: "GET",
dataType: "json",
crossDomain: true,
url: serviceURL,
success: function(data) {
alert(data);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log(errorThrown);
}
});
}
날 내가 잘못 뭘하는지 알려 주시기 바랍니다.