在运行Opsview的REST API时,如何在此服务器上找不到请求的URL / rest?

我使用本指南安装了Opsview。 问题是REST API不起作用。

执行:

/usr/local/nagios/bin/opsview_rest --username=admin \ --password=password GET config/host 

结果是:

 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL /rest was not found on this server.</p> <hr> <address>Apache/2.2.15 (CentOS) Server at localhost Port 80</address> </body></html> Goto undefined subroutine &Carp::shortmess_real at /usr/share/perl5/Carp.pm line 41. 

我认为这个问题是由一些Apache设置引起的。

在文档中没有提到这一点,但REST API应该始终指向Opsview的实际Web端口。

通过在/ usr / local / nagios / bin / opsview_rest中将 Opsview的默认Web端口添加到localhost:3000来更改localhost ,解决了问题。