centos – 无法启动nagios.service:单元nagios.service无法加载:没有这样的文件或目录

前端之家收集整理的这篇文章主要介绍了centos – 无法启动nagios.service:单元nagios.service无法加载:没有这样的文件或目录前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我一直关注 this tutorial
  1. $sudo systemctl start nagios
  2. Failed to start nagios.service: Unit nagios.service Failed to load: No such file or directory.

问题的原因是什么?

我有:

  1. $sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
  2.  
  3. Nagios Core 4.0.8
  4. Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
  5. Copyright (c) 1999-2009 Ethan Galstad
  6. Last Modified: 08-12-2014
  7. License: GPL
  8.  
  9. Website: http://www.nagios.org
  10. Reading configuration data...
  11. Read main config file okay...
  12. Read object config files okay...
  13.  
  14. Running pre-flight check on configuration data...
  15.  
  16. Checking objects...
  17. Checked 8 services.
  18. Checked 1 hosts.
  19. Checked 1 host groups.
  20. Checked 0 service groups.
  21. Checked 1 contacts.
  22. Checked 1 contact groups.
  23. Checked 24 commands.
  24. Checked 5 time periods.
  25. Checked 0 host escalations.
  26. Checked 0 service escalations.
  27. Checking for circular paths...
  28. Checked 1 hosts
  29. Checked 0 service dependencies
  30. Checked 0 host dependencies
  31. Checked 5 timeperiods
  32. Checking global event handlers...
  33. Checking obsessive compulsive processor commands...
  34. Checking misc settings...
  35.  
  36. Total Warnings: 0
  37. Total Errors: 0
  38.  
  39. Things look okay - No serIoUs problems were detected during the pre-flight check
我创建了这个文件
  1. sudo vi /etc/systemd/system/nagios.service

添加以下内容

  1. [Unit]
  2. Description=Nagios
  3. BindTo=network.target
  4.  
  5.  
  6. [Install]
  7. WantedBy=multi-user.target
  8.  
  9. [Service]
  10. User=nagios
  11. Group=nagios
  12. Type=simple
  13. ExecStart=/usr/local/nagios/bin/nagios /usr/local/nagios/etc/nagios.cfg

然后是以下内容

  1. sudo systemctl enable /etc/systemd/system/nagios.service
  2. sudo systemctl start nagios
  3. sudo systemctl restart nagios

猜你在找的CentOS相关文章