设为首页 收藏本站
查看: 541|回复: 0

[经验分享] Ubuntu下nagios安装(来源官网)

[复制链接]

尚未签到

发表于 2017-11-19 15:39:43 | 显示全部楼层 |阅读模式
  Ubuntu下nagios安装(来源官网)
  https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/toc.html
  https://support.nagios.com/kb/article/nagios-core-installing-nagios-core-from-source.html#Ubuntu
  
Security-Enhanced Linux
  This guide is based on SELinux being disabled or in permissive mode. SELinux is not enabled by default on Ubuntu. If you would like to see if it is installed run the following command:
  sudo dpkg -l selinux*

  Prerequisites
  Perform these steps to install the pre-requisite packages.
  ===== Ubuntu 13.x / 14.x / 15.x =====
  sudo apt-get update
sudo apt-get install -y autoconf gcc libc6 make wget unzip apache2 apache2-utils php5 libgd2-xpm-dev

  ===== Ubuntu 16.x / 17.x =====
  sudo apt-get update
sudo apt-get install -y autoconf gcc libc6 make wget unzip apache2 php libapache2-mod-php7.0 libgd2-xpm-dev

  Downloading the Source
  cd /tmp
wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.3.4.tar.gz
tar xzf nagioscore.tar.gz

  Compile
  cd /tmp/nagioscore-nagios-4.3.4/
sudo ./configure --with-httpd-conf=/etc/apache2/sites-enabled
sudo make all

  Create User And Group
  This creates the nagios user and group. The www-data user is also added to the nagios group.
  sudo useradd nagios
sudo usermod -a -G nagios www-data

  Install Binaries
  This step installs the binary files, CGIs, and HTML files.
  sudo make install

  Install Service / Daemon
  This installs the service or daemon files and also configures them to start on boot.
  sudo make install-init
sudo update-rc.d nagios defaults

  Information on starting and stopping services will be explained further on.
  Install Command Mode
  This installs and configures the external command file.
  sudo make install-commandmode

  Install Configuration Files
  This installs the *SAMPLE* configuration files. These are required as Nagios needs some configuration files to allow it to start.
  sudo make install-config

  Install Apache Config Files
  This installs the Apache web server configuration files and configures Apache settings.
  sudo make install-webconf
sudo a2enmod rewrite
sudo a2enmod cgi

  Configure Firewall
  You need to allow port 80 inbound traffic on the local firewall so you can reach the Nagios Core web interface.
  sudo ufw allow Apache
sudo ufw reload

  Create nagiosadmin User Account
  You'll need to create an Apache user account to be able to log into Nagios.
  The following command will create a user account called nagiosadmin and you will be prompted to provide a password for the account.
  sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

  When adding additional users in the future, you need to remove -c from the above command otherwise it will replace the existing nagiosadmin user (and any other users you may have added).
  Start Apache Web Server
  ===== Ubuntu 13.x / 14.x =====
  Need to restart it because it is already running.
  sudo service apache2 restart

  ===== Ubuntu 15.x / 16.x / 17.x =====
  Need to restart it because it is already running.
  sudo systemctl restart apache2.service

  Start Service / Daemon
  This command starts Nagios Core.
  ===== Ubuntu 13.x / 14.x =====
  sudo service nagios start

  ===== Ubuntu 15.x / 16.x / 17.x =====
  sudo systemctl start nagios.service

  Test Nagios
  Nagios is now running, to confirm this you need to log into the Nagios Web Interface.
  Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
  http://10.25.5.143/nagios
  http://core-013.domain.local/nagios
  You will be prompted for a username and password. The username is nagiosadmin (you created it in a previous step) and the password is what you provided earlier.
  Once you have logged in you are presented with the Nagios interface. Congratulations you have installed Nagios Core.
  BUT WAIT ...
  Currently you have only installed the Nagios Core engine. You'll notice some errors under the hosts and services along the lines of:
  (No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_load, ...) failed. errno is 2: No such file or directory
These errors will be resolved once you install the Nagios Plugins, which is covered in the next step.
  Installing The Nagios Plugins
  Nagios Core needs plugins to operate properly. The following steps will walk you through installing Nagios Plugins.
  These steps install nagios-plugins 2.2.1. Newer versions will become available in the future and you can use those in the following installation steps. Please see the releases page on GitHub for all available versions.
  Please note that the following steps install most of the plugins that come in the Nagios Plugins package. However there are some plugins that require other libraries which are not included in those instructions. Please refer to the following KB article for detailed installation instructions:
  Documentation - Installing Nagios Plugins From Source
  Prerequisites
  Make sure that you have the following packages installed.
  sudo apt-get install -y autoconf gcc libc6 libmcrypt-dev make libssl-dev wget bc gawk dc build-essential snmp libnet-snmp-perl gettext

  Downloading The Source
  cd /tmp
wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugins/nagios-plugins/archive/release-2.2.1.tar.gz
tar zxf nagios-plugins.tar.gz

  Compile + Install
  cd /tmp/nagios-plugins-release-2.2.1/
sudo ./tools/setup
sudo ./configure
sudo make
sudo make install

  Test Plugins
  Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
  http://10.25.5.143/nagios
  http://core-013.domain.local/nagios
  Go to a host or service object and "Re-schedule the next check" under the Commands menu. The error you previously saw should now disappear and the correct output will be shown on the screen.
  Service / Daemon Commands
  Different Linux distributions have different methods of starting / stopping / restarting / status Nagios.
  ===== Ubuntu 13.x / 14.x =====
  sudo service nagios start
sudo service nagios stop
sudo service nagios restart
sudo service nagios status

  ===== Ubuntu 15.x / 16.x / 17.x =====
  sudo systemctl start nagios.service
sudo systemctl stop nagios.service
sudo systemctl restart nagios.service
sudo systemctl status nagios.service

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-408570-1-1.html 上篇帖子: Windows10 1709正式版WSL安装(以Ubuntu为例) 下篇帖子: ubuntu 16.04 php5 环境搭建
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表