Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用adminset_agent.py报错 #20

Closed
keithkuk opened this issue Aug 23, 2017 · 6 comments
Closed

使用adminset_agent.py报错 #20

keithkuk opened this issue Aug 23, 2017 · 6 comments

Comments

@keithkuk
Copy link

keithkuk commented Aug 23, 2017

客户端用docker容器运行

容器内系统是 CentOS Linux release 7.3.1611 (Core)

在adminset_agent.py上修改了 server_ip = '172.17.0.7' 此为容器ip
token 这个是根据服务端上的token进行修改的吗?

运行adminset_agent.py后报错:

Traceback (most recent call last):
File "adminset_agent.py", line 303, in
asset_info_post()
File "adminset_agent.py", line 176, in asset_info_post
osenv = os.environ["LANG"]
File "/usr/lib64/python2.7/UserDict.py", line 23, in getitem
raise KeyError(key)
KeyError: 'LANG'

请问如何解决?

@guohongze
Copy link
Owner

token 是根据在服务器上配置管理页面中的token来进行设置的。
这个报错是获取环境变量中的字符集设置出的错误,应该是docker中没有这个环境变量。
如果这个报错,可以把adminset_agent.py 中的176、177、182注释掉。
这三行的作用是将环境变量修改为en_US.utf-8的字符集,为了脚本抓取磁盘信息不出错,然后再改回来。

@keithkuk
Copy link
Author

@guohongze 谢谢你的答复,再问一个问题。
服务端是用docker部署 只有容器内的ip 如果要监控其他物理机 是否直接写宿主ip地址即可 还是要额外开放容器内端口映射到宿主机上?

@guohongze
Copy link
Owner

服务端在docker上,只需要做端口映射即可,宿主机随便开一个端口映射到有adminset server的docker的80上,然后客户端通过这个映射的固定端口上报信息。

@keithkuk
Copy link
Author

keithkuk commented Aug 31, 2017

@guohongze 再请教一下 权限设置的问题 新建了账号并在平台监控这个模块设置了访问权限 如图:

image

登陆新建账号后不能查看该允许权限连接,查看访问日志报/accounts/permission/deny/ 如图:

image

是否还需要开启其他权限连接?

@guohongze
Copy link
Owner

权限模块的工作机制是这样的:
如果你允许用户访问一个URL,设定了以后是可以访问的比如你的允许的权限是
/monitor/system/test2/这个URL 那么使用http://192.168.47.130/monitor/system/test2/这个地址就可以直接访问,/monitor/system/test2/0/ 这个也可以访问,以及所有/monitor/system/test2/ 之后的URL都可以访问。
你在adminset平台界面进入的入口是 /monitor/system/ 但这个URL并不在你的允许之中,所以你在使用WEB界面点击 监控平台的时候显示会返回 deny。
如果你已经授权并绑定角色到账号上了,你在使用相应账号登入以后肯定可以使用全URL 如:http://192.168.47.130/monitor/system/test2/0/ 得到监控的返回结果的。

@keithkuk
Copy link
Author

keithkuk commented Sep 4, 2017

@guohongze 可能我解析的不太清楚 这样加是不行的 看日nginx日志,发现 /monitor/get/有这个动作,所以权限添加必须先把 /monitor/get/这个加上才能有权限访问。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants