centos 7 | OCS inventory linux agent安装 |Cannot establish communication : 500 Internal Server Error

如果出现下面的问题请参考官方server install 文档,是包的问题

Cannot establish communication : 500 Internal Server Error 

以下是原文:

  • 配置yum源
rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/epel-release-latest-7.noarch.rpm

  • 安装依赖包
yum install -y perl-XML-Simple perl-Compress-Zlib perl-Net-IP perl-Net-SSLeay perl-Crypt-SSLeay perl-XML-SAX perl-XML-LibXML perl-ExtUtils-Embed perl-Net-Netmask perl-Proc-Daemon perl-Proc-PID-File uuid-perl

  • 创建目录
mkdir  /var/log/ocs-agent
 
mkdir  /var/tiger
  • 下载客户端并安装
wget https://github.com/OCSInventory-NG/UnixAgent/releases/download/v2.6.0/Ocsinventory-Unix-Agent-2.6.0.tar.gz
 
tar xvf Ocsinventory-Unix-Agent-2.6.0.tar.gz
 
cd Ocsinventory-Unix-Agent-2.6.0/
  • 编译安装
perl Makefile.PL 
 
make
 
make install 

问题一:

perl Makefile.PL 后出现以下提示,尝试解决

Net::Netmask is strongly recommended since it's required to retrieve snmp information
Please install Proc::Daemon and Proc::PID::File if you want to use the daemon mode.
Nvidia::ml is recommended if you want to retrieve memory, speed, bios information for Nvidia cards.
Checking if your kit is complete...
Looks good
Warning: prerequisite Data::UUID 0 not found.
Writing Makefile for Ocsinventory::Unix::Agent

先解决第一个,Net::Netmask,找到相应包后安装。

yum search Net::Netmask

yum install perl-Net-Netmask

同样

yum search Proc::Daemon
yum install perl-Proc-Daemon.noarch

yum search perl-Proc-PID-File
yum install perl-Proc-PID-File.noarch

yum search data::uuid
yum install uuid-perl.x86_64

# 第一次尝试,安装后,依然显示Nvidia::ml is recommended,这里不要尝试
yum -y install perl-CPAN
perl -MCPAN -e shell
cpan[1]>  install nvidia::ml
cpan[2]>  exit

#这里这个包失败了,大家不要尝试。同上
cd ..
wget https://cpan.metacpan.org/authors/id/N/NV/NVBINDING/nvidia-ml-pl-4.304.2.tar.gz
tar xvf nvidia-ml-pl-4.304.2.tar.gz
cd nvidia-ml
perl Makefile.PL
make
make install
cd ..
cd Ocsinventory-Unix-Agent-2.6.0

(我已把上述包添加至前面的命令中,大家应该不会有这些错误)
最后一个包nvidia-ml-pl,在安装的时候有一些警告出现,不知道有没有影响。

重新编译安装

perl Makefile.PL 
 
make
 
make install 

提示下面的错误:

Launching OCS Inventory NG Unix Unified agent...
Use of uninitialized value $password in concatenation (.) or string at /usr/local/share/perl5/Ocsinventory/Agent/Network.pm line 52.
   -> Failed!

变量没有初始化?

尝试安装其他版本的agent

wget https://github.com/OCSInventory-NG/UnixAgent/releases/download/v2.4.2/Ocsinventory-Unix-Agent-2.4.2.tar.gz

tar xvf Ocsinventory-Unix-Agent-2.4.2.tar.gz

cd Ocsinventory-Unix-Agent-2.4.2

perl Makefile.PL

make

make install 

失败,没有错误提示。

最后尝试了下:
https://www.jianshu.com/p/990c92ecaf24

rpm -ivh https://rpm.ocsinventory-ng.org/ocsinventory-release-latest.el7.ocs.noarch.rpm

yum install ocsinventory-agent

# 修改配置文件
vi /etc/ocsinventory/ocsinventory-agent.cfg

并修改以下行:

server = http://your.ocs.server/ocsinventory
tag = “你的资产标签”

line local = / var / lib / ocsinventory-agent的行更改为basevardir = / var / lib / ocsinventory-agent。保存并关闭文件。

执行代理

/usr/sbin/ocsinventory-agent

创建crontab条目以在后台运行代理:

vi etc/crontab

00 10 * * * root /usr/sbin/ocsinventory-agent

但是我检测不到电脑。有好心人能够告诉我吗?

10.8
查看agent日志,发现缺少包
perl-LWP-Protocol-https

yum search perl-LWP-Protocol-https

yum install perl-LWP-Protocol-https
/usr/sbin/ocsinventory-agent

查看日志

[Tue Oct  8 21:49:56 2019][error] Cannot establish communication : 500 Internal Server Error

服务器的问题,检查数据库用户登陆。

发布了134 篇原创文章 · 获赞 57 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/stone_fall/article/details/102244641