zj2092 发表于 2019-1-13 12:30:30

Nagios 多用户管理

  

  一、nagios除了管理员用户登录来管理往往是不够的,我们公司有广东、江西、北京等地的业务,甚至内部人员也需要来查看(只读)监控的项目或者告警信息。
  

  So...
  

  二、先备份我们需要修改的两个文件
  #cp /etc/nagios/htpasswd.users /etc/nagios/htpasswd.users.20150126bak
  #cp /etc/nagios/cgi.cfg /etc/nagios/cgi.cfg.20150126bak
  

  三、创建用户,创建用户的时候不要加-c,否则会覆盖该文件原有数据,xh是用户名。输入密码确定即可
  #htpasswd/etc/nagios/htpasswd.users xh
  New password:
  Re-type new password:
  Updating password for user xh
  

  查看文件,创建用户成功,没有覆盖之前的用户
  # cat htpasswd.users
  nagiosadmin:TxLl3Z4Hu/rgM
  jxoperator:StFLcNbUYm8JQ
  bjoperator:mIIZ6TKa85iyo
  xh:HyPcV1ozVpCNg
  

  四、赋予权限,只读。经过测试,修改下面5行即可
  #vi /etc/nagios/cgi.cfg
  

  authorized_for_read_only=jxoperator,bjoperator,xh
  

  authorized_for_all_services=nagiosadmin,xh
  authorized_for_all_hosts=nagiosadmin,xh
  

  authorized_for_all_service_commands=nagiosadmin,xh
  authorized_for_all_host_commands=nagiosadmin,xh
  

  五、重启服务,使配置生效
  /etc/init.d/httpd restart
  /etc/init.d/nagios restart
  




页: [1]
查看完整版本: Nagios 多用户管理