{"id":1118,"date":"2018-10-01T13:19:04","date_gmt":"2018-10-01T10:19:04","guid":{"rendered":"https:\/\/helia.ee\/koolitus\/?page_id=1118"},"modified":"2018-10-01T13:19:04","modified_gmt":"2018-10-01T10:19:04","slug":"nagios-4-debiani-serverile","status":"publish","type":"page","link":"https:\/\/helia.ee\/koolitus\/?page_id=1118","title":{"rendered":"Nagios 4 &#8211; Debian`i serverile"},"content":{"rendered":"<p class=\"subsection-title\">Debian | Raspbian<\/p>\n<p>All steps on Debian require to run as root. To become root simply run:<\/p>\n<p>Debian:<\/p>\n<pre>su<\/pre>\n<p>&nbsp;<\/p>\n<p>Raspbian:<\/p>\n<pre>sudo -i<\/pre>\n<p>&nbsp;<\/p>\n<p>All commands from this point onwards will be as root.<\/p>\n<p>&nbsp;<\/p>\n<h3>Security-Enhanced\u00a0<dfn class=\"thesaurus\">Linux<\/dfn><\/h3>\n<p>This guide is based on SELinux being disabled or in permissive mode. SELinux is not enabled by default on Debian. If you would like to see if it is installed run the following command:<\/p>\n<pre>dpkg -l selinux*\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h3>Prerequisites<\/h3>\n<p>Perform these steps to install the pre-requisite packages.<\/p>\n<p>===== 7.x \/ 8.x =====<\/p>\n<pre>apt-get update\r\napt-get install -y autoconf gcc libc6 make wget unzip apache2 apache2-utils php5 libgd2-xpm-dev\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>===== 9.x =====<\/p>\n<pre>apt-get update\r\napt-get install -y autoconf gcc libc6 make wget unzip apache2 apache2-utils php libgd-dev\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h3>Downloading the\u00a0<dfn class=\"thesaurus\">Source<\/dfn><\/h3>\n<pre>cd \/tmp\r\nwget -O nagioscore.tar.gz https:\/\/github.com\/NagiosEnterprises\/nagioscore\/archive\/nagios-4.4.1.tar.gz\r\ntar xzf nagioscore.tar.gz\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h3>Compile<\/h3>\n<pre>cd \/tmp\/nagioscore-nagios-4.4.1\/\r\n.\/configure --with-httpd-conf=\/etc\/apache2\/sites-enabled\r\nmake all<\/pre>\n<p>&nbsp;<\/p>\n<h3>Create User And Group<\/h3>\n<p>This creates the\u00a0nagios\u00a0user and group. The\u00a0www-data\u00a0user is also added to the\u00a0nagios\u00a0group.<\/p>\n<pre>make install-groups-users\r\nusermod -a -G nagios www-data\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h3>Install Binaries<\/h3>\n<p>This step installs the binary files, CGIs, and HTML files.<\/p>\n<pre>make install\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h3>Install Service \/ Daemon<\/h3>\n<p>This installs the service or daemon files and also configures them to start on boot.<\/p>\n<pre>make install-daemoninit\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Information on starting and stopping services will be explained further on.<\/p>\n<p>&nbsp;<\/p>\n<h3>Install Command Mode<\/h3>\n<p>This installs and configures the external command file.<\/p>\n<pre>make install-commandmode\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h3>Install Configuration Files<\/h3>\n<p>This installs the *SAMPLE* configuration files. These are required as Nagios needs some configuration files to allow it to start.<\/p>\n<pre>make install-config\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h3>Install\u00a0<dfn class=\"thesaurus\">Apache<\/dfn>\u00a0Config Files<\/h3>\n<p>This installs the\u00a0<dfn class=\"thesaurus\">Apache<\/dfn>\u00a0web\u00a0<dfn class=\"thesaurus\">server<\/dfn>\u00a0configuration files and configures the\u00a0<dfn class=\"thesaurus\">Apache<\/dfn>\u00a0settings.<\/p>\n<pre>make install-webconf\r\na2enmod rewrite\r\na2enmod cgi\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h3>Configure\u00a0<dfn class=\"thesaurus\">Firewall<\/dfn><\/h3>\n<p>You need to allow\u00a0<dfn class=\"thesaurus\">port<\/dfn>\u00a080 inbound traffic on the local\u00a0<dfn class=\"thesaurus\">firewall<\/dfn>\u00a0so you can reach the Nagios Core web interface.<\/p>\n<pre>iptables -I INPUT -p tcp --destination-port 80 -j ACCEPT\r\napt-get install -y iptables-persistent\r\n<\/pre>\n<p>Answer yes to saving existing rules<\/p>\n<p>&nbsp;<\/p>\n<h3>Create nagiosadmin User Account<\/h3>\n<p>You&#8217;ll need to create an\u00a0<dfn class=\"thesaurus\">Apache<\/dfn>\u00a0user account to be able to log into Nagios.<\/p>\n<p>The following command will create a user account called nagiosadmin and you will be prompted to provide a password for the account.<\/p>\n<pre>htpasswd -c \/usr\/local\/nagios\/etc\/htpasswd.users nagiosadmin\r\n<\/pre>\n<p>&nbsp;<\/p>\n<div class=\"note-tpl\">\n<p class=\"note-tpl-content\">When adding additional users in the future, you need to remove\u00a0<strong>-c<\/strong>\u00a0from the above command otherwise it will replace the existing nagiosadmin user\u00a0<em>(and any other users you may have added)<\/em>.<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<h3>Start\u00a0<dfn class=\"thesaurus\">Apache<\/dfn>\u00a0Web\u00a0<dfn class=\"thesaurus\">Server<\/dfn><\/h3>\n<p>===== 7.x =====<\/p>\n<p>Need to restart it because it is already running.<\/p>\n<pre>service apache2 restart\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>===== 8.x \/ 9.x =====<\/p>\n<p>Need to restart it because it is already running.<\/p>\n<pre>systemctl restart apache2.service\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h3>Start Service \/ Daemon<\/h3>\n<p>This command starts Nagios Core.<\/p>\n<p>===== 7.x =====<\/p>\n<pre>service nagios start\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>===== 8.x \/ 9.x =====<\/p>\n<pre>systemctl start nagios.service\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h3>Test Nagios<\/h3>\n<p>Nagios is now running, to confirm this you need to log into the Nagios Web Interface.<\/p>\n<p>Point your web browser to the\u00a0<dfn class=\"thesaurus\">ip address<\/dfn>\u00a0or FQDN of your Nagios Core\u00a0<dfn class=\"thesaurus\">server<\/dfn>, for example:<\/p>\n<p>http:\/\/10.25.5.143\/nagios<\/p>\n<p>http:\/\/core-013.domain.local\/nagios<\/p>\n<p>You will be prompted for a username and password. The username is\u00a0nagiosadmin\u00a0(you created it in a previous step) and the password is what you provided earlier.<\/p>\n<p>Once you have logged in you are presented with the Nagios interface. Congratulations you have installed Nagios Core.<\/p>\n<h3>BUT WAIT &#8230;<\/h3>\n<p>Currently you have only installed the Nagios Core engine. You&#8217;ll notice some errors under the hosts and services along the lines of:<\/p>\n<pre class=\"red-text\">(No output on stdout) stderr: execvp(\/usr\/local\/nagios\/libexec\/check_load, ...) failed. errno is 2: No such file or directory<\/pre>\n<p>These errors will be resolved once you install the Nagios Plugins, which is covered in the next step.<\/p>\n<p>&nbsp;<\/p>\n<h3>Installing The Nagios Plugins<\/h3>\n<p>Nagios Core needs plugins to operate properly. The following steps will walk you through installing Nagios Plugins.<\/p>\n<div class=\"note-tpl\">\n<p class=\"note-tpl-content\">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\u00a0<a title=\"Nagios Plugins Releases\" href=\"https:\/\/github.com\/nagios-plugins\/nagios-plugins\/releases\" target=\"_blank\" rel=\"noopener\">releases page on GitHub<\/a>\u00a0for all available versions.<\/p>\n<\/div>\n<p>Please note that the following steps install most of the plugins that come in the Nagios Plugins package.\u00a0However there are some plugins that require other libraries which are not included in those instructions.\u00a0Please refer to the following KB article for detailed installation instructions:<\/p>\n<p><a title=\"Installing Nagios Plugins From Source\" href=\"https:\/\/support.nagios.com\/kb\/article.php?id=569\" target=\"_blank\" rel=\"noopener\">Documentation &#8211; Installing Nagios Plugins From\u00a0<dfn class=\"thesaurus\">Source<\/dfn><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3>Prerequisites<\/h3>\n<p>Make sure that you have the following packages installed.<\/p>\n<pre>apt-get install -y autoconf gcc libc6 libmcrypt-dev make libssl-dev wget bc gawk dc build-essential snmp libnet-snmp-perl gettext\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h3>Downloading The\u00a0<dfn class=\"thesaurus\">Source<\/dfn><\/h3>\n<pre>cd \/tmp\r\nwget --no-check-certificate -O nagios-plugins.tar.gz https:\/\/github.com\/nagios-plugins\/nagios-plugins\/archive\/release-2.2.1.tar.gz\r\ntar zxf nagios-plugins.tar.gz<\/pre>\n<p>&nbsp;<\/p>\n<h3>Compile + Install<\/h3>\n<pre>cd \/tmp\/nagios-plugins-release-2.2.1\/\r\n.\/tools\/setup\r\n.\/configure\r\nmake\r\nmake install<\/pre>\n<p>&nbsp;<\/p>\n<h3>Test Plugins<\/h3>\n<p>Point your web browser to the\u00a0<dfn class=\"thesaurus\">ip address<\/dfn>\u00a0or FQDN of your Nagios Core\u00a0<dfn class=\"thesaurus\">server<\/dfn>, for example:<\/p>\n<p>http:\/\/10.25.5.143\/nagios<\/p>\n<p>http:\/\/core-013.domain.local\/nagios<\/p>\n<p>Go to a host or service object and &#8220;Re-schedule the next check&#8221; under the Commands menu. The error you previously saw should now disappear and the correct output will be shown on the screen.<\/p>\n<p>&nbsp;<\/p>\n<h3>Service \/ Daemon Commands<\/h3>\n<p>Different\u00a0<dfn class=\"thesaurus\">Linux<\/dfn>\u00a0distributions have different methods of starting \/ stopping \/ restarting \/ status Nagios.<\/p>\n<p>===== 7.x =====<\/p>\n<pre>service nagios start\r\nservice nagios stop\r\nservice nagios restart\r\nservice nagios status\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>===== 8.x \/ 9.x =====<\/p>\n<pre>systemctl start nagios.service\r\nsystemctl stop nagios.service\r\nsystemctl restart nagios.service\r\nsystemctl status nagios.service<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Debian | Raspbian All steps on Debian require to run as root. To become root simply run: Debian: su &nbsp; Raspbian: sudo -i &nbsp; All commands from this point onwards will be as root. &nbsp; Security-Enhanced\u00a0Linux This guide is based on SELinux being disabled or in permissive mode. SELinux is not enabled by default on [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":649,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"class_list":["post-1118","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/pages\/1118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1118"}],"version-history":[{"count":1,"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/pages\/1118\/revisions"}],"predecessor-version":[{"id":1121,"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/pages\/1118\/revisions\/1121"}],"up":[{"embeddable":true,"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/pages\/649"}],"wp:attachment":[{"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}