<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.itcollege.ee/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mhass</id>
	<title>ICO wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.itcollege.ee/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mhass"/>
	<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php/Special:Contributions/Mhass"/>
	<updated>2026-05-06T01:16:33Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116365</id>
		<title>Graylog&amp;Nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116365"/>
		<updated>2017-01-05T08:55:31Z</updated>

		<summary type="html">&lt;p&gt;Mhass: /* Nagios */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Logging and Monitoring - Graylog and Nagios installation.&lt;br /&gt;
&lt;br /&gt;
Group : Cyber Security Engineering (C21).&lt;br /&gt;
&lt;br /&gt;
Page created by Meelis Hass.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
In this page, I will show how a person can easily install and configure a good logging and monitoring solution into their systems and networks. My choices for this task are Graylog and Nagios.&lt;br /&gt;
&lt;br /&gt;
= Graylog =&lt;br /&gt;
&lt;br /&gt;
Graylog is currently one of the most popular open-source logging solution. It&#039;s plus sides, are that it is able to work with unstructured logs from anywhere, is free and open source and is easy to install.&amp;lt;ref&amp;gt; https://www.graylog.org/features&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now before we begin installing Graylog, we should check what version the machine is actully running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is because this guide is intended for 16.04 version of Ubuntu, If you do already have it, skip to actual installation. People who need to upgrade just continue with the following commands.&lt;br /&gt;
&lt;br /&gt;
Next lets upgrade our machine.&lt;br /&gt;
&lt;br /&gt;
*Start off by updating your package list&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Next lets upgrade everything&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then fix the dependencies with this&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get dist-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*And finish off by finishing the upgrade&lt;br /&gt;
&amp;lt;code&amp;gt; sudo do-release-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to the actual meat of the guide, installing graylog. But we cant just jump into installing Graylog itself, because it needs a few services and a setup base to run it, like Elasticsearch and MongoDB.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Starting off with the setup base.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apt-transport-https openjdk-8-jre-headless uuid-runtime pwgen &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now lets install MongoDB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install mongodb-server &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;Installing Elasticsearch takes a few more commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo &amp;quot;deb https://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install elasticsearch &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;We still need to configure Elasticsearch a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; nano /etc/elasticsearch/elasticsearch.yml &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncomment and change this line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cluster.name: graylog &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;After that, just start the service&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable elasticsearch.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl restart elasticsearch.service &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;Now we actully start installing Graylog itself! Start off by getting the required packages and then installing them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget https://packages.graylog2.org/repo/packages/graylog-2.1-repository_latest.deb &lt;br /&gt;
&lt;br /&gt;
sudo dpkg -i graylog-2.1-repository_latest.deb&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install graylog-server&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;After installing Graylog, we need to add a few extra parts into the configuration file, mainly passwords.&lt;br /&gt;
&lt;br /&gt;
This will generate a password and a sha256sum for it. Do note that the password is required and &#039;&#039;&#039;MUST&#039;&#039;&#039; be 16 characters or longer, otherwise Graylog refuses to function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo -n yourpassword | sha256sum &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The password must be put into &amp;lt;code&amp;gt; /etc/graylog/server/server.conf&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
While in the configuration file, also add your public ip with correct ports into &amp;lt;code&amp;gt; rest_listen_uri &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; web_listen_uri &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;Final steps to enable Graylog.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable graylog-server.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl start graylog-server.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there you have it, one fully installed Graylog, ready for all your logging needs!.&lt;br /&gt;
&lt;br /&gt;
After this, you can explore the web interface at the public ip address you set before and start logging whatever you want.&lt;br /&gt;
&lt;br /&gt;
= Nagios =&lt;br /&gt;
&lt;br /&gt;
Nagios is a free open source application that is used to monitor systems and networks. Nagios is able to alert users if things go wrong and when the problem is resolved. Nagios was created Ethen Galstad and a group of developers, and was initially released in March 14, 1999&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Nagios&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before installing Nagios, we need to once again check the version&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This guide is intended for 14.04 ubuntu servers, so if you are higher or lower, upgrade/downgrade appropriately. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installing Nagios is a easier said than done, because it needs alot of stuff in advanced, like a LAMP&amp;lt;ref&amp;gt;https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04&amp;lt;/ref&amp;gt; base.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Doing these commands will install Apache, MYSQL and PHP, which are needed for Nagios functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apache2&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install mysql-server php5-mysql&lt;br /&gt;
&lt;br /&gt;
sudo mysql_install_db&lt;br /&gt;
&lt;br /&gt;
sudo mysql_secure_installation&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache2 a bit, go into &amp;lt;code&amp;gt; /etc/apache2/mods-enabled/dir.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change this line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into this line by moving index.php ahead of index.html.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that just restart Apache service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service apache2 restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now we need to make a user and group who will be dealing with using Nagios.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo useradd nagios&lt;br /&gt;
&lt;br /&gt;
sudo groupadd nagcmd&lt;br /&gt;
&lt;br /&gt;
sudo usermod -a -G nagcmd nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;We can almost move to building the Nagios Core, but first we need a few dependencies.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install build-essential libgd2-xpm-dev openssl libssl-dev xinetd apache2-utils unzip&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;Now to finally install Nagios itself&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-4.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;Move to the newly created folder and type these commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-group=nagios --with-command-group=nagcmd&lt;br /&gt;
 &lt;br /&gt;
make all &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That final command compiled Nagios, but its not fully done just yet. We still need a few more things to install on it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-commandmode&lt;br /&gt;
&lt;br /&gt;
sudo make install-init&lt;br /&gt;
&lt;br /&gt;
sudo make install-config&lt;br /&gt;
&lt;br /&gt;
sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;To be able to issue external commands trough the web interface of Nagios, we need to add the web server user into the nagios group&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo usermod -G nagcmd www-data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;We will also need Nagios Plugins and NRPE, which are installed in the same fashion as Nagios Core&lt;br /&gt;
&lt;br /&gt;
Nagios Plugins:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-plugins-2.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NRPE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nrpe-2.15.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Building NRPE, needs its xinetd startup script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;make all&lt;br /&gt;
&lt;br /&gt;
sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-xinetd&lt;br /&gt;
&lt;br /&gt;
sudo make install-daemon-config&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;We also need to open up the xinetd script in &amp;lt;code&amp;gt;/etc/xinetd.d/nrpe&amp;lt;/code&amp;gt; and add the Nagios servers private/public address to the end of it.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;only_from = 127.0.0.1 192.168.56.200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After modifying the file, restart xinetd&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service xinetd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;9)&#039;&#039;&#039;Now Nagios is fully installed, but still needs more configuring.&lt;br /&gt;
&lt;br /&gt;
Lets start off by going into this file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/nagios.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncommenting this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#cfg_dir=/usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now create the directory that will store the configuration file for each server that you will monitor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;10)&#039;&#039;&#039;Lets also add a command to NRPE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/objects/commands.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the following to the end of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define command{&lt;br /&gt;
        command_name check_nrpe&lt;br /&gt;
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache aswell, so lets enable Apache rewrite and cgi modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
sudo a2enmod cgi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use htpasswd to create an admin user, called &amp;quot;nagiosadmin&amp;quot;, that will be used in getting access to the web interface.&lt;br /&gt;
Set a password when prompted by the command, this username and password will be the main login credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally lets make a symlink between the nagios configuration file and the Apache sites-enabled directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ln -s /etc/apache2/sites-available/nagios.conf /etc/apache2/sites-enabled/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;11)&#039;&#039;&#039;And thats it, Nagios is ready to be started up, just restart the service and add Nagios to start on server booting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios start&lt;br /&gt;
&lt;br /&gt;
sudo service apache2 restart&lt;br /&gt;
&lt;br /&gt;
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats all, now you have a fully (hopefully) working Nagios thanks to following these steps.&lt;br /&gt;
&lt;br /&gt;
You can access the webinterface by going here: &amp;lt;code&amp;gt;http://nagios_server_public_ip/nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;12)&#039;&#039;&#039;But lets not stop there, lets try adding something for Nagios to keep an eye on. To do this, lets swap over to another machine that is in the same network as the Nagios server.&lt;br /&gt;
&lt;br /&gt;
On this other machine, lets install NRPE, it will be needed to make Nagios work on the new machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install nagios-plugins nagios-nrpe-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once NRPE is installed, lets go into the configuration file once again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the nagios server ip to the end of the &amp;lt;code&amp;gt;allowed_hosts=127.0.0.1,&amp;lt;/code&amp;gt; segment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;13)&#039;&#039;&#039;As an example, lets monitor one of our filesystems.&lt;br /&gt;
&lt;br /&gt;
Lets look up the filesystems that we have.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;df -h /&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go back into the NRPE configuration file in &amp;lt;code&amp;gt;/etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt; and change these three lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;server_address=client_private_IP&lt;br /&gt;
allowed_hosts=nagios_server_private_IP (you already set this earlier)&lt;br /&gt;
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p (filesystem that you chose)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dont forget to restart the NRPE service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios-nrpe-server restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14)&#039;&#039;&#039;After all that is done, its time to head back to the machine with the actual Nagios server and the new Host into the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/servers/yourhost.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this file, you need to add this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define host {&lt;br /&gt;
        use                             linux-server&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        alias                           My first Apache server&lt;br /&gt;
        address                         10.132.234.52 (changeme)&lt;br /&gt;
        max_check_attempts              5&lt;br /&gt;
        check_period                    24x7&lt;br /&gt;
        notification_interval           30&lt;br /&gt;
        notification_period             24x7&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
define service {&lt;br /&gt;
        use                             generic-service&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        service_description             PING&lt;br /&gt;
        check_command                   check_ping!100.0,20%!500.0,60%&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always restart services after major changes!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And thats all folks! Now if you were to look at your Nagios web interface, you would be able to see the new host you just added, and also a service tied to said host.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Graylong and Nagios are rather easy to install, albeit a bit time consuming and confusing. But they are still very good services in regards to Logging and Monitoring things.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Sources =&lt;br /&gt;
&lt;br /&gt;
http://docs.graylog.org/en/2.1/pages/installation/os/ubuntu.html&lt;br /&gt;
&lt;br /&gt;
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04&lt;br /&gt;
&lt;br /&gt;
https://www.digitalocean.com/community/tutorials/how-to-install-nagios-4-and-monitor-your-servers-on-ubuntu-14-04#configure-nagios&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116364</id>
		<title>Graylog&amp;Nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116364"/>
		<updated>2017-01-05T08:52:42Z</updated>

		<summary type="html">&lt;p&gt;Mhass: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Logging and Monitoring - Graylog and Nagios installation.&lt;br /&gt;
&lt;br /&gt;
Group : Cyber Security Engineering (C21).&lt;br /&gt;
&lt;br /&gt;
Page created by Meelis Hass.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
In this page, I will show how a person can easily install and configure a good logging and monitoring solution into their systems and networks. My choices for this task are Graylog and Nagios.&lt;br /&gt;
&lt;br /&gt;
= Graylog =&lt;br /&gt;
&lt;br /&gt;
Graylog is currently one of the most popular open-source logging solution. It&#039;s plus sides, are that it is able to work with unstructured logs from anywhere, is free and open source and is easy to install.&amp;lt;ref&amp;gt; https://www.graylog.org/features&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now before we begin installing Graylog, we should check what version the machine is actully running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is because this guide is intended for 16.04 version of Ubuntu, If you do already have it, skip to actual installation. People who need to upgrade just continue with the following commands.&lt;br /&gt;
&lt;br /&gt;
Next lets upgrade our machine.&lt;br /&gt;
&lt;br /&gt;
*Start off by updating your package list&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Next lets upgrade everything&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then fix the dependencies with this&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get dist-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*And finish off by finishing the upgrade&lt;br /&gt;
&amp;lt;code&amp;gt; sudo do-release-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to the actual meat of the guide, installing graylog. But we cant just jump into installing Graylog itself, because it needs a few services and a setup base to run it, like Elasticsearch and MongoDB.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Starting off with the setup base.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apt-transport-https openjdk-8-jre-headless uuid-runtime pwgen &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now lets install MongoDB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install mongodb-server &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;Installing Elasticsearch takes a few more commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo &amp;quot;deb https://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install elasticsearch &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;We still need to configure Elasticsearch a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; nano /etc/elasticsearch/elasticsearch.yml &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncomment and change this line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cluster.name: graylog &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;After that, just start the service&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable elasticsearch.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl restart elasticsearch.service &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;Now we actully start installing Graylog itself! Start off by getting the required packages and then installing them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget https://packages.graylog2.org/repo/packages/graylog-2.1-repository_latest.deb &lt;br /&gt;
&lt;br /&gt;
sudo dpkg -i graylog-2.1-repository_latest.deb&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install graylog-server&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;After installing Graylog, we need to add a few extra parts into the configuration file, mainly passwords.&lt;br /&gt;
&lt;br /&gt;
This will generate a password and a sha256sum for it. Do note that the password is required and &#039;&#039;&#039;MUST&#039;&#039;&#039; be 16 characters or longer, otherwise Graylog refuses to function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo -n yourpassword | sha256sum &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The password must be put into &amp;lt;code&amp;gt; /etc/graylog/server/server.conf&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
While in the configuration file, also add your public ip with correct ports into &amp;lt;code&amp;gt; rest_listen_uri &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; web_listen_uri &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;Final steps to enable Graylog.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable graylog-server.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl start graylog-server.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there you have it, one fully installed Graylog, ready for all your logging needs!.&lt;br /&gt;
&lt;br /&gt;
After this, you can explore the web interface at the public ip address you set before and start logging whatever you want.&lt;br /&gt;
&lt;br /&gt;
= Nagios =&lt;br /&gt;
&lt;br /&gt;
Nagios is a free open source application that is used to monitor systems and networks. Nagios is able to alert users if things go wrong and when the problem is resolved. Nagios was created Ethen Galstad and a group of developers, and was initially released in March 14, 1999&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Nagios&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before installing Nagios, we need to once again check the version&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This guide is intended for 14.04 ubuntu servers, so if you are higher or lower, upgrade/downgrade appropriately. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installing Nagios is a easier said than done, because it needs alot of stuff in advanced, like a LAMP base.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Doing these commands will install Apache, MYSQL and PHP, which are needed for Nagios functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apache2&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install mysql-server php5-mysql&lt;br /&gt;
&lt;br /&gt;
sudo mysql_install_db&lt;br /&gt;
&lt;br /&gt;
sudo mysql_secure_installation&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache2 a bit, go into &amp;lt;code&amp;gt; /etc/apache2/mods-enabled/dir.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change this line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into this line by moving index.php ahead of index.html.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that just restart Apache service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service apache2 restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now we need to make a user and group who will be dealing with using Nagios.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo useradd nagios&lt;br /&gt;
&lt;br /&gt;
sudo groupadd nagcmd&lt;br /&gt;
&lt;br /&gt;
sudo usermod -a -G nagcmd nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;We can almost move to building the Nagios Core, but first we need a few dependencies.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install build-essential libgd2-xpm-dev openssl libssl-dev xinetd apache2-utils unzip&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;Now to finally install Nagios itself&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-4.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;Move to the newly created folder and type these commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-group=nagios --with-command-group=nagcmd&lt;br /&gt;
 &lt;br /&gt;
make all &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That final command compiled Nagios, but its not fully done just yet. We still need a few more things to install on it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-commandmode&lt;br /&gt;
&lt;br /&gt;
sudo make install-init&lt;br /&gt;
&lt;br /&gt;
sudo make install-config&lt;br /&gt;
&lt;br /&gt;
sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;To be able to issue external commands trough the web interface of Nagios, we need to add the web server user into the nagios group&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo usermod -G nagcmd www-data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;We will also need Nagios Plugins and NRPE, which are installed in the same fashion as Nagios Core&lt;br /&gt;
&lt;br /&gt;
Nagios Plugins:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-plugins-2.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NRPE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nrpe-2.15.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Building NRPE, needs its xinetd startup script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;make all&lt;br /&gt;
&lt;br /&gt;
sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-xinetd&lt;br /&gt;
&lt;br /&gt;
sudo make install-daemon-config&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;We also need to open up the xinetd script in &amp;lt;code&amp;gt;/etc/xinetd.d/nrpe&amp;lt;/code&amp;gt; and add the Nagios servers private/public address to the end of it.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;only_from = 127.0.0.1 192.168.56.200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After modifying the file, restart xinetd&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service xinetd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;9)&#039;&#039;&#039;Now Nagios is fully installed, but still needs more configuring.&lt;br /&gt;
&lt;br /&gt;
Lets start off by going into this file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/nagios.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncommenting this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#cfg_dir=/usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now create the directory that will store the configuration file for each server that you will monitor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;10)&#039;&#039;&#039;Lets also add a command to NRPE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/objects/commands.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the following to the end of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define command{&lt;br /&gt;
        command_name check_nrpe&lt;br /&gt;
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache aswell, so lets enable Apache rewrite and cgi modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
sudo a2enmod cgi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use htpasswd to create an admin user, called &amp;quot;nagiosadmin&amp;quot;, that will be used in getting access to the web interface.&lt;br /&gt;
Set a password when prompted by the command, this username and password will be the main login credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally lets make a symlink between the nagios configuration file and the Apache sites-enabled directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ln -s /etc/apache2/sites-available/nagios.conf /etc/apache2/sites-enabled/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;11)&#039;&#039;&#039;And thats it, Nagios is ready to be started up, just restart the service and add Nagios to start on server booting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios start&lt;br /&gt;
&lt;br /&gt;
sudo service apache2 restart&lt;br /&gt;
&lt;br /&gt;
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats all, now you have a fully (hopefully) working Nagios thanks to following these steps.&lt;br /&gt;
&lt;br /&gt;
You can access the webinterface by going here: &amp;lt;code&amp;gt;http://nagios_server_public_ip/nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;12)&#039;&#039;&#039;But lets not stop there, lets try adding something for Nagios to keep an eye on. To do this, lets swap over to another machine that is in the same network as the Nagios server.&lt;br /&gt;
&lt;br /&gt;
On this other machine, lets install NRPE, it will be needed to make Nagios work on the new machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install nagios-plugins nagios-nrpe-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once NRPE is installed, lets go into the configuration file once again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the nagios server ip to the end of the &amp;lt;code&amp;gt;allowed_hosts=127.0.0.1,&amp;lt;/code&amp;gt; segment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;13)&#039;&#039;&#039;As an example, lets monitor one of our filesystems.&lt;br /&gt;
&lt;br /&gt;
Lets look up the filesystems that we have.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;df -h /&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go back into the NRPE configuration file in &amp;lt;code&amp;gt;/etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt; and change these three lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;server_address=client_private_IP&lt;br /&gt;
allowed_hosts=nagios_server_private_IP (you already set this earlier)&lt;br /&gt;
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p (filesystem that you chose)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dont forget to restart the NRPE service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios-nrpe-server restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14)&#039;&#039;&#039;After all that is done, its time to head back to the machine with the actual Nagios server and the new Host into the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/servers/yourhost.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this file, you need to add this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define host {&lt;br /&gt;
        use                             linux-server&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        alias                           My first Apache server&lt;br /&gt;
        address                         10.132.234.52 (changeme)&lt;br /&gt;
        max_check_attempts              5&lt;br /&gt;
        check_period                    24x7&lt;br /&gt;
        notification_interval           30&lt;br /&gt;
        notification_period             24x7&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
define service {&lt;br /&gt;
        use                             generic-service&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        service_description             PING&lt;br /&gt;
        check_command                   check_ping!100.0,20%!500.0,60%&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always restart services after major changes!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And thats all folks! Now if you were to look at your Nagios web interface, you would be able to see the new host you just added, and also a service tied to said host.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Graylong and Nagios are rather easy to install, albeit a bit time consuming and confusing. But they are still very good services in regards to Logging and Monitoring things.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Sources =&lt;br /&gt;
&lt;br /&gt;
http://docs.graylog.org/en/2.1/pages/installation/os/ubuntu.html&lt;br /&gt;
&lt;br /&gt;
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04&lt;br /&gt;
&lt;br /&gt;
https://www.digitalocean.com/community/tutorials/how-to-install-nagios-4-and-monitor-your-servers-on-ubuntu-14-04#configure-nagios&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116363</id>
		<title>Graylog&amp;Nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116363"/>
		<updated>2017-01-05T08:52:35Z</updated>

		<summary type="html">&lt;p&gt;Mhass: /* Sources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Logging and Monitoring - Graylog and Nagios installation.&lt;br /&gt;
&lt;br /&gt;
Group : Cyber Security Engineering (C21).&lt;br /&gt;
&lt;br /&gt;
Page created by Meelis Hass.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
In this page, I will show how a person can easily install and configure a good logging and monitoring solution into their systems and networks. My choices for this task are Graylog and Nagios.&lt;br /&gt;
&lt;br /&gt;
= Graylog =&lt;br /&gt;
&lt;br /&gt;
Graylog is currently one of the most popular open-source logging solution. It&#039;s plus sides, are that it is able to work with unstructured logs from anywhere, is free and open source and is easy to install.&amp;lt;ref&amp;gt; https://www.graylog.org/features&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now before we begin installing Graylog, we should check what version the machine is actully running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is because this guide is intended for 16.04 version of Ubuntu, If you do already have it, skip to actual installation. People who need to upgrade just continue with the following commands.&lt;br /&gt;
&lt;br /&gt;
Next lets upgrade our machine.&lt;br /&gt;
&lt;br /&gt;
*Start off by updating your package list&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Next lets upgrade everything&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then fix the dependencies with this&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get dist-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*And finish off by finishing the upgrade&lt;br /&gt;
&amp;lt;code&amp;gt; sudo do-release-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to the actual meat of the guide, installing graylog. But we cant just jump into installing Graylog itself, because it needs a few services and a setup base to run it, like Elasticsearch and MongoDB.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Starting off with the setup base.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apt-transport-https openjdk-8-jre-headless uuid-runtime pwgen &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now lets install MongoDB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install mongodb-server &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;Installing Elasticsearch takes a few more commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo &amp;quot;deb https://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install elasticsearch &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;We still need to configure Elasticsearch a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; nano /etc/elasticsearch/elasticsearch.yml &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncomment and change this line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cluster.name: graylog &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;After that, just start the service&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable elasticsearch.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl restart elasticsearch.service &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;Now we actully start installing Graylog itself! Start off by getting the required packages and then installing them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget https://packages.graylog2.org/repo/packages/graylog-2.1-repository_latest.deb &lt;br /&gt;
&lt;br /&gt;
sudo dpkg -i graylog-2.1-repository_latest.deb&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install graylog-server&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;After installing Graylog, we need to add a few extra parts into the configuration file, mainly passwords.&lt;br /&gt;
&lt;br /&gt;
This will generate a password and a sha256sum for it. Do note that the password is required and &#039;&#039;&#039;MUST&#039;&#039;&#039; be 16 characters or longer, otherwise Graylog refuses to function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo -n yourpassword | sha256sum &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The password must be put into &amp;lt;code&amp;gt; /etc/graylog/server/server.conf&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
While in the configuration file, also add your public ip with correct ports into &amp;lt;code&amp;gt; rest_listen_uri &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; web_listen_uri &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;Final steps to enable Graylog.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable graylog-server.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl start graylog-server.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there you have it, one fully installed Graylog, ready for all your logging needs!.&lt;br /&gt;
&lt;br /&gt;
After this, you can explore the web interface at the public ip address you set before and start logging whatever you want.&lt;br /&gt;
&lt;br /&gt;
= Nagios =&lt;br /&gt;
&lt;br /&gt;
Nagios is a free open source application that is used to monitor systems and networks. Nagios is able to alert users if things go wrong and when the problem is resolved. Nagios was created Ethen Galstad and a group of developers, and was initially released in March 14, 1999&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Nagios&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before installing Nagios, we need to once again check the version&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This guide is intended for 14.04 ubuntu servers, so if you are higher or lower, upgrade/downgrade appropriately. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installing Nagios is a easier said than done, because it needs alot of stuff in advanced, like a LAMP base.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Doing these commands will install Apache, MYSQL and PHP, which are needed for Nagios functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apache2&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install mysql-server php5-mysql&lt;br /&gt;
&lt;br /&gt;
sudo mysql_install_db&lt;br /&gt;
&lt;br /&gt;
sudo mysql_secure_installation&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache2 a bit, go into &amp;lt;code&amp;gt; /etc/apache2/mods-enabled/dir.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change this line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into this line by moving index.php ahead of index.html.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that just restart Apache service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service apache2 restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now we need to make a user and group who will be dealing with using Nagios.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo useradd nagios&lt;br /&gt;
&lt;br /&gt;
sudo groupadd nagcmd&lt;br /&gt;
&lt;br /&gt;
sudo usermod -a -G nagcmd nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;We can almost move to building the Nagios Core, but first we need a few dependencies.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install build-essential libgd2-xpm-dev openssl libssl-dev xinetd apache2-utils unzip&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;Now to finally install Nagios itself&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-4.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;Move to the newly created folder and type these commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-group=nagios --with-command-group=nagcmd&lt;br /&gt;
 &lt;br /&gt;
make all &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That final command compiled Nagios, but its not fully done just yet. We still need a few more things to install on it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-commandmode&lt;br /&gt;
&lt;br /&gt;
sudo make install-init&lt;br /&gt;
&lt;br /&gt;
sudo make install-config&lt;br /&gt;
&lt;br /&gt;
sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;To be able to issue external commands trough the web interface of Nagios, we need to add the web server user into the nagios group&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo usermod -G nagcmd www-data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;We will also need Nagios Plugins and NRPE, which are installed in the same fashion as Nagios Core&lt;br /&gt;
&lt;br /&gt;
Nagios Plugins:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-plugins-2.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NRPE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nrpe-2.15.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Building NRPE, needs its xinetd startup script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;make all&lt;br /&gt;
&lt;br /&gt;
sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-xinetd&lt;br /&gt;
&lt;br /&gt;
sudo make install-daemon-config&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;We also need to open up the xinetd script in &amp;lt;code&amp;gt;/etc/xinetd.d/nrpe&amp;lt;/code&amp;gt; and add the Nagios servers private/public address to the end of it.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;only_from = 127.0.0.1 192.168.56.200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After modifying the file, restart xinetd&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service xinetd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;9)&#039;&#039;&#039;Now Nagios is fully installed, but still needs more configuring.&lt;br /&gt;
&lt;br /&gt;
Lets start off by going into this file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/nagios.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncommenting this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#cfg_dir=/usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now create the directory that will store the configuration file for each server that you will monitor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;10)&#039;&#039;&#039;Lets also add a command to NRPE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/objects/commands.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the following to the end of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define command{&lt;br /&gt;
        command_name check_nrpe&lt;br /&gt;
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache aswell, so lets enable Apache rewrite and cgi modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
sudo a2enmod cgi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use htpasswd to create an admin user, called &amp;quot;nagiosadmin&amp;quot;, that will be used in getting access to the web interface.&lt;br /&gt;
Set a password when prompted by the command, this username and password will be the main login credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally lets make a symlink between the nagios configuration file and the Apache sites-enabled directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ln -s /etc/apache2/sites-available/nagios.conf /etc/apache2/sites-enabled/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;11)&#039;&#039;&#039;And thats it, Nagios is ready to be started up, just restart the service and add Nagios to start on server booting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios start&lt;br /&gt;
&lt;br /&gt;
sudo service apache2 restart&lt;br /&gt;
&lt;br /&gt;
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats all, now you have a fully (hopefully) working Nagios thanks to following these steps.&lt;br /&gt;
&lt;br /&gt;
You can access the webinterface by going here: &amp;lt;code&amp;gt;http://nagios_server_public_ip/nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;12)&#039;&#039;&#039;But lets not stop there, lets try adding something for Nagios to keep an eye on. To do this, lets swap over to another machine that is in the same network as the Nagios server.&lt;br /&gt;
&lt;br /&gt;
On this other machine, lets install NRPE, it will be needed to make Nagios work on the new machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install nagios-plugins nagios-nrpe-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once NRPE is installed, lets go into the configuration file once again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the nagios server ip to the end of the &amp;lt;code&amp;gt;allowed_hosts=127.0.0.1,&amp;lt;/code&amp;gt; segment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;13)&#039;&#039;&#039;As an example, lets monitor one of our filesystems.&lt;br /&gt;
&lt;br /&gt;
Lets look up the filesystems that we have.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;df -h /&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go back into the NRPE configuration file in &amp;lt;code&amp;gt;/etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt; and change these three lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;server_address=client_private_IP&lt;br /&gt;
allowed_hosts=nagios_server_private_IP (you already set this earlier)&lt;br /&gt;
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p (filesystem that you chose)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dont forget to restart the NRPE service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios-nrpe-server restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14)&#039;&#039;&#039;After all that is done, its time to head back to the machine with the actual Nagios server and the new Host into the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/servers/yourhost.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this file, you need to add this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define host {&lt;br /&gt;
        use                             linux-server&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        alias                           My first Apache server&lt;br /&gt;
        address                         10.132.234.52 (changeme)&lt;br /&gt;
        max_check_attempts              5&lt;br /&gt;
        check_period                    24x7&lt;br /&gt;
        notification_interval           30&lt;br /&gt;
        notification_period             24x7&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
define service {&lt;br /&gt;
        use                             generic-service&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        service_description             PING&lt;br /&gt;
        check_command                   check_ping!100.0,20%!500.0,60%&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always restart services after major changes!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And thats all folks! Now if you were to look at your Nagios web interface, you would be able to see the new host you just added, and also a service tied to said host.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Graylong and Nagios are rather easy to install, albeit a bit time consuming and confusing. But they are still very good services in regards to Logging and Monitoring things.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Sources =&lt;br /&gt;
&lt;br /&gt;
http://docs.graylog.org/en/2.1/pages/installation/os/ubuntu.html&lt;br /&gt;
&lt;br /&gt;
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04&lt;br /&gt;
&lt;br /&gt;
https://www.digitalocean.com/community/tutorials/how-to-install-nagios-4-and-monitor-your-servers-on-ubuntu-14-04#configure-nagios&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116362</id>
		<title>Graylog&amp;Nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116362"/>
		<updated>2017-01-05T08:52:04Z</updated>

		<summary type="html">&lt;p&gt;Mhass: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Logging and Monitoring - Graylog and Nagios installation.&lt;br /&gt;
&lt;br /&gt;
Group : Cyber Security Engineering (C21).&lt;br /&gt;
&lt;br /&gt;
Page created by Meelis Hass.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
In this page, I will show how a person can easily install and configure a good logging and monitoring solution into their systems and networks. My choices for this task are Graylog and Nagios.&lt;br /&gt;
&lt;br /&gt;
= Graylog =&lt;br /&gt;
&lt;br /&gt;
Graylog is currently one of the most popular open-source logging solution. It&#039;s plus sides, are that it is able to work with unstructured logs from anywhere, is free and open source and is easy to install.&amp;lt;ref&amp;gt; https://www.graylog.org/features&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now before we begin installing Graylog, we should check what version the machine is actully running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is because this guide is intended for 16.04 version of Ubuntu, If you do already have it, skip to actual installation. People who need to upgrade just continue with the following commands.&lt;br /&gt;
&lt;br /&gt;
Next lets upgrade our machine.&lt;br /&gt;
&lt;br /&gt;
*Start off by updating your package list&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Next lets upgrade everything&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then fix the dependencies with this&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get dist-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*And finish off by finishing the upgrade&lt;br /&gt;
&amp;lt;code&amp;gt; sudo do-release-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to the actual meat of the guide, installing graylog. But we cant just jump into installing Graylog itself, because it needs a few services and a setup base to run it, like Elasticsearch and MongoDB.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Starting off with the setup base.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apt-transport-https openjdk-8-jre-headless uuid-runtime pwgen &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now lets install MongoDB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install mongodb-server &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;Installing Elasticsearch takes a few more commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo &amp;quot;deb https://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install elasticsearch &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;We still need to configure Elasticsearch a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; nano /etc/elasticsearch/elasticsearch.yml &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncomment and change this line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cluster.name: graylog &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;After that, just start the service&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable elasticsearch.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl restart elasticsearch.service &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;Now we actully start installing Graylog itself! Start off by getting the required packages and then installing them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget https://packages.graylog2.org/repo/packages/graylog-2.1-repository_latest.deb &lt;br /&gt;
&lt;br /&gt;
sudo dpkg -i graylog-2.1-repository_latest.deb&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install graylog-server&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;After installing Graylog, we need to add a few extra parts into the configuration file, mainly passwords.&lt;br /&gt;
&lt;br /&gt;
This will generate a password and a sha256sum for it. Do note that the password is required and &#039;&#039;&#039;MUST&#039;&#039;&#039; be 16 characters or longer, otherwise Graylog refuses to function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo -n yourpassword | sha256sum &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The password must be put into &amp;lt;code&amp;gt; /etc/graylog/server/server.conf&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
While in the configuration file, also add your public ip with correct ports into &amp;lt;code&amp;gt; rest_listen_uri &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; web_listen_uri &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;Final steps to enable Graylog.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable graylog-server.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl start graylog-server.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there you have it, one fully installed Graylog, ready for all your logging needs!.&lt;br /&gt;
&lt;br /&gt;
After this, you can explore the web interface at the public ip address you set before and start logging whatever you want.&lt;br /&gt;
&lt;br /&gt;
= Nagios =&lt;br /&gt;
&lt;br /&gt;
Nagios is a free open source application that is used to monitor systems and networks. Nagios is able to alert users if things go wrong and when the problem is resolved. Nagios was created Ethen Galstad and a group of developers, and was initially released in March 14, 1999&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Nagios&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before installing Nagios, we need to once again check the version&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This guide is intended for 14.04 ubuntu servers, so if you are higher or lower, upgrade/downgrade appropriately. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installing Nagios is a easier said than done, because it needs alot of stuff in advanced, like a LAMP base.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Doing these commands will install Apache, MYSQL and PHP, which are needed for Nagios functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apache2&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install mysql-server php5-mysql&lt;br /&gt;
&lt;br /&gt;
sudo mysql_install_db&lt;br /&gt;
&lt;br /&gt;
sudo mysql_secure_installation&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache2 a bit, go into &amp;lt;code&amp;gt; /etc/apache2/mods-enabled/dir.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change this line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into this line by moving index.php ahead of index.html.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that just restart Apache service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service apache2 restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now we need to make a user and group who will be dealing with using Nagios.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo useradd nagios&lt;br /&gt;
&lt;br /&gt;
sudo groupadd nagcmd&lt;br /&gt;
&lt;br /&gt;
sudo usermod -a -G nagcmd nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;We can almost move to building the Nagios Core, but first we need a few dependencies.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install build-essential libgd2-xpm-dev openssl libssl-dev xinetd apache2-utils unzip&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;Now to finally install Nagios itself&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-4.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;Move to the newly created folder and type these commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-group=nagios --with-command-group=nagcmd&lt;br /&gt;
 &lt;br /&gt;
make all &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That final command compiled Nagios, but its not fully done just yet. We still need a few more things to install on it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-commandmode&lt;br /&gt;
&lt;br /&gt;
sudo make install-init&lt;br /&gt;
&lt;br /&gt;
sudo make install-config&lt;br /&gt;
&lt;br /&gt;
sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;To be able to issue external commands trough the web interface of Nagios, we need to add the web server user into the nagios group&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo usermod -G nagcmd www-data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;We will also need Nagios Plugins and NRPE, which are installed in the same fashion as Nagios Core&lt;br /&gt;
&lt;br /&gt;
Nagios Plugins:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-plugins-2.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NRPE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nrpe-2.15.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Building NRPE, needs its xinetd startup script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;make all&lt;br /&gt;
&lt;br /&gt;
sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-xinetd&lt;br /&gt;
&lt;br /&gt;
sudo make install-daemon-config&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;We also need to open up the xinetd script in &amp;lt;code&amp;gt;/etc/xinetd.d/nrpe&amp;lt;/code&amp;gt; and add the Nagios servers private/public address to the end of it.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;only_from = 127.0.0.1 192.168.56.200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After modifying the file, restart xinetd&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service xinetd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;9)&#039;&#039;&#039;Now Nagios is fully installed, but still needs more configuring.&lt;br /&gt;
&lt;br /&gt;
Lets start off by going into this file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/nagios.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncommenting this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#cfg_dir=/usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now create the directory that will store the configuration file for each server that you will monitor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;10)&#039;&#039;&#039;Lets also add a command to NRPE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/objects/commands.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the following to the end of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define command{&lt;br /&gt;
        command_name check_nrpe&lt;br /&gt;
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache aswell, so lets enable Apache rewrite and cgi modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
sudo a2enmod cgi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use htpasswd to create an admin user, called &amp;quot;nagiosadmin&amp;quot;, that will be used in getting access to the web interface.&lt;br /&gt;
Set a password when prompted by the command, this username and password will be the main login credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally lets make a symlink between the nagios configuration file and the Apache sites-enabled directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ln -s /etc/apache2/sites-available/nagios.conf /etc/apache2/sites-enabled/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;11)&#039;&#039;&#039;And thats it, Nagios is ready to be started up, just restart the service and add Nagios to start on server booting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios start&lt;br /&gt;
&lt;br /&gt;
sudo service apache2 restart&lt;br /&gt;
&lt;br /&gt;
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats all, now you have a fully (hopefully) working Nagios thanks to following these steps.&lt;br /&gt;
&lt;br /&gt;
You can access the webinterface by going here: &amp;lt;code&amp;gt;http://nagios_server_public_ip/nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;12)&#039;&#039;&#039;But lets not stop there, lets try adding something for Nagios to keep an eye on. To do this, lets swap over to another machine that is in the same network as the Nagios server.&lt;br /&gt;
&lt;br /&gt;
On this other machine, lets install NRPE, it will be needed to make Nagios work on the new machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install nagios-plugins nagios-nrpe-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once NRPE is installed, lets go into the configuration file once again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the nagios server ip to the end of the &amp;lt;code&amp;gt;allowed_hosts=127.0.0.1,&amp;lt;/code&amp;gt; segment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;13)&#039;&#039;&#039;As an example, lets monitor one of our filesystems.&lt;br /&gt;
&lt;br /&gt;
Lets look up the filesystems that we have.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;df -h /&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go back into the NRPE configuration file in &amp;lt;code&amp;gt;/etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt; and change these three lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;server_address=client_private_IP&lt;br /&gt;
allowed_hosts=nagios_server_private_IP (you already set this earlier)&lt;br /&gt;
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p (filesystem that you chose)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dont forget to restart the NRPE service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios-nrpe-server restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14)&#039;&#039;&#039;After all that is done, its time to head back to the machine with the actual Nagios server and the new Host into the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/servers/yourhost.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this file, you need to add this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define host {&lt;br /&gt;
        use                             linux-server&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        alias                           My first Apache server&lt;br /&gt;
        address                         10.132.234.52 (changeme)&lt;br /&gt;
        max_check_attempts              5&lt;br /&gt;
        check_period                    24x7&lt;br /&gt;
        notification_interval           30&lt;br /&gt;
        notification_period             24x7&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
define service {&lt;br /&gt;
        use                             generic-service&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        service_description             PING&lt;br /&gt;
        check_command                   check_ping!100.0,20%!500.0,60%&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always restart services after major changes!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And thats all folks! Now if you were to look at your Nagios web interface, you would be able to see the new host you just added, and also a service tied to said host.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Graylong and Nagios are rather easy to install, albeit a bit time consuming and confusing. But they are still very good services in regards to Logging and Monitoring things.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Sources =&lt;br /&gt;
&lt;br /&gt;
http://docs.graylog.org/en/2.1/pages/installation/os/ubuntu.html&lt;br /&gt;
&lt;br /&gt;
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04&lt;br /&gt;
&lt;br /&gt;
https://www.digitalocean.com/community/tutorials/how-to-install-nagios-4-and-monitor-your-servers-on-ubuntu-14-04#configure-nagios&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116361</id>
		<title>Graylog&amp;Nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116361"/>
		<updated>2017-01-05T08:51:35Z</updated>

		<summary type="html">&lt;p&gt;Mhass: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Logging and Monitoring - Graylog and Nagios installation.&lt;br /&gt;
&lt;br /&gt;
Group : Cyber Security Engineering (C21).&lt;br /&gt;
&lt;br /&gt;
Page created by Meelis Hass.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
In this page, I will show how a person can easily install and configure a good logging and monitoring solution into their systems and networks. My choices for this task are Graylog and Nagios.&lt;br /&gt;
&lt;br /&gt;
= Graylog =&lt;br /&gt;
&lt;br /&gt;
Graylog is currently one of the most popular open-source logging solution. It&#039;s plus sides, are that it is able to work with unstructured logs from anywhere, is free and open source and is easy to install.&amp;lt;ref&amp;gt; https://www.graylog.org/features&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now before we begin installing Graylog, we should check what version the machine is actully running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is because this guide is intended for 16.04 version of Ubuntu, If you do already have it, skip to actual installation. People who need to upgrade just continue with the following commands.&lt;br /&gt;
&lt;br /&gt;
Next lets upgrade our machine.&lt;br /&gt;
&lt;br /&gt;
*Start off by updating your package list&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Next lets upgrade everything&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then fix the dependencies with this&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get dist-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*And finish off by finishing the upgrade&lt;br /&gt;
&amp;lt;code&amp;gt; sudo do-release-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to the actual meat of the guide, installing graylog. But we cant just jump into installing Graylog itself, because it needs a few services and a setup base to run it, like Elasticsearch and MongoDB.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Starting off with the setup base.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apt-transport-https openjdk-8-jre-headless uuid-runtime pwgen &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now lets install MongoDB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install mongodb-server &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;Installing Elasticsearch takes a few more commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo &amp;quot;deb https://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install elasticsearch &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;We still need to configure Elasticsearch a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; nano /etc/elasticsearch/elasticsearch.yml &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncomment and change this line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cluster.name: graylog &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;After that, just start the service&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable elasticsearch.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl restart elasticsearch.service &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;Now we actully start installing Graylog itself! Start off by getting the required packages and then installing them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget https://packages.graylog2.org/repo/packages/graylog-2.1-repository_latest.deb &lt;br /&gt;
&lt;br /&gt;
sudo dpkg -i graylog-2.1-repository_latest.deb&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install graylog-server&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;After installing Graylog, we need to add a few extra parts into the configuration file, mainly passwords.&lt;br /&gt;
&lt;br /&gt;
This will generate a password and a sha256sum for it. Do note that the password is required and &#039;&#039;&#039;MUST&#039;&#039;&#039; be 16 characters or longer, otherwise Graylog refuses to function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo -n yourpassword | sha256sum &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The password must be put into &amp;lt;code&amp;gt; /etc/graylog/server/server.conf&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
While in the configuration file, also add your public ip with correct ports into &amp;lt;code&amp;gt; rest_listen_uri &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; web_listen_uri &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;Final steps to enable Graylog.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable graylog-server.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl start graylog-server.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there you have it, one fully installed Graylog, ready for all your logging needs!.&lt;br /&gt;
&lt;br /&gt;
After this, you can explore the web interface at the public ip address you set before and start logging whatever you want.&lt;br /&gt;
&lt;br /&gt;
= Nagios =&lt;br /&gt;
&lt;br /&gt;
Nagios is a free open source application that is used to monitor systems and networks. Nagios is able to alert users if things go wrong and when the problem is resolved. Nagios was created Ethen Galstad and a group of developers, and was initially released in March 14, 1999&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Nagios&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before installing Nagios, we need to once again check the version&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This guide is intended for 14.04 ubuntu servers, so if you are higher or lower, upgrade/downgrade appropriately. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installing Nagios is a easier said than done, because it needs alot of stuff in advanced, like a LAMP base.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Doing these commands will install Apache, MYSQL and PHP, which are needed for Nagios functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apache2&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install mysql-server php5-mysql&lt;br /&gt;
&lt;br /&gt;
sudo mysql_install_db&lt;br /&gt;
&lt;br /&gt;
sudo mysql_secure_installation&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache2 a bit, go into &amp;lt;code&amp;gt; /etc/apache2/mods-enabled/dir.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change this line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into this line by moving index.php ahead of index.html.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that just restart Apache service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service apache2 restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now we need to make a user and group who will be dealing with using Nagios.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo useradd nagios&lt;br /&gt;
&lt;br /&gt;
sudo groupadd nagcmd&lt;br /&gt;
&lt;br /&gt;
sudo usermod -a -G nagcmd nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;We can almost move to building the Nagios Core, but first we need a few dependencies.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install build-essential libgd2-xpm-dev openssl libssl-dev xinetd apache2-utils unzip&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;Now to finally install Nagios itself&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-4.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;Move to the newly created folder and type these commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-group=nagios --with-command-group=nagcmd&lt;br /&gt;
 &lt;br /&gt;
make all &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That final command compiled Nagios, but its not fully done just yet. We still need a few more things to install on it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-commandmode&lt;br /&gt;
&lt;br /&gt;
sudo make install-init&lt;br /&gt;
&lt;br /&gt;
sudo make install-config&lt;br /&gt;
&lt;br /&gt;
sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;To be able to issue external commands trough the web interface of Nagios, we need to add the web server user into the nagios group&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo usermod -G nagcmd www-data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;We will also need Nagios Plugins and NRPE, which are installed in the same fashion as Nagios Core&lt;br /&gt;
&lt;br /&gt;
Nagios Plugins:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-plugins-2.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NRPE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nrpe-2.15.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Building NRPE, needs its xinetd startup script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;make all&lt;br /&gt;
&lt;br /&gt;
sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-xinetd&lt;br /&gt;
&lt;br /&gt;
sudo make install-daemon-config&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;We also need to open up the xinetd script in &amp;lt;code&amp;gt;/etc/xinetd.d/nrpe&amp;lt;/code&amp;gt; and add the Nagios servers private/public address to the end of it.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;only_from = 127.0.0.1 192.168.56.200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After modifying the file, restart xinetd&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service xinetd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;9)&#039;&#039;&#039;Now Nagios is fully installed, but still needs more configuring.&lt;br /&gt;
&lt;br /&gt;
Lets start off by going into this file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/nagios.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncommenting this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#cfg_dir=/usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now create the directory that will store the configuration file for each server that you will monitor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;10)&#039;&#039;&#039;Lets also add a command to NRPE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/objects/commands.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the following to the end of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define command{&lt;br /&gt;
        command_name check_nrpe&lt;br /&gt;
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache aswell, so lets enable Apache rewrite and cgi modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
sudo a2enmod cgi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use htpasswd to create an admin user, called &amp;quot;nagiosadmin&amp;quot;, that will be used in getting access to the web interface.&lt;br /&gt;
Set a password when prompted by the command, this username and password will be the main login credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally lets make a symlink between the nagios configuration file and the Apache sites-enabled directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ln -s /etc/apache2/sites-available/nagios.conf /etc/apache2/sites-enabled/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;11)&#039;&#039;&#039;And thats it, Nagios is ready to be started up, just restart the service and add Nagios to start on server booting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios start&lt;br /&gt;
&lt;br /&gt;
sudo service apache2 restart&lt;br /&gt;
&lt;br /&gt;
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats all, now you have a fully (hopefully) working Nagios thanks to following these steps.&lt;br /&gt;
&lt;br /&gt;
You can access the webinterface by going here: &amp;lt;code&amp;gt;http://nagios_server_public_ip/nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;12)&#039;&#039;&#039;But lets not stop there, lets try adding something for Nagios to keep an eye on. To do this, lets swap over to another machine that is in the same network as the Nagios server.&lt;br /&gt;
&lt;br /&gt;
On this other machine, lets install NRPE, it will be needed to make Nagios work on the new machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install nagios-plugins nagios-nrpe-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once NRPE is installed, lets go into the configuration file once again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the nagios server ip to the end of the &amp;lt;code&amp;gt;allowed_hosts=127.0.0.1,&amp;lt;/code&amp;gt; segment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;13)&#039;&#039;&#039;As an example, lets monitor one of our filesystems.&lt;br /&gt;
&lt;br /&gt;
Lets look up the filesystems that we have.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;df -h /&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go back into the NRPE configuration file in &amp;lt;code&amp;gt;/etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt; and change these three lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;server_address=client_private_IP&lt;br /&gt;
allowed_hosts=nagios_server_private_IP (you already set this earlier)&lt;br /&gt;
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p (filesystem that you chose)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dont forget to restart the NRPE service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios-nrpe-server restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14)&#039;&#039;&#039;After all that is done, its time to head back to the machine with the actual Nagios server and the new Host into the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/servers/yourhost.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this file, you need to add this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define host {&lt;br /&gt;
        use                             linux-server&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        alias                           My first Apache server&lt;br /&gt;
        address                         10.132.234.52 (changeme)&lt;br /&gt;
        max_check_attempts              5&lt;br /&gt;
        check_period                    24x7&lt;br /&gt;
        notification_interval           30&lt;br /&gt;
        notification_period             24x7&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
define service {&lt;br /&gt;
        use                             generic-service&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        service_description             PING&lt;br /&gt;
        check_command                   check_ping!100.0,20%!500.0,60%&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always restart services after major changes!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And thats all folks! Now if you were to look at your Nagios web interface, you would be able to see the new host you just added, and also a service tied to said host.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Graylong and Nagios are rather easy to install, albeit a bit time consuming and confusing. But they are still very good services in regards to Logging and Monitoring things.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Sources =&lt;br /&gt;
&lt;br /&gt;
http://docs.graylog.org/en/2.1/pages/installation/os/ubuntu.html&lt;br /&gt;
&lt;br /&gt;
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04&lt;br /&gt;
&lt;br /&gt;
https://www.digitalocean.com/community/tutorials/how-to-install-nagios-4-and-monitor-your-servers-on-ubuntu-14-04#configure-nagios&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116360</id>
		<title>Graylog&amp;Nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116360"/>
		<updated>2017-01-05T08:51:19Z</updated>

		<summary type="html">&lt;p&gt;Mhass: /* Nagios */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Logging and Monitoring - Graylog and Nagios installation.&lt;br /&gt;
&lt;br /&gt;
Group : Cyber Security Engineering (C21).&lt;br /&gt;
&lt;br /&gt;
Page created by Meelis Hass.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
In this page, I will show how a person can easily install and configure a good logging and monitoring solution into their systems and networks. My choices for this task are Graylog and Nagios.&lt;br /&gt;
&lt;br /&gt;
= Graylog =&lt;br /&gt;
&lt;br /&gt;
Graylog is currently one of the most popular open-source logging solution. It&#039;s plus sides, are that it is able to work with unstructured logs from anywhere, is free and open source and is easy to install.&amp;lt;ref&amp;gt; https://www.graylog.org/features&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now before we begin installing Graylog, we should check what version the machine is actully running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is because this guide is intended for 16.04 version of Ubuntu, If you do already have it, skip to actual installation. People who need to upgrade just continue with the following commands.&lt;br /&gt;
&lt;br /&gt;
Next lets upgrade our machine.&lt;br /&gt;
&lt;br /&gt;
*Start off by updating your package list&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Next lets upgrade everything&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then fix the dependencies with this&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get dist-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*And finish off by finishing the upgrade&lt;br /&gt;
&amp;lt;code&amp;gt; sudo do-release-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to the actual meat of the guide, installing graylog. But we cant just jump into installing Graylog itself, because it needs a few services and a setup base to run it, like Elasticsearch and MongoDB.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Starting off with the setup base.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apt-transport-https openjdk-8-jre-headless uuid-runtime pwgen &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now lets install MongoDB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install mongodb-server &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;Installing Elasticsearch takes a few more commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo &amp;quot;deb https://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install elasticsearch &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;We still need to configure Elasticsearch a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; nano /etc/elasticsearch/elasticsearch.yml &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncomment and change this line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cluster.name: graylog &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;After that, just start the service&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable elasticsearch.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl restart elasticsearch.service &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;Now we actully start installing Graylog itself! Start off by getting the required packages and then installing them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget https://packages.graylog2.org/repo/packages/graylog-2.1-repository_latest.deb &lt;br /&gt;
&lt;br /&gt;
sudo dpkg -i graylog-2.1-repository_latest.deb&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install graylog-server&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;After installing Graylog, we need to add a few extra parts into the configuration file, mainly passwords.&lt;br /&gt;
&lt;br /&gt;
This will generate a password and a sha256sum for it. Do note that the password is required and &#039;&#039;&#039;MUST&#039;&#039;&#039; be 16 characters or longer, otherwise Graylog refuses to function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo -n yourpassword | sha256sum &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The password must be put into &amp;lt;code&amp;gt; /etc/graylog/server/server.conf&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
While in the configuration file, also add your public ip with correct ports into &amp;lt;code&amp;gt; rest_listen_uri &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; web_listen_uri &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;Final steps to enable Graylog.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable graylog-server.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl start graylog-server.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there you have it, one fully installed Graylog, ready for all your logging needs!.&lt;br /&gt;
&lt;br /&gt;
After this, you can explore the web interface at the public ip address you set before and start logging whatever you want.&lt;br /&gt;
&lt;br /&gt;
= Nagios =&lt;br /&gt;
&lt;br /&gt;
Nagios is a free open source application that is used to monitor systems and networks. Nagios is able to alert users if things go wrong and when the problem is resolved. Nagios was created Ethen Galstad and a group of developers, and was initially released in March 14, 1999&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Nagios&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before installing Nagios, we need to once again check the version&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This guide is intended for 14.04 ubuntu servers, so if you are higher or lower, upgrade/downgrade appropriately. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installing Nagios is a easier said than done, because it needs alot of stuff in advanced, like a LAMP base.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Doing these commands will install Apache, MYSQL and PHP, which are needed for Nagios functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apache2&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install mysql-server php5-mysql&lt;br /&gt;
&lt;br /&gt;
sudo mysql_install_db&lt;br /&gt;
&lt;br /&gt;
sudo mysql_secure_installation&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache2 a bit, go into &amp;lt;code&amp;gt; /etc/apache2/mods-enabled/dir.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change this line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into this line by moving index.php ahead of index.html.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that just restart Apache service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service apache2 restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now we need to make a user and group who will be dealing with using Nagios.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo useradd nagios&lt;br /&gt;
&lt;br /&gt;
sudo groupadd nagcmd&lt;br /&gt;
&lt;br /&gt;
sudo usermod -a -G nagcmd nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;We can almost move to building the Nagios Core, but first we need a few dependencies.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install build-essential libgd2-xpm-dev openssl libssl-dev xinetd apache2-utils unzip&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;Now to finally install Nagios itself&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-4.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;Move to the newly created folder and type these commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-group=nagios --with-command-group=nagcmd&lt;br /&gt;
 &lt;br /&gt;
make all &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That final command compiled Nagios, but its not fully done just yet. We still need a few more things to install on it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-commandmode&lt;br /&gt;
&lt;br /&gt;
sudo make install-init&lt;br /&gt;
&lt;br /&gt;
sudo make install-config&lt;br /&gt;
&lt;br /&gt;
sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;To be able to issue external commands trough the web interface of Nagios, we need to add the web server user into the nagios group&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo usermod -G nagcmd www-data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;We will also need Nagios Plugins and NRPE, which are installed in the same fashion as Nagios Core&lt;br /&gt;
&lt;br /&gt;
Nagios Plugins:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-plugins-2.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NRPE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nrpe-2.15.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Building NRPE, needs its xinetd startup script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;make all&lt;br /&gt;
&lt;br /&gt;
sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-xinetd&lt;br /&gt;
&lt;br /&gt;
sudo make install-daemon-config&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;We also need to open up the xinetd script in &amp;lt;code&amp;gt;/etc/xinetd.d/nrpe&amp;lt;/code&amp;gt; and add the Nagios servers private/public address to the end of it.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;only_from = 127.0.0.1 192.168.56.200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After modifying the file, restart xinetd&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service xinetd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;9)&#039;&#039;&#039;Now Nagios is fully installed, but still needs more configuring.&lt;br /&gt;
&lt;br /&gt;
Lets start off by going into this file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/nagios.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncommenting this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#cfg_dir=/usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now create the directory that will store the configuration file for each server that you will monitor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;10)&#039;&#039;&#039;Lets also add a command to NRPE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/objects/commands.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the following to the end of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define command{&lt;br /&gt;
        command_name check_nrpe&lt;br /&gt;
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache aswell, so lets enable Apache rewrite and cgi modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
sudo a2enmod cgi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use htpasswd to create an admin user, called &amp;quot;nagiosadmin&amp;quot;, that will be used in getting access to the web interface.&lt;br /&gt;
Set a password when prompted by the command, this username and password will be the main login credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally lets make a symlink between the nagios configuration file and the Apache sites-enabled directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ln -s /etc/apache2/sites-available/nagios.conf /etc/apache2/sites-enabled/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;11)&#039;&#039;&#039;And thats it, Nagios is ready to be started up, just restart the service and add Nagios to start on server booting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios start&lt;br /&gt;
&lt;br /&gt;
sudo service apache2 restart&lt;br /&gt;
&lt;br /&gt;
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats all, now you have a fully (hopefully) working Nagios thanks to following these steps.&lt;br /&gt;
&lt;br /&gt;
You can access the webinterface by going here: &amp;lt;code&amp;gt;http://nagios_server_public_ip/nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;12)&#039;&#039;&#039;But lets not stop there, lets try adding something for Nagios to keep an eye on. To do this, lets swap over to another machine that is in the same network as the Nagios server.&lt;br /&gt;
&lt;br /&gt;
On this other machine, lets install NRPE, it will be needed to make Nagios work on the new machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install nagios-plugins nagios-nrpe-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once NRPE is installed, lets go into the configuration file once again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the nagios server ip to the end of the &amp;lt;code&amp;gt;allowed_hosts=127.0.0.1,&amp;lt;/code&amp;gt; segment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;13)&#039;&#039;&#039;As an example, lets monitor one of our filesystems.&lt;br /&gt;
&lt;br /&gt;
Lets look up the filesystems that we have.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;df -h /&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go back into the NRPE configuration file in &amp;lt;code&amp;gt;/etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt; and change these three lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;server_address=client_private_IP&lt;br /&gt;
allowed_hosts=nagios_server_private_IP (you already set this earlier)&lt;br /&gt;
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p (filesystem that you chose)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dont forget to restart the NRPE service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios-nrpe-server restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14)&#039;&#039;&#039;After all that is done, its time to head back to the machine with the actual Nagios server and the new Host into the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/servers/yourhost.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this file, you need to add this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define host {&lt;br /&gt;
        use                             linux-server&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        alias                           My first Apache server&lt;br /&gt;
        address                         10.132.234.52 (changeme)&lt;br /&gt;
        max_check_attempts              5&lt;br /&gt;
        check_period                    24x7&lt;br /&gt;
        notification_interval           30&lt;br /&gt;
        notification_period             24x7&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
define service {&lt;br /&gt;
        use                             generic-service&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        service_description             PING&lt;br /&gt;
        check_command                   check_ping!100.0,20%!500.0,60%&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always restart services after major changes!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And thats all folks! Now if you were to look at your Nagios web interface, you would be able to see the new host you just added, and also a service tied to said host.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Graylong and Nagios are rather easy to install, albeit a bit time consuming and confusing. But they are still very good services in regards to Logging and Monitoring things.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
http://docs.graylog.org/en/2.1/pages/installation/os/ubuntu.html&lt;br /&gt;
&lt;br /&gt;
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04&lt;br /&gt;
&lt;br /&gt;
https://www.digitalocean.com/community/tutorials/how-to-install-nagios-4-and-monitor-your-servers-on-ubuntu-14-04#configure-nagios&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116359</id>
		<title>Graylog&amp;Nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116359"/>
		<updated>2017-01-05T08:50:52Z</updated>

		<summary type="html">&lt;p&gt;Mhass: /* Graylog */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Logging and Monitoring - Graylog and Nagios installation.&lt;br /&gt;
&lt;br /&gt;
Group : Cyber Security Engineering (C21).&lt;br /&gt;
&lt;br /&gt;
Page created by Meelis Hass.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
In this page, I will show how a person can easily install and configure a good logging and monitoring solution into their systems and networks. My choices for this task are Graylog and Nagios.&lt;br /&gt;
&lt;br /&gt;
= Graylog =&lt;br /&gt;
&lt;br /&gt;
Graylog is currently one of the most popular open-source logging solution. It&#039;s plus sides, are that it is able to work with unstructured logs from anywhere, is free and open source and is easy to install.&amp;lt;ref&amp;gt; https://www.graylog.org/features&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now before we begin installing Graylog, we should check what version the machine is actully running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is because this guide is intended for 16.04 version of Ubuntu, If you do already have it, skip to actual installation. People who need to upgrade just continue with the following commands.&lt;br /&gt;
&lt;br /&gt;
Next lets upgrade our machine.&lt;br /&gt;
&lt;br /&gt;
*Start off by updating your package list&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Next lets upgrade everything&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then fix the dependencies with this&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get dist-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*And finish off by finishing the upgrade&lt;br /&gt;
&amp;lt;code&amp;gt; sudo do-release-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to the actual meat of the guide, installing graylog. But we cant just jump into installing Graylog itself, because it needs a few services and a setup base to run it, like Elasticsearch and MongoDB.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Starting off with the setup base.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apt-transport-https openjdk-8-jre-headless uuid-runtime pwgen &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now lets install MongoDB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install mongodb-server &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;Installing Elasticsearch takes a few more commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo &amp;quot;deb https://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install elasticsearch &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;We still need to configure Elasticsearch a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; nano /etc/elasticsearch/elasticsearch.yml &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncomment and change this line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cluster.name: graylog &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;After that, just start the service&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable elasticsearch.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl restart elasticsearch.service &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;Now we actully start installing Graylog itself! Start off by getting the required packages and then installing them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget https://packages.graylog2.org/repo/packages/graylog-2.1-repository_latest.deb &lt;br /&gt;
&lt;br /&gt;
sudo dpkg -i graylog-2.1-repository_latest.deb&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install graylog-server&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;After installing Graylog, we need to add a few extra parts into the configuration file, mainly passwords.&lt;br /&gt;
&lt;br /&gt;
This will generate a password and a sha256sum for it. Do note that the password is required and &#039;&#039;&#039;MUST&#039;&#039;&#039; be 16 characters or longer, otherwise Graylog refuses to function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo -n yourpassword | sha256sum &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The password must be put into &amp;lt;code&amp;gt; /etc/graylog/server/server.conf&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
While in the configuration file, also add your public ip with correct ports into &amp;lt;code&amp;gt; rest_listen_uri &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; web_listen_uri &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;Final steps to enable Graylog.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable graylog-server.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl start graylog-server.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there you have it, one fully installed Graylog, ready for all your logging needs!.&lt;br /&gt;
&lt;br /&gt;
After this, you can explore the web interface at the public ip address you set before and start logging whatever you want.&lt;br /&gt;
&lt;br /&gt;
= Nagios =&lt;br /&gt;
&lt;br /&gt;
Nagios is a free open source application that is used to monitor systems and networks. Nagios is able to alert users if things go wrong and when the problem is resolved. Nagios was created Ethen Galstad and a group of developers, and was initially released in March 14, 1999&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before installing Nagios, we need to once again check the version&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This guide is intended for 14.04 ubuntu servers, so if you are higher or lower, upgrade/downgrade appropriately. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installing Nagios is a easier said than done, because it needs alot of stuff in advanced, like a LAMP base.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Doing these commands will install Apache, MYSQL and PHP, which are needed for Nagios functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apache2&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install mysql-server php5-mysql&lt;br /&gt;
&lt;br /&gt;
sudo mysql_install_db&lt;br /&gt;
&lt;br /&gt;
sudo mysql_secure_installation&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache2 a bit, go into &amp;lt;code&amp;gt; /etc/apache2/mods-enabled/dir.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change this line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into this line by moving index.php ahead of index.html.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that just restart Apache service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service apache2 restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now we need to make a user and group who will be dealing with using Nagios.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo useradd nagios&lt;br /&gt;
&lt;br /&gt;
sudo groupadd nagcmd&lt;br /&gt;
&lt;br /&gt;
sudo usermod -a -G nagcmd nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;We can almost move to building the Nagios Core, but first we need a few dependencies.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install build-essential libgd2-xpm-dev openssl libssl-dev xinetd apache2-utils unzip&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;Now to finally install Nagios itself&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-4.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;Move to the newly created folder and type these commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-group=nagios --with-command-group=nagcmd&lt;br /&gt;
 &lt;br /&gt;
make all &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That final command compiled Nagios, but its not fully done just yet. We still need a few more things to install on it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-commandmode&lt;br /&gt;
&lt;br /&gt;
sudo make install-init&lt;br /&gt;
&lt;br /&gt;
sudo make install-config&lt;br /&gt;
&lt;br /&gt;
sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;To be able to issue external commands trough the web interface of Nagios, we need to add the web server user into the nagios group&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo usermod -G nagcmd www-data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;We will also need Nagios Plugins and NRPE, which are installed in the same fashion as Nagios Core&lt;br /&gt;
&lt;br /&gt;
Nagios Plugins:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-plugins-2.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NRPE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nrpe-2.15.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Building NRPE, needs its xinetd startup script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;make all&lt;br /&gt;
&lt;br /&gt;
sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-xinetd&lt;br /&gt;
&lt;br /&gt;
sudo make install-daemon-config&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;We also need to open up the xinetd script in &amp;lt;code&amp;gt;/etc/xinetd.d/nrpe&amp;lt;/code&amp;gt; and add the Nagios servers private/public address to the end of it.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;only_from = 127.0.0.1 192.168.56.200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After modifying the file, restart xinetd&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service xinetd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;9)&#039;&#039;&#039;Now Nagios is fully installed, but still needs more configuring.&lt;br /&gt;
&lt;br /&gt;
Lets start off by going into this file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/nagios.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncommenting this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#cfg_dir=/usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now create the directory that will store the configuration file for each server that you will monitor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;10)&#039;&#039;&#039;Lets also add a command to NRPE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/objects/commands.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the following to the end of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define command{&lt;br /&gt;
        command_name check_nrpe&lt;br /&gt;
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache aswell, so lets enable Apache rewrite and cgi modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
sudo a2enmod cgi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use htpasswd to create an admin user, called &amp;quot;nagiosadmin&amp;quot;, that will be used in getting access to the web interface.&lt;br /&gt;
Set a password when prompted by the command, this username and password will be the main login credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally lets make a symlink between the nagios configuration file and the Apache sites-enabled directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ln -s /etc/apache2/sites-available/nagios.conf /etc/apache2/sites-enabled/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;11)&#039;&#039;&#039;And thats it, Nagios is ready to be started up, just restart the service and add Nagios to start on server booting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios start&lt;br /&gt;
&lt;br /&gt;
sudo service apache2 restart&lt;br /&gt;
&lt;br /&gt;
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats all, now you have a fully (hopefully) working Nagios thanks to following these steps.&lt;br /&gt;
&lt;br /&gt;
You can access the webinterface by going here: &amp;lt;code&amp;gt;http://nagios_server_public_ip/nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;12)&#039;&#039;&#039;But lets not stop there, lets try adding something for Nagios to keep an eye on. To do this, lets swap over to another machine that is in the same network as the Nagios server.&lt;br /&gt;
&lt;br /&gt;
On this other machine, lets install NRPE, it will be needed to make Nagios work on the new machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install nagios-plugins nagios-nrpe-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once NRPE is installed, lets go into the configuration file once again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the nagios server ip to the end of the &amp;lt;code&amp;gt;allowed_hosts=127.0.0.1,&amp;lt;/code&amp;gt; segment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;13)&#039;&#039;&#039;As an example, lets monitor one of our filesystems.&lt;br /&gt;
&lt;br /&gt;
Lets look up the filesystems that we have.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;df -h /&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go back into the NRPE configuration file in &amp;lt;code&amp;gt;/etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt; and change these three lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;server_address=client_private_IP&lt;br /&gt;
allowed_hosts=nagios_server_private_IP (you already set this earlier)&lt;br /&gt;
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p (filesystem that you chose)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dont forget to restart the NRPE service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios-nrpe-server restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14)&#039;&#039;&#039;After all that is done, its time to head back to the machine with the actual Nagios server and the new Host into the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/servers/yourhost.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this file, you need to add this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define host {&lt;br /&gt;
        use                             linux-server&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        alias                           My first Apache server&lt;br /&gt;
        address                         10.132.234.52 (changeme)&lt;br /&gt;
        max_check_attempts              5&lt;br /&gt;
        check_period                    24x7&lt;br /&gt;
        notification_interval           30&lt;br /&gt;
        notification_period             24x7&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
define service {&lt;br /&gt;
        use                             generic-service&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        service_description             PING&lt;br /&gt;
        check_command                   check_ping!100.0,20%!500.0,60%&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always restart services after major changes!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And thats all folks! Now if you were to look at your Nagios web interface, you would be able to see the new host you just added, and also a service tied to said host.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Graylong and Nagios are rather easy to install, albeit a bit time consuming and confusing. But they are still very good services in regards to Logging and Monitoring things.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
http://docs.graylog.org/en/2.1/pages/installation/os/ubuntu.html&lt;br /&gt;
&lt;br /&gt;
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04&lt;br /&gt;
&lt;br /&gt;
https://www.digitalocean.com/community/tutorials/how-to-install-nagios-4-and-monitor-your-servers-on-ubuntu-14-04#configure-nagios&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116338</id>
		<title>Graylog&amp;Nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116338"/>
		<updated>2017-01-04T20:43:51Z</updated>

		<summary type="html">&lt;p&gt;Mhass: /* Graylog */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Logging and Monitoring - Graylog and Nagios installation.&lt;br /&gt;
&lt;br /&gt;
Group : Cyber Security Engineering (C21).&lt;br /&gt;
&lt;br /&gt;
Page created by Meelis Hass.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
In this page, I will show how a person can easily install and configure a good logging and monitoring solution into their systems and networks. My choices for this task are Graylog and Nagios.&lt;br /&gt;
&lt;br /&gt;
= Graylog =&lt;br /&gt;
&lt;br /&gt;
Graylog is currently the most popular open-source logging solution. It&#039;s plus sides, are that it is able to work with unstructured logs from anywhere, is free and open source and is easy to install.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now before we begin installing Graylog, we should check what version the machine is actully running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is because this guide is intended for 16.04 version of Ubuntu, If you do already have it, skip to actual installation. People who need to upgrade just continue with the following commands.&lt;br /&gt;
&lt;br /&gt;
Next lets upgrade our machine.&lt;br /&gt;
&lt;br /&gt;
*Start off by updating your package list&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Next lets upgrade everything&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then fix the dependencies with this&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get dist-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*And finish off by finishing the upgrade&lt;br /&gt;
&amp;lt;code&amp;gt; sudo do-release-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to the actual meat of the guide, installing graylog. But we cant just jump into installing Graylog itself, because it needs a few services and a setup base to run it, like Elasticsearch and MongoDB.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Starting off with the setup base.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apt-transport-https openjdk-8-jre-headless uuid-runtime pwgen &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now lets install MongoDB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install mongodb-server &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;Installing Elasticsearch takes a few more commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo &amp;quot;deb https://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install elasticsearch &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;We still need to configure Elasticsearch a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; nano /etc/elasticsearch/elasticsearch.yml &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncomment and change this line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cluster.name: graylog &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;After that, just start the service&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable elasticsearch.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl restart elasticsearch.service &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;Now we actully start installing Graylog itself! Start off by getting the required packages and then installing them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget https://packages.graylog2.org/repo/packages/graylog-2.1-repository_latest.deb &lt;br /&gt;
&lt;br /&gt;
sudo dpkg -i graylog-2.1-repository_latest.deb&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install graylog-server&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;After installing Graylog, we need to add a few extra parts into the configuration file, mainly passwords.&lt;br /&gt;
&lt;br /&gt;
This will generate a password and a sha256sum for it. Do note that the password is required and &#039;&#039;&#039;MUST&#039;&#039;&#039; be 16 characters or longer, otherwise Graylog refuses to function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo -n yourpassword | sha256sum &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The password must be put into &amp;lt;code&amp;gt; /etc/graylog/server/server.conf&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
While in the configuration file, also add your public ip with correct ports into &amp;lt;code&amp;gt; rest_listen_uri &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; web_listen_uri &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;Final steps to enable Graylog.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable graylog-server.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl start graylog-server.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there you have it, one fully installed Graylog, ready for all your logging needs!.&lt;br /&gt;
&lt;br /&gt;
After this, you can explore the web interface at the public ip address you set before and start logging whatever you want.&lt;br /&gt;
&lt;br /&gt;
= Nagios =&lt;br /&gt;
&lt;br /&gt;
Nagios is a free open source application that is used to monitor systems and networks. Nagios is able to alert users if things go wrong and when the problem is resolved. Nagios was created Ethen Galstad and a group of developers, and was initially released in March 14, 1999&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before installing Nagios, we need to once again check the version&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This guide is intended for 14.04 ubuntu servers, so if you are higher or lower, upgrade/downgrade appropriately. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installing Nagios is a easier said than done, because it needs alot of stuff in advanced, like a LAMP base.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Doing these commands will install Apache, MYSQL and PHP, which are needed for Nagios functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apache2&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install mysql-server php5-mysql&lt;br /&gt;
&lt;br /&gt;
sudo mysql_install_db&lt;br /&gt;
&lt;br /&gt;
sudo mysql_secure_installation&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache2 a bit, go into &amp;lt;code&amp;gt; /etc/apache2/mods-enabled/dir.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change this line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into this line by moving index.php ahead of index.html.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that just restart Apache service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service apache2 restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now we need to make a user and group who will be dealing with using Nagios.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo useradd nagios&lt;br /&gt;
&lt;br /&gt;
sudo groupadd nagcmd&lt;br /&gt;
&lt;br /&gt;
sudo usermod -a -G nagcmd nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;We can almost move to building the Nagios Core, but first we need a few dependencies.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install build-essential libgd2-xpm-dev openssl libssl-dev xinetd apache2-utils unzip&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;Now to finally install Nagios itself&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-4.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;Move to the newly created folder and type these commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-group=nagios --with-command-group=nagcmd&lt;br /&gt;
 &lt;br /&gt;
make all &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That final command compiled Nagios, but its not fully done just yet. We still need a few more things to install on it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-commandmode&lt;br /&gt;
&lt;br /&gt;
sudo make install-init&lt;br /&gt;
&lt;br /&gt;
sudo make install-config&lt;br /&gt;
&lt;br /&gt;
sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;To be able to issue external commands trough the web interface of Nagios, we need to add the web server user into the nagios group&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo usermod -G nagcmd www-data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;We will also need Nagios Plugins and NRPE, which are installed in the same fashion as Nagios Core&lt;br /&gt;
&lt;br /&gt;
Nagios Plugins:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-plugins-2.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NRPE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nrpe-2.15.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Building NRPE, needs its xinetd startup script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;make all&lt;br /&gt;
&lt;br /&gt;
sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-xinetd&lt;br /&gt;
&lt;br /&gt;
sudo make install-daemon-config&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;We also need to open up the xinetd script in &amp;lt;code&amp;gt;/etc/xinetd.d/nrpe&amp;lt;/code&amp;gt; and add the Nagios servers private/public address to the end of it.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;only_from = 127.0.0.1 192.168.56.200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After modifying the file, restart xinetd&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service xinetd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;9)&#039;&#039;&#039;Now Nagios is fully installed, but still needs more configuring.&lt;br /&gt;
&lt;br /&gt;
Lets start off by going into this file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/nagios.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncommenting this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#cfg_dir=/usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now create the directory that will store the configuration file for each server that you will monitor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;10)&#039;&#039;&#039;Lets also add a command to NRPE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/objects/commands.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the following to the end of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define command{&lt;br /&gt;
        command_name check_nrpe&lt;br /&gt;
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache aswell, so lets enable Apache rewrite and cgi modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
sudo a2enmod cgi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use htpasswd to create an admin user, called &amp;quot;nagiosadmin&amp;quot;, that will be used in getting access to the web interface.&lt;br /&gt;
Set a password when prompted by the command, this username and password will be the main login credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally lets make a symlink between the nagios configuration file and the Apache sites-enabled directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ln -s /etc/apache2/sites-available/nagios.conf /etc/apache2/sites-enabled/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;11)&#039;&#039;&#039;And thats it, Nagios is ready to be started up, just restart the service and add Nagios to start on server booting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios start&lt;br /&gt;
&lt;br /&gt;
sudo service apache2 restart&lt;br /&gt;
&lt;br /&gt;
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats all, now you have a fully (hopefully) working Nagios thanks to following these steps.&lt;br /&gt;
&lt;br /&gt;
You can access the webinterface by going here: &amp;lt;code&amp;gt;http://nagios_server_public_ip/nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;12)&#039;&#039;&#039;But lets not stop there, lets try adding something for Nagios to keep an eye on. To do this, lets swap over to another machine that is in the same network as the Nagios server.&lt;br /&gt;
&lt;br /&gt;
On this other machine, lets install NRPE, it will be needed to make Nagios work on the new machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install nagios-plugins nagios-nrpe-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once NRPE is installed, lets go into the configuration file once again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the nagios server ip to the end of the &amp;lt;code&amp;gt;allowed_hosts=127.0.0.1,&amp;lt;/code&amp;gt; segment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;13)&#039;&#039;&#039;As an example, lets monitor one of our filesystems.&lt;br /&gt;
&lt;br /&gt;
Lets look up the filesystems that we have.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;df -h /&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go back into the NRPE configuration file in &amp;lt;code&amp;gt;/etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt; and change these three lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;server_address=client_private_IP&lt;br /&gt;
allowed_hosts=nagios_server_private_IP (you already set this earlier)&lt;br /&gt;
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p (filesystem that you chose)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dont forget to restart the NRPE service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios-nrpe-server restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14)&#039;&#039;&#039;After all that is done, its time to head back to the machine with the actual Nagios server and the new Host into the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/servers/yourhost.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this file, you need to add this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define host {&lt;br /&gt;
        use                             linux-server&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        alias                           My first Apache server&lt;br /&gt;
        address                         10.132.234.52 (changeme)&lt;br /&gt;
        max_check_attempts              5&lt;br /&gt;
        check_period                    24x7&lt;br /&gt;
        notification_interval           30&lt;br /&gt;
        notification_period             24x7&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
define service {&lt;br /&gt;
        use                             generic-service&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        service_description             PING&lt;br /&gt;
        check_command                   check_ping!100.0,20%!500.0,60%&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always restart services after major changes!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And thats all folks! Now if you were to look at your Nagios web interface, you would be able to see the new host you just added, and also a service tied to said host.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Graylong and Nagios are rather easy to install, albeit a bit time consuming and confusing. But they are still very good services in regards to Logging and Monitoring things.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
http://docs.graylog.org/en/2.1/pages/installation/os/ubuntu.html&lt;br /&gt;
&lt;br /&gt;
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04&lt;br /&gt;
&lt;br /&gt;
https://www.digitalocean.com/community/tutorials/how-to-install-nagios-4-and-monitor-your-servers-on-ubuntu-14-04#configure-nagios&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116337</id>
		<title>Graylog&amp;Nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116337"/>
		<updated>2017-01-04T20:41:04Z</updated>

		<summary type="html">&lt;p&gt;Mhass: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Logging and Monitoring - Graylog and Nagios installation.&lt;br /&gt;
&lt;br /&gt;
Group : Cyber Security Engineering (C21).&lt;br /&gt;
&lt;br /&gt;
Page created by Meelis Hass.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
In this page, I will show how a person can easily install and configure a good logging and monitoring solution into their systems and networks. My choices for this task are Graylog and Nagios.&lt;br /&gt;
&lt;br /&gt;
= Graylog =&lt;br /&gt;
&lt;br /&gt;
Graylog is currently the most popular open-source logging solution. It&#039;s plus sides, are that it is able to work with unstructured logs from&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now before we begin installing Graylog, we should check what version the machine is actully running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is because this guide is intended for 16.04 version of Ubuntu, If you do already have it, skip to actual installation. People who need to upgrade just continue with the following commands.&lt;br /&gt;
&lt;br /&gt;
Next lets upgrade our machine.&lt;br /&gt;
&lt;br /&gt;
*Start off by updating your package list&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Next lets upgrade everything&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then fix the dependencies with this&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get dist-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*And finish off by finishing the upgrade&lt;br /&gt;
&amp;lt;code&amp;gt; sudo do-release-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to the actual meat of the guide, installing graylog. But we cant just jump into installing Graylog itself, because it needs a few services and a setup base to run it, like Elasticsearch and MongoDB.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Starting off with the setup base.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apt-transport-https openjdk-8-jre-headless uuid-runtime pwgen &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now lets install MongoDB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install mongodb-server &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;Installing Elasticsearch takes a few more commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo &amp;quot;deb https://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install elasticsearch &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;We still need to configure Elasticsearch a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; nano /etc/elasticsearch/elasticsearch.yml &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncomment and change this line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cluster.name: graylog &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;After that, just start the service&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable elasticsearch.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl restart elasticsearch.service &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;Now we actully start installing Graylog itself! Start off by getting the required packages and then installing them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget https://packages.graylog2.org/repo/packages/graylog-2.1-repository_latest.deb &lt;br /&gt;
&lt;br /&gt;
sudo dpkg -i graylog-2.1-repository_latest.deb&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install graylog-server&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;After installing Graylog, we need to add a few extra parts into the configuration file, mainly passwords.&lt;br /&gt;
&lt;br /&gt;
This will generate a password and a sha256sum for it. Do note that the password is required and &#039;&#039;&#039;MUST&#039;&#039;&#039; be 16 characters or longer, otherwise Graylog refuses to function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo -n yourpassword | sha256sum &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The password must be put into &amp;lt;code&amp;gt; /etc/graylog/server/server.conf&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
While in the configuration file, also add your public ip with correct ports into &amp;lt;code&amp;gt; rest_listen_uri &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; web_listen_uri &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;Final steps to enable Graylog.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable graylog-server.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl start graylog-server.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there you have it, one fully installed Graylog, ready for all your logging needs!.&lt;br /&gt;
&lt;br /&gt;
After this, you can explore the web interface at the public ip address you set before and start logging whatever you want.&lt;br /&gt;
&lt;br /&gt;
= Nagios =&lt;br /&gt;
&lt;br /&gt;
Nagios is a free open source application that is used to monitor systems and networks. Nagios is able to alert users if things go wrong and when the problem is resolved. Nagios was created Ethen Galstad and a group of developers, and was initially released in March 14, 1999&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before installing Nagios, we need to once again check the version&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This guide is intended for 14.04 ubuntu servers, so if you are higher or lower, upgrade/downgrade appropriately. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installing Nagios is a easier said than done, because it needs alot of stuff in advanced, like a LAMP base.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Doing these commands will install Apache, MYSQL and PHP, which are needed for Nagios functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apache2&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install mysql-server php5-mysql&lt;br /&gt;
&lt;br /&gt;
sudo mysql_install_db&lt;br /&gt;
&lt;br /&gt;
sudo mysql_secure_installation&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache2 a bit, go into &amp;lt;code&amp;gt; /etc/apache2/mods-enabled/dir.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change this line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into this line by moving index.php ahead of index.html.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that just restart Apache service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service apache2 restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now we need to make a user and group who will be dealing with using Nagios.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo useradd nagios&lt;br /&gt;
&lt;br /&gt;
sudo groupadd nagcmd&lt;br /&gt;
&lt;br /&gt;
sudo usermod -a -G nagcmd nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;We can almost move to building the Nagios Core, but first we need a few dependencies.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install build-essential libgd2-xpm-dev openssl libssl-dev xinetd apache2-utils unzip&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;Now to finally install Nagios itself&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-4.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;Move to the newly created folder and type these commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-group=nagios --with-command-group=nagcmd&lt;br /&gt;
 &lt;br /&gt;
make all &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That final command compiled Nagios, but its not fully done just yet. We still need a few more things to install on it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-commandmode&lt;br /&gt;
&lt;br /&gt;
sudo make install-init&lt;br /&gt;
&lt;br /&gt;
sudo make install-config&lt;br /&gt;
&lt;br /&gt;
sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;To be able to issue external commands trough the web interface of Nagios, we need to add the web server user into the nagios group&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo usermod -G nagcmd www-data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;We will also need Nagios Plugins and NRPE, which are installed in the same fashion as Nagios Core&lt;br /&gt;
&lt;br /&gt;
Nagios Plugins:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-plugins-2.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NRPE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nrpe-2.15.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Building NRPE, needs its xinetd startup script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;make all&lt;br /&gt;
&lt;br /&gt;
sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-xinetd&lt;br /&gt;
&lt;br /&gt;
sudo make install-daemon-config&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;We also need to open up the xinetd script in &amp;lt;code&amp;gt;/etc/xinetd.d/nrpe&amp;lt;/code&amp;gt; and add the Nagios servers private/public address to the end of it.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;only_from = 127.0.0.1 192.168.56.200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After modifying the file, restart xinetd&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service xinetd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;9)&#039;&#039;&#039;Now Nagios is fully installed, but still needs more configuring.&lt;br /&gt;
&lt;br /&gt;
Lets start off by going into this file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/nagios.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncommenting this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#cfg_dir=/usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now create the directory that will store the configuration file for each server that you will monitor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;10)&#039;&#039;&#039;Lets also add a command to NRPE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/objects/commands.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the following to the end of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define command{&lt;br /&gt;
        command_name check_nrpe&lt;br /&gt;
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache aswell, so lets enable Apache rewrite and cgi modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
sudo a2enmod cgi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use htpasswd to create an admin user, called &amp;quot;nagiosadmin&amp;quot;, that will be used in getting access to the web interface.&lt;br /&gt;
Set a password when prompted by the command, this username and password will be the main login credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally lets make a symlink between the nagios configuration file and the Apache sites-enabled directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ln -s /etc/apache2/sites-available/nagios.conf /etc/apache2/sites-enabled/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;11)&#039;&#039;&#039;And thats it, Nagios is ready to be started up, just restart the service and add Nagios to start on server booting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios start&lt;br /&gt;
&lt;br /&gt;
sudo service apache2 restart&lt;br /&gt;
&lt;br /&gt;
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats all, now you have a fully (hopefully) working Nagios thanks to following these steps.&lt;br /&gt;
&lt;br /&gt;
You can access the webinterface by going here: &amp;lt;code&amp;gt;http://nagios_server_public_ip/nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;12)&#039;&#039;&#039;But lets not stop there, lets try adding something for Nagios to keep an eye on. To do this, lets swap over to another machine that is in the same network as the Nagios server.&lt;br /&gt;
&lt;br /&gt;
On this other machine, lets install NRPE, it will be needed to make Nagios work on the new machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install nagios-plugins nagios-nrpe-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once NRPE is installed, lets go into the configuration file once again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the nagios server ip to the end of the &amp;lt;code&amp;gt;allowed_hosts=127.0.0.1,&amp;lt;/code&amp;gt; segment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;13)&#039;&#039;&#039;As an example, lets monitor one of our filesystems.&lt;br /&gt;
&lt;br /&gt;
Lets look up the filesystems that we have.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;df -h /&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go back into the NRPE configuration file in &amp;lt;code&amp;gt;/etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt; and change these three lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;server_address=client_private_IP&lt;br /&gt;
allowed_hosts=nagios_server_private_IP (you already set this earlier)&lt;br /&gt;
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p (filesystem that you chose)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dont forget to restart the NRPE service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios-nrpe-server restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14)&#039;&#039;&#039;After all that is done, its time to head back to the machine with the actual Nagios server and the new Host into the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/servers/yourhost.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this file, you need to add this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define host {&lt;br /&gt;
        use                             linux-server&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        alias                           My first Apache server&lt;br /&gt;
        address                         10.132.234.52 (changeme)&lt;br /&gt;
        max_check_attempts              5&lt;br /&gt;
        check_period                    24x7&lt;br /&gt;
        notification_interval           30&lt;br /&gt;
        notification_period             24x7&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
define service {&lt;br /&gt;
        use                             generic-service&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        service_description             PING&lt;br /&gt;
        check_command                   check_ping!100.0,20%!500.0,60%&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always restart services after major changes!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And thats all folks! Now if you were to look at your Nagios web interface, you would be able to see the new host you just added, and also a service tied to said host.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Graylong and Nagios are rather easy to install, albeit a bit time consuming and confusing. But they are still very good services in regards to Logging and Monitoring things.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
http://docs.graylog.org/en/2.1/pages/installation/os/ubuntu.html&lt;br /&gt;
&lt;br /&gt;
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04&lt;br /&gt;
&lt;br /&gt;
https://www.digitalocean.com/community/tutorials/how-to-install-nagios-4-and-monitor-your-servers-on-ubuntu-14-04#configure-nagios&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116336</id>
		<title>Graylog&amp;Nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116336"/>
		<updated>2017-01-04T20:40:57Z</updated>

		<summary type="html">&lt;p&gt;Mhass: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Logging and Monitoring - Graylog and Nagios installation.&lt;br /&gt;
&lt;br /&gt;
Group : Cyber Security Engineering (C21).&lt;br /&gt;
&lt;br /&gt;
Page created by Meelis Hass.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
In this page, I will show how a person can easily install and configure a good logging and monitoring solution into their systems and networks. My choices for this task are Graylog and Nagios.&lt;br /&gt;
&lt;br /&gt;
= Graylog =&lt;br /&gt;
&lt;br /&gt;
Graylog is currently the most popular open-source logging solution. It&#039;s plus sides, are that it is able to work with unstructured logs from&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now before we begin installing Graylog, we should check what version the machine is actully running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is because this guide is intended for 16.04 version of Ubuntu, If you do already have it, skip to actual installation. People who need to upgrade just continue with the following commands.&lt;br /&gt;
&lt;br /&gt;
Next lets upgrade our machine.&lt;br /&gt;
&lt;br /&gt;
*Start off by updating your package list&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Next lets upgrade everything&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then fix the dependencies with this&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get dist-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*And finish off by finishing the upgrade&lt;br /&gt;
&amp;lt;code&amp;gt; sudo do-release-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to the actual meat of the guide, installing graylog. But we cant just jump into installing Graylog itself, because it needs a few services and a setup base to run it, like Elasticsearch and MongoDB.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Starting off with the setup base.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apt-transport-https openjdk-8-jre-headless uuid-runtime pwgen &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now lets install MongoDB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install mongodb-server &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;Installing Elasticsearch takes a few more commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo &amp;quot;deb https://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install elasticsearch &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;We still need to configure Elasticsearch a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; nano /etc/elasticsearch/elasticsearch.yml &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncomment and change this line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cluster.name: graylog &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;After that, just start the service&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable elasticsearch.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl restart elasticsearch.service &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;Now we actully start installing Graylog itself! Start off by getting the required packages and then installing them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget https://packages.graylog2.org/repo/packages/graylog-2.1-repository_latest.deb &lt;br /&gt;
&lt;br /&gt;
sudo dpkg -i graylog-2.1-repository_latest.deb&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install graylog-server&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;After installing Graylog, we need to add a few extra parts into the configuration file, mainly passwords.&lt;br /&gt;
&lt;br /&gt;
This will generate a password and a sha256sum for it. Do note that the password is required and &#039;&#039;&#039;MUST&#039;&#039;&#039; be 16 characters or longer, otherwise Graylog refuses to function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo -n yourpassword | sha256sum &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The password must be put into &amp;lt;code&amp;gt; /etc/graylog/server/server.conf&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
While in the configuration file, also add your public ip with correct ports into &amp;lt;code&amp;gt; rest_listen_uri &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; web_listen_uri &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;Final steps to enable Graylog.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable graylog-server.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl start graylog-server.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there you have it, one fully installed Graylog, ready for all your logging needs!.&lt;br /&gt;
&lt;br /&gt;
After this, you can explore the web interface at the public ip address you set before and start logging whatever you want.&lt;br /&gt;
&lt;br /&gt;
= Nagios =&lt;br /&gt;
&lt;br /&gt;
Nagios is a free open source application that is used to monitor systems and networks. Nagios is able to alert users if things go wrong and when the problem is resolved. Nagios was created Ethen Galstad and a group of developers, and was initially released in March 14, 1999&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before installing Nagios, we need to once again check the version&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This guide is intended for 14.04 ubuntu servers, so if you are higher or lower, upgrade/downgrade appropriately. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installing Nagios is a easier said than done, because it needs alot of stuff in advanced, like a LAMP base.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Doing these commands will install Apache, MYSQL and PHP, which are needed for Nagios functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apache2&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install mysql-server php5-mysql&lt;br /&gt;
&lt;br /&gt;
sudo mysql_install_db&lt;br /&gt;
&lt;br /&gt;
sudo mysql_secure_installation&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache2 a bit, go into &amp;lt;code&amp;gt; /etc/apache2/mods-enabled/dir.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change this line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into this line by moving index.php ahead of index.html.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that just restart Apache service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service apache2 restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now we need to make a user and group who will be dealing with using Nagios.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo useradd nagios&lt;br /&gt;
&lt;br /&gt;
sudo groupadd nagcmd&lt;br /&gt;
&lt;br /&gt;
sudo usermod -a -G nagcmd nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;We can almost move to building the Nagios Core, but first we need a few dependencies.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install build-essential libgd2-xpm-dev openssl libssl-dev xinetd apache2-utils unzip&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;Now to finally install Nagios itself&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-4.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;Move to the newly created folder and type these commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-group=nagios --with-command-group=nagcmd&lt;br /&gt;
 &lt;br /&gt;
make all &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That final command compiled Nagios, but its not fully done just yet. We still need a few more things to install on it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-commandmode&lt;br /&gt;
&lt;br /&gt;
sudo make install-init&lt;br /&gt;
&lt;br /&gt;
sudo make install-config&lt;br /&gt;
&lt;br /&gt;
sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;To be able to issue external commands trough the web interface of Nagios, we need to add the web server user into the nagios group&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo usermod -G nagcmd www-data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;We will also need Nagios Plugins and NRPE, which are installed in the same fashion as Nagios Core&lt;br /&gt;
&lt;br /&gt;
Nagios Plugins:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-plugins-2.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NRPE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nrpe-2.15.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Building NRPE, needs its xinetd startup script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;make all&lt;br /&gt;
&lt;br /&gt;
sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-xinetd&lt;br /&gt;
&lt;br /&gt;
sudo make install-daemon-config&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;We also need to open up the xinetd script in &amp;lt;code&amp;gt;/etc/xinetd.d/nrpe&amp;lt;/code&amp;gt; and add the Nagios servers private/public address to the end of it.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;only_from = 127.0.0.1 192.168.56.200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After modifying the file, restart xinetd&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service xinetd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;9)&#039;&#039;&#039;Now Nagios is fully installed, but still needs more configuring.&lt;br /&gt;
&lt;br /&gt;
Lets start off by going into this file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/nagios.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncommenting this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#cfg_dir=/usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now create the directory that will store the configuration file for each server that you will monitor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;10)&#039;&#039;&#039;Lets also add a command to NRPE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/objects/commands.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the following to the end of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define command{&lt;br /&gt;
        command_name check_nrpe&lt;br /&gt;
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache aswell, so lets enable Apache rewrite and cgi modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
sudo a2enmod cgi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use htpasswd to create an admin user, called &amp;quot;nagiosadmin&amp;quot;, that will be used in getting access to the web interface.&lt;br /&gt;
Set a password when prompted by the command, this username and password will be the main login credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally lets make a symlink between the nagios configuration file and the Apache sites-enabled directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ln -s /etc/apache2/sites-available/nagios.conf /etc/apache2/sites-enabled/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;11)&#039;&#039;&#039;And thats it, Nagios is ready to be started up, just restart the service and add Nagios to start on server booting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios start&lt;br /&gt;
&lt;br /&gt;
sudo service apache2 restart&lt;br /&gt;
&lt;br /&gt;
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats all, now you have a fully (hopefully) working Nagios thanks to following these steps.&lt;br /&gt;
&lt;br /&gt;
You can access the webinterface by going here: &amp;lt;code&amp;gt;http://nagios_server_public_ip/nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;12)&#039;&#039;&#039;But lets not stop there, lets try adding something for Nagios to keep an eye on. To do this, lets swap over to another machine that is in the same network as the Nagios server.&lt;br /&gt;
&lt;br /&gt;
On this other machine, lets install NRPE, it will be needed to make Nagios work on the new machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install nagios-plugins nagios-nrpe-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once NRPE is installed, lets go into the configuration file once again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the nagios server ip to the end of the &amp;lt;code&amp;gt;allowed_hosts=127.0.0.1,&amp;lt;/code&amp;gt; segment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;13)&#039;&#039;&#039;As an example, lets monitor one of our filesystems.&lt;br /&gt;
&lt;br /&gt;
Lets look up the filesystems that we have.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;df -h /&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go back into the NRPE configuration file in &amp;lt;code&amp;gt;/etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt; and change these three lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;server_address=client_private_IP&lt;br /&gt;
allowed_hosts=nagios_server_private_IP (you already set this earlier)&lt;br /&gt;
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p (filesystem that you chose)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dont forget to restart the NRPE service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios-nrpe-server restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14)&#039;&#039;&#039;After all that is done, its time to head back to the machine with the actual Nagios server and the new Host into the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/servers/yourhost.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this file, you need to add this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define host {&lt;br /&gt;
        use                             linux-server&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        alias                           My first Apache server&lt;br /&gt;
        address                         10.132.234.52 (changeme)&lt;br /&gt;
        max_check_attempts              5&lt;br /&gt;
        check_period                    24x7&lt;br /&gt;
        notification_interval           30&lt;br /&gt;
        notification_period             24x7&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
define service {&lt;br /&gt;
        use                             generic-service&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        service_description             PING&lt;br /&gt;
        check_command                   check_ping!100.0,20%!500.0,60%&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always restart services after major changes!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And thats all folks! Now if you were to look at your Nagios web interface, you would be able to see the new host you just added, and also a service tied to said host.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Graylong and Nagios are rather easy to install, albeit a bit time consuming and confusing. But they are still very good services in regards to Logging and Monitoring things.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
http://docs.graylog.org/en/2.1/pages/installation/os/ubuntu.html&lt;br /&gt;
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04&lt;br /&gt;
https://www.digitalocean.com/community/tutorials/how-to-install-nagios-4-and-monitor-your-servers-on-ubuntu-14-04#configure-nagios&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116335</id>
		<title>Graylog&amp;Nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116335"/>
		<updated>2017-01-04T20:40:39Z</updated>

		<summary type="html">&lt;p&gt;Mhass: /* Graylog */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Logging and Monitoring - Graylog and Nagios installation.&lt;br /&gt;
&lt;br /&gt;
Group : Cyber Security Engineering (C21).&lt;br /&gt;
&lt;br /&gt;
Page created by Meelis Hass.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
In this page, I will show how a person can easily install and configure a good logging and monitoring solution into their systems and networks. My choices for this task are Graylog and Nagios.&lt;br /&gt;
&lt;br /&gt;
= Graylog =&lt;br /&gt;
&lt;br /&gt;
Graylog is currently the most popular open-source logging solution. It&#039;s plus sides, are that it is able to work with unstructured logs from&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now before we begin installing Graylog, we should check what version the machine is actully running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is because this guide is intended for 16.04 version of Ubuntu, If you do already have it, skip to actual installation. People who need to upgrade just continue with the following commands.&lt;br /&gt;
&lt;br /&gt;
Next lets upgrade our machine.&lt;br /&gt;
&lt;br /&gt;
*Start off by updating your package list&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Next lets upgrade everything&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then fix the dependencies with this&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get dist-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*And finish off by finishing the upgrade&lt;br /&gt;
&amp;lt;code&amp;gt; sudo do-release-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to the actual meat of the guide, installing graylog. But we cant just jump into installing Graylog itself, because it needs a few services and a setup base to run it, like Elasticsearch and MongoDB.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Starting off with the setup base.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apt-transport-https openjdk-8-jre-headless uuid-runtime pwgen &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now lets install MongoDB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install mongodb-server &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;Installing Elasticsearch takes a few more commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo &amp;quot;deb https://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install elasticsearch &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;We still need to configure Elasticsearch a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; nano /etc/elasticsearch/elasticsearch.yml &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncomment and change this line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cluster.name: graylog &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;After that, just start the service&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable elasticsearch.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl restart elasticsearch.service &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;Now we actully start installing Graylog itself! Start off by getting the required packages and then installing them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget https://packages.graylog2.org/repo/packages/graylog-2.1-repository_latest.deb &lt;br /&gt;
&lt;br /&gt;
sudo dpkg -i graylog-2.1-repository_latest.deb&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install graylog-server&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;After installing Graylog, we need to add a few extra parts into the configuration file, mainly passwords.&lt;br /&gt;
&lt;br /&gt;
This will generate a password and a sha256sum for it. Do note that the password is required and &#039;&#039;&#039;MUST&#039;&#039;&#039; be 16 characters or longer, otherwise Graylog refuses to function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo -n yourpassword | sha256sum &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The password must be put into &amp;lt;code&amp;gt; /etc/graylog/server/server.conf&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
While in the configuration file, also add your public ip with correct ports into &amp;lt;code&amp;gt; rest_listen_uri &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; web_listen_uri &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;Final steps to enable Graylog.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable graylog-server.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl start graylog-server.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there you have it, one fully installed Graylog, ready for all your logging needs!.&lt;br /&gt;
&lt;br /&gt;
After this, you can explore the web interface at the public ip address you set before and start logging whatever you want.&lt;br /&gt;
&lt;br /&gt;
= Nagios =&lt;br /&gt;
&lt;br /&gt;
Nagios is a free open source application that is used to monitor systems and networks. Nagios is able to alert users if things go wrong and when the problem is resolved. Nagios was created Ethen Galstad and a group of developers, and was initially released in March 14, 1999&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before installing Nagios, we need to once again check the version&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This guide is intended for 14.04 ubuntu servers, so if you are higher or lower, upgrade/downgrade appropriately. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installing Nagios is a easier said than done, because it needs alot of stuff in advanced, like a LAMP base.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Doing these commands will install Apache, MYSQL and PHP, which are needed for Nagios functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apache2&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install mysql-server php5-mysql&lt;br /&gt;
&lt;br /&gt;
sudo mysql_install_db&lt;br /&gt;
&lt;br /&gt;
sudo mysql_secure_installation&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache2 a bit, go into &amp;lt;code&amp;gt; /etc/apache2/mods-enabled/dir.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change this line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into this line by moving index.php ahead of index.html.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that just restart Apache service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service apache2 restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now we need to make a user and group who will be dealing with using Nagios.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo useradd nagios&lt;br /&gt;
&lt;br /&gt;
sudo groupadd nagcmd&lt;br /&gt;
&lt;br /&gt;
sudo usermod -a -G nagcmd nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;We can almost move to building the Nagios Core, but first we need a few dependencies.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install build-essential libgd2-xpm-dev openssl libssl-dev xinetd apache2-utils unzip&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;Now to finally install Nagios itself&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-4.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;Move to the newly created folder and type these commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-group=nagios --with-command-group=nagcmd&lt;br /&gt;
 &lt;br /&gt;
make all &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That final command compiled Nagios, but its not fully done just yet. We still need a few more things to install on it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-commandmode&lt;br /&gt;
&lt;br /&gt;
sudo make install-init&lt;br /&gt;
&lt;br /&gt;
sudo make install-config&lt;br /&gt;
&lt;br /&gt;
sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;To be able to issue external commands trough the web interface of Nagios, we need to add the web server user into the nagios group&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo usermod -G nagcmd www-data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;We will also need Nagios Plugins and NRPE, which are installed in the same fashion as Nagios Core&lt;br /&gt;
&lt;br /&gt;
Nagios Plugins:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-plugins-2.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NRPE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nrpe-2.15.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Building NRPE, needs its xinetd startup script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;make all&lt;br /&gt;
&lt;br /&gt;
sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-xinetd&lt;br /&gt;
&lt;br /&gt;
sudo make install-daemon-config&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;We also need to open up the xinetd script in &amp;lt;code&amp;gt;/etc/xinetd.d/nrpe&amp;lt;/code&amp;gt; and add the Nagios servers private/public address to the end of it.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;only_from = 127.0.0.1 192.168.56.200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After modifying the file, restart xinetd&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service xinetd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;9)&#039;&#039;&#039;Now Nagios is fully installed, but still needs more configuring.&lt;br /&gt;
&lt;br /&gt;
Lets start off by going into this file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/nagios.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncommenting this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#cfg_dir=/usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now create the directory that will store the configuration file for each server that you will monitor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;10)&#039;&#039;&#039;Lets also add a command to NRPE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/objects/commands.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the following to the end of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define command{&lt;br /&gt;
        command_name check_nrpe&lt;br /&gt;
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache aswell, so lets enable Apache rewrite and cgi modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
sudo a2enmod cgi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use htpasswd to create an admin user, called &amp;quot;nagiosadmin&amp;quot;, that will be used in getting access to the web interface.&lt;br /&gt;
Set a password when prompted by the command, this username and password will be the main login credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally lets make a symlink between the nagios configuration file and the Apache sites-enabled directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ln -s /etc/apache2/sites-available/nagios.conf /etc/apache2/sites-enabled/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;11)&#039;&#039;&#039;And thats it, Nagios is ready to be started up, just restart the service and add Nagios to start on server booting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios start&lt;br /&gt;
&lt;br /&gt;
sudo service apache2 restart&lt;br /&gt;
&lt;br /&gt;
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats all, now you have a fully (hopefully) working Nagios thanks to following these steps.&lt;br /&gt;
&lt;br /&gt;
You can access the webinterface by going here: &amp;lt;code&amp;gt;http://nagios_server_public_ip/nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;12)&#039;&#039;&#039;But lets not stop there, lets try adding something for Nagios to keep an eye on. To do this, lets swap over to another machine that is in the same network as the Nagios server.&lt;br /&gt;
&lt;br /&gt;
On this other machine, lets install NRPE, it will be needed to make Nagios work on the new machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install nagios-plugins nagios-nrpe-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once NRPE is installed, lets go into the configuration file once again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the nagios server ip to the end of the &amp;lt;code&amp;gt;allowed_hosts=127.0.0.1,&amp;lt;/code&amp;gt; segment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;13)&#039;&#039;&#039;As an example, lets monitor one of our filesystems.&lt;br /&gt;
&lt;br /&gt;
Lets look up the filesystems that we have.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;df -h /&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go back into the NRPE configuration file in &amp;lt;code&amp;gt;/etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt; and change these three lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;server_address=client_private_IP&lt;br /&gt;
allowed_hosts=nagios_server_private_IP (you already set this earlier)&lt;br /&gt;
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p (filesystem that you chose)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dont forget to restart the NRPE service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios-nrpe-server restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14)&#039;&#039;&#039;After all that is done, its time to head back to the machine with the actual Nagios server and the new Host into the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/servers/yourhost.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this file, you need to add this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define host {&lt;br /&gt;
        use                             linux-server&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        alias                           My first Apache server&lt;br /&gt;
        address                         10.132.234.52 (changeme)&lt;br /&gt;
        max_check_attempts              5&lt;br /&gt;
        check_period                    24x7&lt;br /&gt;
        notification_interval           30&lt;br /&gt;
        notification_period             24x7&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
define service {&lt;br /&gt;
        use                             generic-service&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        service_description             PING&lt;br /&gt;
        check_command                   check_ping!100.0,20%!500.0,60%&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always restart services after major changes!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And thats all folks! Now if you were to look at your Nagios web interface, you would be able to see the new host you just added, and also a service tied to said host.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Graylong and Nagios are rather easy to install, albeit a bit time consuming and confusing. But they are still very good services in regards to Logging and Monitoring things.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116334</id>
		<title>Graylog&amp;Nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116334"/>
		<updated>2017-01-04T20:19:55Z</updated>

		<summary type="html">&lt;p&gt;Mhass: /* Nagios */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Logging and Monitoring - Graylog and Nagios installation.&lt;br /&gt;
&lt;br /&gt;
Group : Cyber Security Engineering (C21).&lt;br /&gt;
&lt;br /&gt;
Page created by Meelis Hass.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
In this page, I will show how a person can easily install and configure a good logging and monitoring solution into their systems and networks. My choices for this task are Graylog and Nagios.&lt;br /&gt;
&lt;br /&gt;
= Graylog =&lt;br /&gt;
//rohkem juttu&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now before we begin installing Graylog, we should check what version the machine is actully running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is because this guide is intended for 16.04 version of Ubuntu, If you do already have it, skip to actual installation. People who need to upgrade just continue with the following commands.&lt;br /&gt;
&lt;br /&gt;
Next lets upgrade our machine.&lt;br /&gt;
&lt;br /&gt;
*Start off by updating your package list&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Next lets upgrade everything&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then fix the dependencies with this&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get dist-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*And finish off by finishing the upgrade&lt;br /&gt;
&amp;lt;code&amp;gt; sudo do-release-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to the actual meat of the guide, installing graylog. But we cant just jump into installing Graylog itself, because it needs a few services and a setup base to run it, like Elasticsearch and MongoDB.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Starting off with the setup base.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apt-transport-https openjdk-8-jre-headless uuid-runtime pwgen &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now lets install MongoDB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install mongodb-server &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;Installing Elasticsearch takes a few more commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo &amp;quot;deb https://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install elasticsearch &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;We still need to configure Elasticsearch a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; nano /etc/elasticsearch/elasticsearch.yml &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncomment and change this line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cluster.name: graylog &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;After that, just start the service&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable elasticsearch.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl restart elasticsearch.service &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;Now we actully start installing Graylog itself! Start off by getting the required packages and then installing them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget https://packages.graylog2.org/repo/packages/graylog-2.1-repository_latest.deb &lt;br /&gt;
&lt;br /&gt;
sudo dpkg -i graylog-2.1-repository_latest.deb&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install graylog-server&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;After installing Graylog, we need to add a few extra parts into the configuration file, mainly passwords.&lt;br /&gt;
&lt;br /&gt;
This will generate a password and a sha256sum for it. Do note that the password is required and &#039;&#039;&#039;MUST&#039;&#039;&#039; be 16 characters or longer, otherwise Graylog refuses to function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo -n yourpassword | sha256sum &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The password must be put into &amp;lt;code&amp;gt; /etc/graylog/server/server.conf&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
While in the configuration file, also add your public ip with correct ports into &amp;lt;code&amp;gt; rest_listen_uri &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; web_listen_uri &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;Final steps to enable Graylog.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable graylog-server.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl start graylog-server.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there you have it, one fully installed Graylog, ready for all your logging needs!.&lt;br /&gt;
&lt;br /&gt;
After this, you can explore the web interface at the public ip address you set before and start logging whatever you want.&lt;br /&gt;
&lt;br /&gt;
= Nagios =&lt;br /&gt;
&lt;br /&gt;
Nagios is a free open source application that is used to monitor systems and networks. Nagios is able to alert users if things go wrong and when the problem is resolved. Nagios was created Ethen Galstad and a group of developers, and was initially released in March 14, 1999&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before installing Nagios, we need to once again check the version&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This guide is intended for 14.04 ubuntu servers, so if you are higher or lower, upgrade/downgrade appropriately. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installing Nagios is a easier said than done, because it needs alot of stuff in advanced, like a LAMP base.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Doing these commands will install Apache, MYSQL and PHP, which are needed for Nagios functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apache2&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install mysql-server php5-mysql&lt;br /&gt;
&lt;br /&gt;
sudo mysql_install_db&lt;br /&gt;
&lt;br /&gt;
sudo mysql_secure_installation&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache2 a bit, go into &amp;lt;code&amp;gt; /etc/apache2/mods-enabled/dir.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change this line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into this line by moving index.php ahead of index.html.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that just restart Apache service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service apache2 restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now we need to make a user and group who will be dealing with using Nagios.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo useradd nagios&lt;br /&gt;
&lt;br /&gt;
sudo groupadd nagcmd&lt;br /&gt;
&lt;br /&gt;
sudo usermod -a -G nagcmd nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;We can almost move to building the Nagios Core, but first we need a few dependencies.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install build-essential libgd2-xpm-dev openssl libssl-dev xinetd apache2-utils unzip&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;Now to finally install Nagios itself&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-4.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;Move to the newly created folder and type these commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-group=nagios --with-command-group=nagcmd&lt;br /&gt;
 &lt;br /&gt;
make all &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That final command compiled Nagios, but its not fully done just yet. We still need a few more things to install on it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-commandmode&lt;br /&gt;
&lt;br /&gt;
sudo make install-init&lt;br /&gt;
&lt;br /&gt;
sudo make install-config&lt;br /&gt;
&lt;br /&gt;
sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;To be able to issue external commands trough the web interface of Nagios, we need to add the web server user into the nagios group&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo usermod -G nagcmd www-data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;We will also need Nagios Plugins and NRPE, which are installed in the same fashion as Nagios Core&lt;br /&gt;
&lt;br /&gt;
Nagios Plugins:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-plugins-2.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NRPE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nrpe-2.15.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Building NRPE, needs its xinetd startup script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;make all&lt;br /&gt;
&lt;br /&gt;
sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-xinetd&lt;br /&gt;
&lt;br /&gt;
sudo make install-daemon-config&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;We also need to open up the xinetd script in &amp;lt;code&amp;gt;/etc/xinetd.d/nrpe&amp;lt;/code&amp;gt; and add the Nagios servers private/public address to the end of it.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;only_from = 127.0.0.1 192.168.56.200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After modifying the file, restart xinetd&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service xinetd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;9)&#039;&#039;&#039;Now Nagios is fully installed, but still needs more configuring.&lt;br /&gt;
&lt;br /&gt;
Lets start off by going into this file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/nagios.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncommenting this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#cfg_dir=/usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now create the directory that will store the configuration file for each server that you will monitor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;10)&#039;&#039;&#039;Lets also add a command to NRPE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/objects/commands.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the following to the end of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define command{&lt;br /&gt;
        command_name check_nrpe&lt;br /&gt;
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache aswell, so lets enable Apache rewrite and cgi modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
sudo a2enmod cgi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use htpasswd to create an admin user, called &amp;quot;nagiosadmin&amp;quot;, that will be used in getting access to the web interface.&lt;br /&gt;
Set a password when prompted by the command, this username and password will be the main login credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally lets make a symlink between the nagios configuration file and the Apache sites-enabled directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ln -s /etc/apache2/sites-available/nagios.conf /etc/apache2/sites-enabled/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;11)&#039;&#039;&#039;And thats it, Nagios is ready to be started up, just restart the service and add Nagios to start on server booting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios start&lt;br /&gt;
&lt;br /&gt;
sudo service apache2 restart&lt;br /&gt;
&lt;br /&gt;
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats all, now you have a fully (hopefully) working Nagios thanks to following these steps.&lt;br /&gt;
&lt;br /&gt;
You can access the webinterface by going here: &amp;lt;code&amp;gt;http://nagios_server_public_ip/nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;12)&#039;&#039;&#039;But lets not stop there, lets try adding something for Nagios to keep an eye on. To do this, lets swap over to another machine that is in the same network as the Nagios server.&lt;br /&gt;
&lt;br /&gt;
On this other machine, lets install NRPE, it will be needed to make Nagios work on the new machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install nagios-plugins nagios-nrpe-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once NRPE is installed, lets go into the configuration file once again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the nagios server ip to the end of the &amp;lt;code&amp;gt;allowed_hosts=127.0.0.1,&amp;lt;/code&amp;gt; segment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;13)&#039;&#039;&#039;As an example, lets monitor one of our filesystems.&lt;br /&gt;
&lt;br /&gt;
Lets look up the filesystems that we have.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;df -h /&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go back into the NRPE configuration file in &amp;lt;code&amp;gt;/etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt; and change these three lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;server_address=client_private_IP&lt;br /&gt;
allowed_hosts=nagios_server_private_IP (you already set this earlier)&lt;br /&gt;
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p (filesystem that you chose)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dont forget to restart the NRPE service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios-nrpe-server restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14)&#039;&#039;&#039;After all that is done, its time to head back to the machine with the actual Nagios server and the new Host into the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/servers/yourhost.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this file, you need to add this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define host {&lt;br /&gt;
        use                             linux-server&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        alias                           My first Apache server&lt;br /&gt;
        address                         10.132.234.52 (changeme)&lt;br /&gt;
        max_check_attempts              5&lt;br /&gt;
        check_period                    24x7&lt;br /&gt;
        notification_interval           30&lt;br /&gt;
        notification_period             24x7&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
define service {&lt;br /&gt;
        use                             generic-service&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        service_description             PING&lt;br /&gt;
        check_command                   check_ping!100.0,20%!500.0,60%&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always restart services after major changes!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And thats all folks! Now if you were to look at your Nagios web interface, you would be able to see the new host you just added, and also a service tied to said host.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Graylong and Nagios are rather easy to install, albeit a bit time consuming and confusing. But they are still very good services in regards to Logging and Monitoring things.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116333</id>
		<title>Graylog&amp;Nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116333"/>
		<updated>2017-01-04T20:19:40Z</updated>

		<summary type="html">&lt;p&gt;Mhass: /* Nagios */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Logging and Monitoring - Graylog and Nagios installation.&lt;br /&gt;
&lt;br /&gt;
Group : Cyber Security Engineering (C21).&lt;br /&gt;
&lt;br /&gt;
Page created by Meelis Hass.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
In this page, I will show how a person can easily install and configure a good logging and monitoring solution into their systems and networks. My choices for this task are Graylog and Nagios.&lt;br /&gt;
&lt;br /&gt;
= Graylog =&lt;br /&gt;
//rohkem juttu&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now before we begin installing Graylog, we should check what version the machine is actully running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is because this guide is intended for 16.04 version of Ubuntu, If you do already have it, skip to actual installation. People who need to upgrade just continue with the following commands.&lt;br /&gt;
&lt;br /&gt;
Next lets upgrade our machine.&lt;br /&gt;
&lt;br /&gt;
*Start off by updating your package list&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Next lets upgrade everything&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then fix the dependencies with this&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get dist-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*And finish off by finishing the upgrade&lt;br /&gt;
&amp;lt;code&amp;gt; sudo do-release-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to the actual meat of the guide, installing graylog. But we cant just jump into installing Graylog itself, because it needs a few services and a setup base to run it, like Elasticsearch and MongoDB.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Starting off with the setup base.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apt-transport-https openjdk-8-jre-headless uuid-runtime pwgen &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now lets install MongoDB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install mongodb-server &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;Installing Elasticsearch takes a few more commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo &amp;quot;deb https://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install elasticsearch &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;We still need to configure Elasticsearch a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; nano /etc/elasticsearch/elasticsearch.yml &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncomment and change this line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cluster.name: graylog &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;After that, just start the service&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable elasticsearch.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl restart elasticsearch.service &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;Now we actully start installing Graylog itself! Start off by getting the required packages and then installing them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget https://packages.graylog2.org/repo/packages/graylog-2.1-repository_latest.deb &lt;br /&gt;
&lt;br /&gt;
sudo dpkg -i graylog-2.1-repository_latest.deb&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install graylog-server&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;After installing Graylog, we need to add a few extra parts into the configuration file, mainly passwords.&lt;br /&gt;
&lt;br /&gt;
This will generate a password and a sha256sum for it. Do note that the password is required and &#039;&#039;&#039;MUST&#039;&#039;&#039; be 16 characters or longer, otherwise Graylog refuses to function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo -n yourpassword | sha256sum &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The password must be put into &amp;lt;code&amp;gt; /etc/graylog/server/server.conf&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
While in the configuration file, also add your public ip with correct ports into &amp;lt;code&amp;gt; rest_listen_uri &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; web_listen_uri &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;Final steps to enable Graylog.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable graylog-server.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl start graylog-server.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there you have it, one fully installed Graylog, ready for all your logging needs!.&lt;br /&gt;
&lt;br /&gt;
After this, you can explore the web interface at the public ip address you set before and start logging whatever you want.&lt;br /&gt;
&lt;br /&gt;
= Nagios =&lt;br /&gt;
&lt;br /&gt;
Nagios is a free open source application that is used to monitor systems and networks. Nagios is able to alert users if things go wrong and when the problem is resolved. Nagios was created Ethen Galstad and a group of developers, and was initially released in March 14, 1999&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before installing Nagios, we need to once again check the version&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This guide is intended for 14.04 ubuntu servers, so if you are higher or lower, upgrade/downgrade appropriately. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Installing Nagios is a easier said than done, because it needs alot of stuff in advanced, like a LAMP base.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Doing these commands will install Apache, MYSQL and PHP, which are needed for Nagios functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apache2&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install mysql-server php5-mysql&lt;br /&gt;
&lt;br /&gt;
sudo mysql_install_db&lt;br /&gt;
&lt;br /&gt;
sudo mysql_secure_installation&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache2 a bit, go into &amp;lt;code&amp;gt; /etc/apache2/mods-enabled/dir.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change this line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into this line by moving index.php ahead of index.html.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that just restart Apache service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service apache2 restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now we need to make a user and group who will be dealing with using Nagios.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo useradd nagios&lt;br /&gt;
&lt;br /&gt;
sudo groupadd nagcmd&lt;br /&gt;
&lt;br /&gt;
sudo usermod -a -G nagcmd nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;We can almost move to building the Nagios Core, but first we need a few dependencies.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install build-essential libgd2-xpm-dev openssl libssl-dev xinetd apache2-utils unzip&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;Now to finally install Nagios itself&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-4.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;Move to the newly created folder and type these commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-group=nagios --with-command-group=nagcmd&lt;br /&gt;
 &lt;br /&gt;
make all &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That final command compiled Nagios, but its not fully done just yet. We still need a few more things to install on it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-commandmode&lt;br /&gt;
&lt;br /&gt;
sudo make install-init&lt;br /&gt;
&lt;br /&gt;
sudo make install-config&lt;br /&gt;
&lt;br /&gt;
sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;To be able to issue external commands trough the web interface of Nagios, we need to add the web server user into the nagios group&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo usermod -G nagcmd www-data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;We will also need Nagios Plugins and NRPE, which are installed in the same fashion as Nagios Core&lt;br /&gt;
&lt;br /&gt;
Nagios Plugins:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-plugins-2.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NRPE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nrpe-2.15.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Building NRPE, needs its xinetd startup script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;make all&lt;br /&gt;
&lt;br /&gt;
sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-xinetd&lt;br /&gt;
&lt;br /&gt;
sudo make install-daemon-config&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;We also need to open up the xinetd script in &amp;lt;code&amp;gt;/etc/xinetd.d/nrpe&amp;lt;/code&amp;gt; and add the Nagios servers private/public address to the end of it.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;only_from = 127.0.0.1 192.168.56.200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After modifying the file, restart xinetd&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service xinetd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;9)&#039;&#039;&#039;Now Nagios is fully installed, but still needs more configuring.&lt;br /&gt;
&lt;br /&gt;
Lets start off by going into this file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/nagios.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncommenting this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#cfg_dir=/usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now create the directory that will store the configuration file for each server that you will monitor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;10)&#039;&#039;&#039;Lets also add a command to NRPE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/objects/commands.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the following to the end of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define command{&lt;br /&gt;
        command_name check_nrpe&lt;br /&gt;
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache aswell, so lets enable Apache rewrite and cgi modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
sudo a2enmod cgi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use htpasswd to create an admin user, called &amp;quot;nagiosadmin&amp;quot;, that will be used in getting access to the web interface.&lt;br /&gt;
Set a password when prompted by the command, this username and password will be the main login credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally lets make a symlink between the nagios configuration file and the Apache sites-enabled directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ln -s /etc/apache2/sites-available/nagios.conf /etc/apache2/sites-enabled/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;11)&#039;&#039;&#039;And thats it, Nagios is ready to be started up, just restart the service and add Nagios to start on server booting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios start&lt;br /&gt;
&lt;br /&gt;
sudo service apache2 restart&lt;br /&gt;
&lt;br /&gt;
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats all, now you have a fully (hopefully) working Nagios thanks to following these steps.&lt;br /&gt;
&lt;br /&gt;
You can access the webinterface by going here: &amp;lt;code&amp;gt;http://nagios_server_public_ip/nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;12)&#039;&#039;&#039;But lets not stop there, lets try adding something for Nagios to keep an eye on. To do this, lets swap over to another machine that is in the same network as the Nagios server.&lt;br /&gt;
&lt;br /&gt;
On this other machine, lets install NRPE, it will be needed to make Nagios work on the new machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install nagios-plugins nagios-nrpe-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once NRPE is installed, lets go into the configuration file once again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the nagios server ip to the end of the &amp;lt;code&amp;gt;allowed_hosts=127.0.0.1,&amp;lt;/code&amp;gt; segment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;13)&#039;&#039;&#039;As an example, lets monitor one of our filesystems.&lt;br /&gt;
&lt;br /&gt;
Lets look up the filesystems that we have.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;df -h /&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go back into the NRPE configuration file in &amp;lt;code&amp;gt;/etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt; and change these three lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;server_address=client_private_IP&lt;br /&gt;
allowed_hosts=nagios_server_private_IP (you already set this earlier)&lt;br /&gt;
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p (filesystem that you chose)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dont forget to restart the NRPE service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios-nrpe-server restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14)&#039;&#039;&#039;After all that is done, its time to head back to the machine with the actual Nagios server and the new Host into the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/servers/yourhost.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this file, you need to add this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define host {&lt;br /&gt;
        use                             linux-server&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        alias                           My first Apache server&lt;br /&gt;
        address                         10.132.234.52 (changeme)&lt;br /&gt;
        max_check_attempts              5&lt;br /&gt;
        check_period                    24x7&lt;br /&gt;
        notification_interval           30&lt;br /&gt;
        notification_period             24x7&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
define service {&lt;br /&gt;
        use                             generic-service&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        service_description             PING&lt;br /&gt;
        check_command                   check_ping!100.0,20%!500.0,60%&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always restart services after major changes!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And thats all folks! Now if you were to look at your Nagios web interface, you would be able to see the new host you just added, and also a service tied to said host.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Graylong and Nagios are rather easy to install, albeit a bit time consuming and confusing. But they are still very good services in regards to Logging and Monitoring things.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116332</id>
		<title>Graylog&amp;Nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116332"/>
		<updated>2017-01-04T20:19:32Z</updated>

		<summary type="html">&lt;p&gt;Mhass: /* Graylog */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Logging and Monitoring - Graylog and Nagios installation.&lt;br /&gt;
&lt;br /&gt;
Group : Cyber Security Engineering (C21).&lt;br /&gt;
&lt;br /&gt;
Page created by Meelis Hass.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
In this page, I will show how a person can easily install and configure a good logging and monitoring solution into their systems and networks. My choices for this task are Graylog and Nagios.&lt;br /&gt;
&lt;br /&gt;
= Graylog =&lt;br /&gt;
//rohkem juttu&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now before we begin installing Graylog, we should check what version the machine is actully running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is because this guide is intended for 16.04 version of Ubuntu, If you do already have it, skip to actual installation. People who need to upgrade just continue with the following commands.&lt;br /&gt;
&lt;br /&gt;
Next lets upgrade our machine.&lt;br /&gt;
&lt;br /&gt;
*Start off by updating your package list&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Next lets upgrade everything&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then fix the dependencies with this&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get dist-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*And finish off by finishing the upgrade&lt;br /&gt;
&amp;lt;code&amp;gt; sudo do-release-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to the actual meat of the guide, installing graylog. But we cant just jump into installing Graylog itself, because it needs a few services and a setup base to run it, like Elasticsearch and MongoDB.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Starting off with the setup base.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apt-transport-https openjdk-8-jre-headless uuid-runtime pwgen &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now lets install MongoDB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install mongodb-server &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;Installing Elasticsearch takes a few more commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo &amp;quot;deb https://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install elasticsearch &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;We still need to configure Elasticsearch a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; nano /etc/elasticsearch/elasticsearch.yml &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncomment and change this line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cluster.name: graylog &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;After that, just start the service&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable elasticsearch.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl restart elasticsearch.service &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;Now we actully start installing Graylog itself! Start off by getting the required packages and then installing them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget https://packages.graylog2.org/repo/packages/graylog-2.1-repository_latest.deb &lt;br /&gt;
&lt;br /&gt;
sudo dpkg -i graylog-2.1-repository_latest.deb&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install graylog-server&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;After installing Graylog, we need to add a few extra parts into the configuration file, mainly passwords.&lt;br /&gt;
&lt;br /&gt;
This will generate a password and a sha256sum for it. Do note that the password is required and &#039;&#039;&#039;MUST&#039;&#039;&#039; be 16 characters or longer, otherwise Graylog refuses to function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo -n yourpassword | sha256sum &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The password must be put into &amp;lt;code&amp;gt; /etc/graylog/server/server.conf&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
While in the configuration file, also add your public ip with correct ports into &amp;lt;code&amp;gt; rest_listen_uri &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; web_listen_uri &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;Final steps to enable Graylog.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable graylog-server.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl start graylog-server.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there you have it, one fully installed Graylog, ready for all your logging needs!.&lt;br /&gt;
&lt;br /&gt;
After this, you can explore the web interface at the public ip address you set before and start logging whatever you want.&lt;br /&gt;
&lt;br /&gt;
= Nagios =&lt;br /&gt;
&lt;br /&gt;
Nagios is a free open source application that is used to monitor systems and networks. Nagios is able to alert users if things go wrong and when the problem is resolved. Nagios was created Ethen Galstad and a group of developers, and was initially released in March 14, 1999&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Before installing Nagios, we need to once again check the version&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This guide is intended for 14.04 ubuntu servers, so if you are higher or lower, upgrade/downgrade appropriately. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Installing Nagios is a easier said than done, because it needs alot of stuff in advanced, like a LAMP base.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Doing these commands will install Apache, MYSQL and PHP, which are needed for Nagios functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apache2&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install mysql-server php5-mysql&lt;br /&gt;
&lt;br /&gt;
sudo mysql_install_db&lt;br /&gt;
&lt;br /&gt;
sudo mysql_secure_installation&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache2 a bit, go into &amp;lt;code&amp;gt; /etc/apache2/mods-enabled/dir.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change this line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into this line by moving index.php ahead of index.html.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that just restart Apache service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service apache2 restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now we need to make a user and group who will be dealing with using Nagios.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo useradd nagios&lt;br /&gt;
&lt;br /&gt;
sudo groupadd nagcmd&lt;br /&gt;
&lt;br /&gt;
sudo usermod -a -G nagcmd nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;We can almost move to building the Nagios Core, but first we need a few dependencies.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install build-essential libgd2-xpm-dev openssl libssl-dev xinetd apache2-utils unzip&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;Now to finally install Nagios itself&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-4.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;Move to the newly created folder and type these commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-group=nagios --with-command-group=nagcmd&lt;br /&gt;
 &lt;br /&gt;
make all &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That final command compiled Nagios, but its not fully done just yet. We still need a few more things to install on it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-commandmode&lt;br /&gt;
&lt;br /&gt;
sudo make install-init&lt;br /&gt;
&lt;br /&gt;
sudo make install-config&lt;br /&gt;
&lt;br /&gt;
sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;To be able to issue external commands trough the web interface of Nagios, we need to add the web server user into the nagios group&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo usermod -G nagcmd www-data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;We will also need Nagios Plugins and NRPE, which are installed in the same fashion as Nagios Core&lt;br /&gt;
&lt;br /&gt;
Nagios Plugins:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-plugins-2.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NRPE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nrpe-2.15.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Building NRPE, needs its xinetd startup script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;make all&lt;br /&gt;
&lt;br /&gt;
sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-xinetd&lt;br /&gt;
&lt;br /&gt;
sudo make install-daemon-config&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;We also need to open up the xinetd script in &amp;lt;code&amp;gt;/etc/xinetd.d/nrpe&amp;lt;/code&amp;gt; and add the Nagios servers private/public address to the end of it.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;only_from = 127.0.0.1 192.168.56.200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After modifying the file, restart xinetd&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service xinetd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;9)&#039;&#039;&#039;Now Nagios is fully installed, but still needs more configuring.&lt;br /&gt;
&lt;br /&gt;
Lets start off by going into this file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/nagios.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncommenting this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#cfg_dir=/usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now create the directory that will store the configuration file for each server that you will monitor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;10)&#039;&#039;&#039;Lets also add a command to NRPE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/objects/commands.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the following to the end of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define command{&lt;br /&gt;
        command_name check_nrpe&lt;br /&gt;
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache aswell, so lets enable Apache rewrite and cgi modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
sudo a2enmod cgi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use htpasswd to create an admin user, called &amp;quot;nagiosadmin&amp;quot;, that will be used in getting access to the web interface.&lt;br /&gt;
Set a password when prompted by the command, this username and password will be the main login credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally lets make a symlink between the nagios configuration file and the Apache sites-enabled directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ln -s /etc/apache2/sites-available/nagios.conf /etc/apache2/sites-enabled/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;11)&#039;&#039;&#039;And thats it, Nagios is ready to be started up, just restart the service and add Nagios to start on server booting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios start&lt;br /&gt;
&lt;br /&gt;
sudo service apache2 restart&lt;br /&gt;
&lt;br /&gt;
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats all, now you have a fully (hopefully) working Nagios thanks to following these steps.&lt;br /&gt;
&lt;br /&gt;
You can access the webinterface by going here: &amp;lt;code&amp;gt;http://nagios_server_public_ip/nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;12)&#039;&#039;&#039;But lets not stop there, lets try adding something for Nagios to keep an eye on. To do this, lets swap over to another machine that is in the same network as the Nagios server.&lt;br /&gt;
&lt;br /&gt;
On this other machine, lets install NRPE, it will be needed to make Nagios work on the new machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install nagios-plugins nagios-nrpe-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once NRPE is installed, lets go into the configuration file once again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the nagios server ip to the end of the &amp;lt;code&amp;gt;allowed_hosts=127.0.0.1,&amp;lt;/code&amp;gt; segment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;13)&#039;&#039;&#039;As an example, lets monitor one of our filesystems.&lt;br /&gt;
&lt;br /&gt;
Lets look up the filesystems that we have.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;df -h /&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go back into the NRPE configuration file in &amp;lt;code&amp;gt;/etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt; and change these three lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;server_address=client_private_IP&lt;br /&gt;
allowed_hosts=nagios_server_private_IP (you already set this earlier)&lt;br /&gt;
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p (filesystem that you chose)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dont forget to restart the NRPE service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios-nrpe-server restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14)&#039;&#039;&#039;After all that is done, its time to head back to the machine with the actual Nagios server and the new Host into the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/servers/yourhost.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this file, you need to add this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define host {&lt;br /&gt;
        use                             linux-server&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        alias                           My first Apache server&lt;br /&gt;
        address                         10.132.234.52 (changeme)&lt;br /&gt;
        max_check_attempts              5&lt;br /&gt;
        check_period                    24x7&lt;br /&gt;
        notification_interval           30&lt;br /&gt;
        notification_period             24x7&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
define service {&lt;br /&gt;
        use                             generic-service&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        service_description             PING&lt;br /&gt;
        check_command                   check_ping!100.0,20%!500.0,60%&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always restart services after major changes!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And thats all folks! Now if you were to look at your Nagios web interface, you would be able to see the new host you just added, and also a service tied to said host.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Graylong and Nagios are rather easy to install, albeit a bit time consuming and confusing. But they are still very good services in regards to Logging and Monitoring things.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116331</id>
		<title>Graylog&amp;Nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116331"/>
		<updated>2017-01-04T20:19:17Z</updated>

		<summary type="html">&lt;p&gt;Mhass: /* Nagios */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Logging and Monitoring - Graylog and Nagios installation.&lt;br /&gt;
&lt;br /&gt;
Group : Cyber Security Engineering (C21).&lt;br /&gt;
&lt;br /&gt;
Page created by Meelis Hass.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
In this page, I will show how a person can easily install and configure a good logging and monitoring solution into their systems and networks. My choices for this task are Graylog and Nagios.&lt;br /&gt;
&lt;br /&gt;
= Graylog =&lt;br /&gt;
//rohkem juttu&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Now before we begin installing Graylog, we should check what version the machine is actully running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is because this guide is intended for 16.04 version of Ubuntu, If you do already have it, skip to actual installation. People who need to upgrade just continue with the following commands.&lt;br /&gt;
&lt;br /&gt;
Next lets upgrade our machine.&lt;br /&gt;
&lt;br /&gt;
*Start off by updating your package list&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Next lets upgrade everything&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then fix the dependencies with this&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get dist-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*And finish off by finishing the upgrade&lt;br /&gt;
&amp;lt;code&amp;gt; sudo do-release-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to the actual meat of the guide, installing graylog. But we cant just jump into installing Graylog itself, because it needs a few services and a setup base to run it, like Elasticsearch and MongoDB.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Starting off with the setup base.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apt-transport-https openjdk-8-jre-headless uuid-runtime pwgen &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now lets install MongoDB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install mongodb-server &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;Installing Elasticsearch takes a few more commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo &amp;quot;deb https://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install elasticsearch &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;We still need to configure Elasticsearch a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; nano /etc/elasticsearch/elasticsearch.yml &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncomment and change this line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cluster.name: graylog &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;After that, just start the service&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable elasticsearch.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl restart elasticsearch.service &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;Now we actully start installing Graylog itself! Start off by getting the required packages and then installing them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget https://packages.graylog2.org/repo/packages/graylog-2.1-repository_latest.deb &lt;br /&gt;
&lt;br /&gt;
sudo dpkg -i graylog-2.1-repository_latest.deb&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install graylog-server&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;After installing Graylog, we need to add a few extra parts into the configuration file, mainly passwords.&lt;br /&gt;
&lt;br /&gt;
This will generate a password and a sha256sum for it. Do note that the password is required and &#039;&#039;&#039;MUST&#039;&#039;&#039; be 16 characters or longer, otherwise Graylog refuses to function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo -n yourpassword | sha256sum &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The password must be put into &amp;lt;code&amp;gt; /etc/graylog/server/server.conf&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
While in the configuration file, also add your public ip with correct ports into &amp;lt;code&amp;gt; rest_listen_uri &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; web_listen_uri &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;Final steps to enable Graylog.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable graylog-server.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl start graylog-server.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there you have it, one fully installed Graylog, ready for all your logging needs!.&lt;br /&gt;
&lt;br /&gt;
After this, you can explore the web interface at the public ip address you set before and start logging whatever you want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Nagios =&lt;br /&gt;
&lt;br /&gt;
Nagios is a free open source application that is used to monitor systems and networks. Nagios is able to alert users if things go wrong and when the problem is resolved. Nagios was created Ethen Galstad and a group of developers, and was initially released in March 14, 1999&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Before installing Nagios, we need to once again check the version&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This guide is intended for 14.04 ubuntu servers, so if you are higher or lower, upgrade/downgrade appropriately. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Installing Nagios is a easier said than done, because it needs alot of stuff in advanced, like a LAMP base.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Doing these commands will install Apache, MYSQL and PHP, which are needed for Nagios functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apache2&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install mysql-server php5-mysql&lt;br /&gt;
&lt;br /&gt;
sudo mysql_install_db&lt;br /&gt;
&lt;br /&gt;
sudo mysql_secure_installation&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache2 a bit, go into &amp;lt;code&amp;gt; /etc/apache2/mods-enabled/dir.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change this line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into this line by moving index.php ahead of index.html.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that just restart Apache service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service apache2 restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now we need to make a user and group who will be dealing with using Nagios.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo useradd nagios&lt;br /&gt;
&lt;br /&gt;
sudo groupadd nagcmd&lt;br /&gt;
&lt;br /&gt;
sudo usermod -a -G nagcmd nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;We can almost move to building the Nagios Core, but first we need a few dependencies.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install build-essential libgd2-xpm-dev openssl libssl-dev xinetd apache2-utils unzip&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;Now to finally install Nagios itself&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-4.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;Move to the newly created folder and type these commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-group=nagios --with-command-group=nagcmd&lt;br /&gt;
 &lt;br /&gt;
make all &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That final command compiled Nagios, but its not fully done just yet. We still need a few more things to install on it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-commandmode&lt;br /&gt;
&lt;br /&gt;
sudo make install-init&lt;br /&gt;
&lt;br /&gt;
sudo make install-config&lt;br /&gt;
&lt;br /&gt;
sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;To be able to issue external commands trough the web interface of Nagios, we need to add the web server user into the nagios group&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo usermod -G nagcmd www-data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;We will also need Nagios Plugins and NRPE, which are installed in the same fashion as Nagios Core&lt;br /&gt;
&lt;br /&gt;
Nagios Plugins:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-plugins-2.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NRPE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nrpe-2.15.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Building NRPE, needs its xinetd startup script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;make all&lt;br /&gt;
&lt;br /&gt;
sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-xinetd&lt;br /&gt;
&lt;br /&gt;
sudo make install-daemon-config&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;We also need to open up the xinetd script in &amp;lt;code&amp;gt;/etc/xinetd.d/nrpe&amp;lt;/code&amp;gt; and add the Nagios servers private/public address to the end of it.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;only_from = 127.0.0.1 192.168.56.200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After modifying the file, restart xinetd&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service xinetd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;9)&#039;&#039;&#039;Now Nagios is fully installed, but still needs more configuring.&lt;br /&gt;
&lt;br /&gt;
Lets start off by going into this file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/nagios.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncommenting this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#cfg_dir=/usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now create the directory that will store the configuration file for each server that you will monitor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;10)&#039;&#039;&#039;Lets also add a command to NRPE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/objects/commands.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the following to the end of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define command{&lt;br /&gt;
        command_name check_nrpe&lt;br /&gt;
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache aswell, so lets enable Apache rewrite and cgi modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
sudo a2enmod cgi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use htpasswd to create an admin user, called &amp;quot;nagiosadmin&amp;quot;, that will be used in getting access to the web interface.&lt;br /&gt;
Set a password when prompted by the command, this username and password will be the main login credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally lets make a symlink between the nagios configuration file and the Apache sites-enabled directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ln -s /etc/apache2/sites-available/nagios.conf /etc/apache2/sites-enabled/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;11)&#039;&#039;&#039;And thats it, Nagios is ready to be started up, just restart the service and add Nagios to start on server booting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios start&lt;br /&gt;
&lt;br /&gt;
sudo service apache2 restart&lt;br /&gt;
&lt;br /&gt;
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats all, now you have a fully (hopefully) working Nagios thanks to following these steps.&lt;br /&gt;
&lt;br /&gt;
You can access the webinterface by going here: &amp;lt;code&amp;gt;http://nagios_server_public_ip/nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;12)&#039;&#039;&#039;But lets not stop there, lets try adding something for Nagios to keep an eye on. To do this, lets swap over to another machine that is in the same network as the Nagios server.&lt;br /&gt;
&lt;br /&gt;
On this other machine, lets install NRPE, it will be needed to make Nagios work on the new machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install nagios-plugins nagios-nrpe-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once NRPE is installed, lets go into the configuration file once again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the nagios server ip to the end of the &amp;lt;code&amp;gt;allowed_hosts=127.0.0.1,&amp;lt;/code&amp;gt; segment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;13)&#039;&#039;&#039;As an example, lets monitor one of our filesystems.&lt;br /&gt;
&lt;br /&gt;
Lets look up the filesystems that we have.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;df -h /&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go back into the NRPE configuration file in &amp;lt;code&amp;gt;/etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt; and change these three lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;server_address=client_private_IP&lt;br /&gt;
allowed_hosts=nagios_server_private_IP (you already set this earlier)&lt;br /&gt;
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p (filesystem that you chose)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dont forget to restart the NRPE service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios-nrpe-server restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14)&#039;&#039;&#039;After all that is done, its time to head back to the machine with the actual Nagios server and the new Host into the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/servers/yourhost.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this file, you need to add this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define host {&lt;br /&gt;
        use                             linux-server&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        alias                           My first Apache server&lt;br /&gt;
        address                         10.132.234.52 (changeme)&lt;br /&gt;
        max_check_attempts              5&lt;br /&gt;
        check_period                    24x7&lt;br /&gt;
        notification_interval           30&lt;br /&gt;
        notification_period             24x7&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
define service {&lt;br /&gt;
        use                             generic-service&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        service_description             PING&lt;br /&gt;
        check_command                   check_ping!100.0,20%!500.0,60%&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always restart services after major changes!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And thats all folks! Now if you were to look at your Nagios web interface, you would be able to see the new host you just added, and also a service tied to said host.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Graylong and Nagios are rather easy to install, albeit a bit time consuming and confusing. But they are still very good services in regards to Logging and Monitoring things.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116330</id>
		<title>Graylog&amp;Nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116330"/>
		<updated>2017-01-04T20:18:05Z</updated>

		<summary type="html">&lt;p&gt;Mhass: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Logging and Monitoring - Graylog and Nagios installation.&lt;br /&gt;
&lt;br /&gt;
Group : Cyber Security Engineering (C21).&lt;br /&gt;
&lt;br /&gt;
Page created by Meelis Hass.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
In this page, I will show how a person can easily install and configure a good logging and monitoring solution into their systems and networks. My choices for this task are Graylog and Nagios.&lt;br /&gt;
&lt;br /&gt;
= Graylog =&lt;br /&gt;
//rohkem juttu&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Now before we begin installing Graylog, we should check what version the machine is actully running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is because this guide is intended for 16.04 version of Ubuntu, If you do already have it, skip to actual installation. People who need to upgrade just continue with the following commands.&lt;br /&gt;
&lt;br /&gt;
Next lets upgrade our machine.&lt;br /&gt;
&lt;br /&gt;
*Start off by updating your package list&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Next lets upgrade everything&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then fix the dependencies with this&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get dist-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*And finish off by finishing the upgrade&lt;br /&gt;
&amp;lt;code&amp;gt; sudo do-release-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to the actual meat of the guide, installing graylog. But we cant just jump into installing Graylog itself, because it needs a few services and a setup base to run it, like Elasticsearch and MongoDB.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Starting off with the setup base.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apt-transport-https openjdk-8-jre-headless uuid-runtime pwgen &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now lets install MongoDB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install mongodb-server &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;Installing Elasticsearch takes a few more commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo &amp;quot;deb https://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install elasticsearch &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;We still need to configure Elasticsearch a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; nano /etc/elasticsearch/elasticsearch.yml &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncomment and change this line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cluster.name: graylog &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;After that, just start the service&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable elasticsearch.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl restart elasticsearch.service &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;Now we actully start installing Graylog itself! Start off by getting the required packages and then installing them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget https://packages.graylog2.org/repo/packages/graylog-2.1-repository_latest.deb &lt;br /&gt;
&lt;br /&gt;
sudo dpkg -i graylog-2.1-repository_latest.deb&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install graylog-server&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;After installing Graylog, we need to add a few extra parts into the configuration file, mainly passwords.&lt;br /&gt;
&lt;br /&gt;
This will generate a password and a sha256sum for it. Do note that the password is required and &#039;&#039;&#039;MUST&#039;&#039;&#039; be 16 characters or longer, otherwise Graylog refuses to function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo -n yourpassword | sha256sum &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The password must be put into &amp;lt;code&amp;gt; /etc/graylog/server/server.conf&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
While in the configuration file, also add your public ip with correct ports into &amp;lt;code&amp;gt; rest_listen_uri &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; web_listen_uri &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;Final steps to enable Graylog.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable graylog-server.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl start graylog-server.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there you have it, one fully installed Graylog, ready for all your logging needs!.&lt;br /&gt;
&lt;br /&gt;
After this, you can explore the web interface at the public ip address you set before and start logging whatever you want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Nagios =&lt;br /&gt;
&lt;br /&gt;
Nagios is a free open source application that is used to monitor systems and networks. Nagios is able to alert users if things go wrong and when the problem is resolved. Nagios was created Ethen Galstad and a group of developers, and was initially released in March 14, 1999&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Before installing Nagios, we need to once again check the version&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This guide is intended for 14.04 ubuntu servers, so if you are higher or lower, upgrade/downgrade appropriately. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installing Nagios is a easier said than done, because it needs alot of stuff in advanced, like a LAMP base.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Doing these commands will install Apache, MYSQL and PHP, which are needed for Nagios functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apache2&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install mysql-server php5-mysql&lt;br /&gt;
&lt;br /&gt;
sudo mysql_install_db&lt;br /&gt;
&lt;br /&gt;
sudo mysql_secure_installation&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache2 a bit, go into &amp;lt;code&amp;gt; /etc/apache2/mods-enabled/dir.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change this line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into this line by moving index.php ahead of index.html.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that just restart Apache service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service apache2 restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now we need to make a user and group who will be dealing with using Nagios.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo useradd nagios&lt;br /&gt;
&lt;br /&gt;
sudo groupadd nagcmd&lt;br /&gt;
&lt;br /&gt;
sudo usermod -a -G nagcmd nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;We can almost move to building the Nagios Core, but first we need a few dependencies.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install build-essential libgd2-xpm-dev openssl libssl-dev xinetd apache2-utils unzip&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;Now to finally install Nagios itself&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-4.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;Move to the newly created folder and type these commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-group=nagios --with-command-group=nagcmd&lt;br /&gt;
 &lt;br /&gt;
make all &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That final command compiled Nagios, but its not fully done just yet. We still need a few more things to install on it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-commandmode&lt;br /&gt;
&lt;br /&gt;
sudo make install-init&lt;br /&gt;
&lt;br /&gt;
sudo make install-config&lt;br /&gt;
&lt;br /&gt;
sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;To be able to issue external commands trough the web interface of Nagios, we need to add the web server user into the nagios group&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo usermod -G nagcmd www-data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;We will also need Nagios Plugins and NRPE, which are installed in the same fashion as Nagios Core&lt;br /&gt;
&lt;br /&gt;
Nagios Plugins:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-plugins-2.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NRPE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nrpe-2.15.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Building NRPE, needs its xinetd startup script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;make all&lt;br /&gt;
&lt;br /&gt;
sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-xinetd&lt;br /&gt;
&lt;br /&gt;
sudo make install-daemon-config&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;We also need to open up the xinetd script in &amp;lt;code&amp;gt;/etc/xinetd.d/nrpe&amp;lt;/code&amp;gt; and add the Nagios servers private/public address to the end of it.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;only_from = 127.0.0.1 192.168.56.200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After modifying the file, restart xinetd&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service xinetd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;9)&#039;&#039;&#039;Now Nagios is fully installed, but still needs more configuring.&lt;br /&gt;
&lt;br /&gt;
Lets start off by going into this file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/nagios.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncommenting this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#cfg_dir=/usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now create the directory that will store the configuration file for each server that you will monitor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;10)&#039;&#039;&#039;Lets also add a command to NRPE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/objects/commands.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the following to the end of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define command{&lt;br /&gt;
        command_name check_nrpe&lt;br /&gt;
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache aswell, so lets enable Apache rewrite and cgi modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
sudo a2enmod cgi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use htpasswd to create an admin user, called &amp;quot;nagiosadmin&amp;quot;, that will be used in getting access to the web interface.&lt;br /&gt;
Set a password when prompted by the command, this username and password will be the main login credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally lets make a symlink between the nagios configuration file and the Apache sites-enabled directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ln -s /etc/apache2/sites-available/nagios.conf /etc/apache2/sites-enabled/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;11)&#039;&#039;&#039;And thats it, Nagios is ready to be started up, just restart the service and add Nagios to start on server booting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios start&lt;br /&gt;
&lt;br /&gt;
sudo service apache2 restart&lt;br /&gt;
&lt;br /&gt;
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats all, now you have a fully (hopefully) working Nagios thanks to following these steps.&lt;br /&gt;
&lt;br /&gt;
You can access the webinterface by going here: &amp;lt;code&amp;gt;http://nagios_server_public_ip/nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;12)&#039;&#039;&#039;But lets not stop there, lets try adding something for Nagios to keep an eye on. To do this, lets swap over to another machine that is in the same network as the Nagios server.&lt;br /&gt;
&lt;br /&gt;
On this other machine, lets install NRPE, it will be needed to make Nagios work on the new machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install nagios-plugins nagios-nrpe-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once NRPE is installed, lets go into the configuration file once again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the nagios server ip to the end of the &amp;lt;code&amp;gt;allowed_hosts=127.0.0.1,&amp;lt;/code&amp;gt; segment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;13)&#039;&#039;&#039;As an example, lets monitor one of our filesystems.&lt;br /&gt;
&lt;br /&gt;
Lets look up the filesystems that we have.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;df -h /&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go back into the NRPE configuration file in &amp;lt;code&amp;gt;/etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt; and change these three lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;server_address=client_private_IP&lt;br /&gt;
allowed_hosts=nagios_server_private_IP (you already set this earlier)&lt;br /&gt;
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p (filesystem that you chose)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dont forget to restart the NRPE service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios-nrpe-server restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14)&#039;&#039;&#039;After all that is done, its time to head back to the machine with the actual Nagios server and the new Host into the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/servers/yourhost.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this file, you need to add this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define host {&lt;br /&gt;
        use                             linux-server&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        alias                           My first Apache server&lt;br /&gt;
        address                         10.132.234.52 (changeme)&lt;br /&gt;
        max_check_attempts              5&lt;br /&gt;
        check_period                    24x7&lt;br /&gt;
        notification_interval           30&lt;br /&gt;
        notification_period             24x7&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
define service {&lt;br /&gt;
        use                             generic-service&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        service_description             PING&lt;br /&gt;
        check_command                   check_ping!100.0,20%!500.0,60%&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always restart services after major changes!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And thats all folks! Now if you were to look at your Nagios web interface, you would be able to see the new host you just added, and also a service tied to said host.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Graylong and Nagios are rather easy to install, albeit a bit time consuming and confusing. But they are still very good services in regards to Logging and Monitoring things.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116329</id>
		<title>Graylog&amp;Nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116329"/>
		<updated>2017-01-04T20:16:13Z</updated>

		<summary type="html">&lt;p&gt;Mhass: /* Nagios */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Logging and Monitoring - Graylog and Nagios installation.&lt;br /&gt;
&lt;br /&gt;
Group : Cyber Security Engineering (C21).&lt;br /&gt;
&lt;br /&gt;
Page created by Meelis Hass.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
In this page, I will show how a person can easily install and configure Graylog and Nagios in a timely fashion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Graylog =&lt;br /&gt;
//rohkem juttu&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Now before we begin installing Graylog, we should check what version the machine is actully running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is because this guide is intended for 16.04 version of Ubuntu, If you do already have it, skip to actual installation. People who need to upgrade just continue with the following commands.&lt;br /&gt;
&lt;br /&gt;
Next lets upgrade our machine.&lt;br /&gt;
&lt;br /&gt;
*Start off by updating your package list&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Next lets upgrade everything&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then fix the dependencies with this&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get dist-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*And finish off by finishing the upgrade&lt;br /&gt;
&amp;lt;code&amp;gt; sudo do-release-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to the actual meat of the guide, installing graylog. But we cant just jump into installing Graylog itself, because it needs a few services and a setup base to run it, like Elasticsearch and MongoDB.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Starting off with the setup base.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apt-transport-https openjdk-8-jre-headless uuid-runtime pwgen &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now lets install MongoDB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install mongodb-server &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;Installing Elasticsearch takes a few more commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo &amp;quot;deb https://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install elasticsearch &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;We still need to configure Elasticsearch a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; nano /etc/elasticsearch/elasticsearch.yml &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncomment and change this line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cluster.name: graylog &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;After that, just start the service&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable elasticsearch.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl restart elasticsearch.service &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;Now we actully start installing Graylog itself! Start off by getting the required packages and then installing them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget https://packages.graylog2.org/repo/packages/graylog-2.1-repository_latest.deb &lt;br /&gt;
&lt;br /&gt;
sudo dpkg -i graylog-2.1-repository_latest.deb&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install graylog-server&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;After installing Graylog, we need to add a few extra parts into the configuration file, mainly passwords.&lt;br /&gt;
&lt;br /&gt;
This will generate a password and a sha256sum for it. Do note that the password is required and &#039;&#039;&#039;MUST&#039;&#039;&#039; be 16 characters or longer, otherwise Graylog refuses to function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo -n yourpassword | sha256sum &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The password must be put into &amp;lt;code&amp;gt; /etc/graylog/server/server.conf&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
While in the configuration file, also add your public ip with correct ports into &amp;lt;code&amp;gt; rest_listen_uri &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; web_listen_uri &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;Final steps to enable Graylog.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable graylog-server.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl start graylog-server.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there you have it, one fully installed Graylog, ready for all your logging needs!.&lt;br /&gt;
&lt;br /&gt;
After this, you can explore the web interface at the public ip address you set before and start logging whatever you want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Nagios =&lt;br /&gt;
&lt;br /&gt;
Nagios is a free open source application that is used to monitor systems and networks. Nagios is able to alert users if things go wrong and when the problem is resolved. Nagios was created Ethen Galstad and a group of developers, and was initially released in March 14, 1999&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Before installing Nagios, we need to once again check the version&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This guide is intended for 14.04 ubuntu servers, so if you are higher or lower, upgrade/downgrade appropriately. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installing Nagios is a easier said than done, because it needs alot of stuff in advanced, like a LAMP base.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Doing these commands will install Apache, MYSQL and PHP, which are needed for Nagios functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apache2&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install mysql-server php5-mysql&lt;br /&gt;
&lt;br /&gt;
sudo mysql_install_db&lt;br /&gt;
&lt;br /&gt;
sudo mysql_secure_installation&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache2 a bit, go into &amp;lt;code&amp;gt; /etc/apache2/mods-enabled/dir.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change this line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into this line by moving index.php ahead of index.html.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that just restart Apache service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service apache2 restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now we need to make a user and group who will be dealing with using Nagios.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo useradd nagios&lt;br /&gt;
&lt;br /&gt;
sudo groupadd nagcmd&lt;br /&gt;
&lt;br /&gt;
sudo usermod -a -G nagcmd nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;We can almost move to building the Nagios Core, but first we need a few dependencies.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install build-essential libgd2-xpm-dev openssl libssl-dev xinetd apache2-utils unzip&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;Now to finally install Nagios itself&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-4.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;Move to the newly created folder and type these commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-group=nagios --with-command-group=nagcmd&lt;br /&gt;
 &lt;br /&gt;
make all &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That final command compiled Nagios, but its not fully done just yet. We still need a few more things to install on it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-commandmode&lt;br /&gt;
&lt;br /&gt;
sudo make install-init&lt;br /&gt;
&lt;br /&gt;
sudo make install-config&lt;br /&gt;
&lt;br /&gt;
sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;To be able to issue external commands trough the web interface of Nagios, we need to add the web server user into the nagios group&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo usermod -G nagcmd www-data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;We will also need Nagios Plugins and NRPE, which are installed in the same fashion as Nagios Core&lt;br /&gt;
&lt;br /&gt;
Nagios Plugins:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-plugins-2.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NRPE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nrpe-2.15.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Building NRPE, needs its xinetd startup script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;make all&lt;br /&gt;
&lt;br /&gt;
sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-xinetd&lt;br /&gt;
&lt;br /&gt;
sudo make install-daemon-config&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;We also need to open up the xinetd script in &amp;lt;code&amp;gt;/etc/xinetd.d/nrpe&amp;lt;/code&amp;gt; and add the Nagios servers private/public address to the end of it.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;only_from = 127.0.0.1 192.168.56.200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After modifying the file, restart xinetd&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service xinetd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;9)&#039;&#039;&#039;Now Nagios is fully installed, but still needs more configuring.&lt;br /&gt;
&lt;br /&gt;
Lets start off by going into this file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/nagios.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncommenting this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#cfg_dir=/usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now create the directory that will store the configuration file for each server that you will monitor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;10)&#039;&#039;&#039;Lets also add a command to NRPE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/objects/commands.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the following to the end of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define command{&lt;br /&gt;
        command_name check_nrpe&lt;br /&gt;
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache aswell, so lets enable Apache rewrite and cgi modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
sudo a2enmod cgi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use htpasswd to create an admin user, called &amp;quot;nagiosadmin&amp;quot;, that will be used in getting access to the web interface.&lt;br /&gt;
Set a password when prompted by the command, this username and password will be the main login credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally lets make a symlink between the nagios configuration file and the Apache sites-enabled directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ln -s /etc/apache2/sites-available/nagios.conf /etc/apache2/sites-enabled/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;11)&#039;&#039;&#039;And thats it, Nagios is ready to be started up, just restart the service and add Nagios to start on server booting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios start&lt;br /&gt;
&lt;br /&gt;
sudo service apache2 restart&lt;br /&gt;
&lt;br /&gt;
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats all, now you have a fully (hopefully) working Nagios thanks to following these steps.&lt;br /&gt;
&lt;br /&gt;
You can access the webinterface by going here: &amp;lt;code&amp;gt;http://nagios_server_public_ip/nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;12)&#039;&#039;&#039;But lets not stop there, lets try adding something for Nagios to keep an eye on. To do this, lets swap over to another machine that is in the same network as the Nagios server.&lt;br /&gt;
&lt;br /&gt;
On this other machine, lets install NRPE, it will be needed to make Nagios work on the new machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install nagios-plugins nagios-nrpe-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once NRPE is installed, lets go into the configuration file once again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the nagios server ip to the end of the &amp;lt;code&amp;gt;allowed_hosts=127.0.0.1,&amp;lt;/code&amp;gt; segment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;13)&#039;&#039;&#039;As an example, lets monitor one of our filesystems.&lt;br /&gt;
&lt;br /&gt;
Lets look up the filesystems that we have.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;df -h /&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go back into the NRPE configuration file in &amp;lt;code&amp;gt;/etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt; and change these three lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;server_address=client_private_IP&lt;br /&gt;
allowed_hosts=nagios_server_private_IP (you already set this earlier)&lt;br /&gt;
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p (filesystem that you chose)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dont forget to restart the NRPE service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios-nrpe-server restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14)&#039;&#039;&#039;After all that is done, its time to head back to the machine with the actual Nagios server and the new Host into the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/servers/yourhost.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this file, you need to add this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define host {&lt;br /&gt;
        use                             linux-server&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        alias                           My first Apache server&lt;br /&gt;
        address                         10.132.234.52 (changeme)&lt;br /&gt;
        max_check_attempts              5&lt;br /&gt;
        check_period                    24x7&lt;br /&gt;
        notification_interval           30&lt;br /&gt;
        notification_period             24x7&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
define service {&lt;br /&gt;
        use                             generic-service&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        service_description             PING&lt;br /&gt;
        check_command                   check_ping!100.0,20%!500.0,60%&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always restart services after major changes!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And thats all folks! Now if you were to look at your Nagios web interface, you would be able to see the new host you just added, and also a service tied to said host.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Graylong and Nagios are rather easy to install, albeit a bit time consuming and confusing. But they are still very good services in regards to Logging and Monitoring things.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116328</id>
		<title>Graylog&amp;Nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116328"/>
		<updated>2017-01-04T20:12:25Z</updated>

		<summary type="html">&lt;p&gt;Mhass: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Logging and Monitoring - Graylog and Nagios installation.&lt;br /&gt;
&lt;br /&gt;
Group : Cyber Security Engineering (C21).&lt;br /&gt;
&lt;br /&gt;
Page created by Meelis Hass.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
In this page, I will show how a person can easily install and configure Graylog and Nagios in a timely fashion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Graylog =&lt;br /&gt;
//rohkem juttu&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Now before we begin installing Graylog, we should check what version the machine is actully running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is because this guide is intended for 16.04 version of Ubuntu, If you do already have it, skip to actual installation. People who need to upgrade just continue with the following commands.&lt;br /&gt;
&lt;br /&gt;
Next lets upgrade our machine.&lt;br /&gt;
&lt;br /&gt;
*Start off by updating your package list&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Next lets upgrade everything&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then fix the dependencies with this&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get dist-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*And finish off by finishing the upgrade&lt;br /&gt;
&amp;lt;code&amp;gt; sudo do-release-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to the actual meat of the guide, installing graylog. But we cant just jump into installing Graylog itself, because it needs a few services and a setup base to run it, like Elasticsearch and MongoDB.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Starting off with the setup base.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apt-transport-https openjdk-8-jre-headless uuid-runtime pwgen &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now lets install MongoDB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install mongodb-server &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;Installing Elasticsearch takes a few more commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo &amp;quot;deb https://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install elasticsearch &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;We still need to configure Elasticsearch a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; nano /etc/elasticsearch/elasticsearch.yml &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncomment and change this line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cluster.name: graylog &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;After that, just start the service&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable elasticsearch.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl restart elasticsearch.service &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;Now we actully start installing Graylog itself! Start off by getting the required packages and then installing them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget https://packages.graylog2.org/repo/packages/graylog-2.1-repository_latest.deb &lt;br /&gt;
&lt;br /&gt;
sudo dpkg -i graylog-2.1-repository_latest.deb&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install graylog-server&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;After installing Graylog, we need to add a few extra parts into the configuration file, mainly passwords.&lt;br /&gt;
&lt;br /&gt;
This will generate a password and a sha256sum for it. Do note that the password is required and &#039;&#039;&#039;MUST&#039;&#039;&#039; be 16 characters or longer, otherwise Graylog refuses to function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo -n yourpassword | sha256sum &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The password must be put into &amp;lt;code&amp;gt; /etc/graylog/server/server.conf&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
While in the configuration file, also add your public ip with correct ports into &amp;lt;code&amp;gt; rest_listen_uri &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; web_listen_uri &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;Final steps to enable Graylog.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable graylog-server.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl start graylog-server.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there you have it, one fully installed Graylog, ready for all your logging needs!.&lt;br /&gt;
&lt;br /&gt;
After this, you can explore the web interface at the public ip address you set before and start logging whatever you want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Nagios =&lt;br /&gt;
//juttu&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Before installing Nagios, we need to once again check the version&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This guide is intended for 14.04 ubuntu servers, so if you are higher or lower, upgrade/downgrade appropriately. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installing Nagios is a easier said than done, because it needs alot of stuff in advanced, like a LAMP base.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1)&#039;&#039;&#039;Doing these commands will install Apache, MYSQL and PHP, which are needed for Nagios functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apache2&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install mysql-server php5-mysql&lt;br /&gt;
&lt;br /&gt;
sudo mysql_install_db&lt;br /&gt;
&lt;br /&gt;
sudo mysql_secure_installation&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache2 a bit, go into &amp;lt;code&amp;gt; /etc/apache2/mods-enabled/dir.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change this line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into this line by moving index.php ahead of index.html.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that just restart Apache service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service apache2 restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2)&#039;&#039;&#039;Now we need to make a user and group who will be dealing with using Nagios.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo useradd nagios&lt;br /&gt;
&lt;br /&gt;
sudo groupadd nagcmd&lt;br /&gt;
&lt;br /&gt;
sudo usermod -a -G nagcmd nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3)&#039;&#039;&#039;We can almost move to building the Nagios Core, but first we need a few dependencies.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install build-essential libgd2-xpm-dev openssl libssl-dev xinetd apache2-utils unzip&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4)&#039;&#039;&#039;Now to finally install Nagios itself&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-4.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;5)&#039;&#039;&#039;Move to the newly created folder and type these commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-group=nagios --with-command-group=nagcmd&lt;br /&gt;
 &lt;br /&gt;
make all &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That final command compiled Nagios, but its not fully done just yet. We still need a few more things to install on it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-commandmode&lt;br /&gt;
&lt;br /&gt;
sudo make install-init&lt;br /&gt;
&lt;br /&gt;
sudo make install-config&lt;br /&gt;
&lt;br /&gt;
sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;6)&#039;&#039;&#039;To be able to issue external commands trough the web interface of Nagios, we need to add the web server user into the nagios group&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo usermod -G nagcmd www-data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;7)&#039;&#039;&#039;We will also need Nagios Plugins and NRPE, which are installed in the same fashion as Nagios Core&lt;br /&gt;
&lt;br /&gt;
Nagios Plugins:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-plugins-2.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NRPE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nrpe-2.15.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Building NRPE, needs its xinetd startup script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;make all&lt;br /&gt;
&lt;br /&gt;
sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-xinetd&lt;br /&gt;
&lt;br /&gt;
sudo make install-daemon-config&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;8)&#039;&#039;&#039;We also need to open up the xinetd script in &amp;lt;code&amp;gt;/etc/xinetd.d/nrpe&amp;lt;/code&amp;gt; and add the Nagios servers private/public address to the end of it.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;only_from = 127.0.0.1 192.168.56.200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After modifying the file, restart xinetd&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service xinetd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;9)&#039;&#039;&#039;Now Nagios is fully installed, but still needs more configuring.&lt;br /&gt;
&lt;br /&gt;
Lets start off by going into this file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/nagios.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncommenting this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#cfg_dir=/usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now create the directory that will store the configuration file for each server that you will monitor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;10)&#039;&#039;&#039;Lets also add a command to NRPE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/objects/commands.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the following to the end of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define command{&lt;br /&gt;
        command_name check_nrpe&lt;br /&gt;
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache aswell, so lets enable Apache rewrite and cgi modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
sudo a2enmod cgi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use htpasswd to create an admin user, called &amp;quot;nagiosadmin&amp;quot;, that will be used in getting access to the web interface.&lt;br /&gt;
Set a password when prompted by the command, this username and password will be the main login credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally lets make a symlink between the nagios configuration file and the Apache sites-enabled directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ln -s /etc/apache2/sites-available/nagios.conf /etc/apache2/sites-enabled/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;11)&#039;&#039;&#039;And thats it, Nagios is ready to be started up, just restart the service and add Nagios to start on server booting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios start&lt;br /&gt;
&lt;br /&gt;
sudo service apache2 restart&lt;br /&gt;
&lt;br /&gt;
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats all, now you have a fully (hopefully) working Nagios thanks to following these steps.&lt;br /&gt;
&lt;br /&gt;
You can access the webinterface by going here: &amp;lt;code&amp;gt;http://nagios_server_public_ip/nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;12)&#039;&#039;&#039;But lets not stop there, lets try adding something for Nagios to keep an eye on. To do this, lets swap over to another machine that is in the same network as the Nagios server.&lt;br /&gt;
&lt;br /&gt;
On this other machine, lets install NRPE, it will be needed to make Nagios work on the new machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install nagios-plugins nagios-nrpe-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once NRPE is installed, lets go into the configuration file once again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the nagios server ip to the end of the &amp;lt;code&amp;gt;allowed_hosts=127.0.0.1,&amp;lt;/code&amp;gt; segment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;13)&#039;&#039;&#039;As an example, lets monitor one of our filesystems.&lt;br /&gt;
&lt;br /&gt;
Lets look up the filesystems that we have.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;df -h /&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go back into the NRPE configuration file in &amp;lt;code&amp;gt;/etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt; and change these three lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;server_address=client_private_IP&lt;br /&gt;
allowed_hosts=nagios_server_private_IP (you already set this earlier)&lt;br /&gt;
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p (filesystem that you chose)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dont forget to restart the NRPE service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios-nrpe-server restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14)&#039;&#039;&#039;After all that is done, its time to head back to the machine with the actual Nagios server and the new Host into the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/servers/yourhost.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this file, you need to add this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define host {&lt;br /&gt;
        use                             linux-server&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        alias                           My first Apache server&lt;br /&gt;
        address                         10.132.234.52 (changeme)&lt;br /&gt;
        max_check_attempts              5&lt;br /&gt;
        check_period                    24x7&lt;br /&gt;
        notification_interval           30&lt;br /&gt;
        notification_period             24x7&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
define service {&lt;br /&gt;
        use                             generic-service&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        service_description             PING&lt;br /&gt;
        check_command                   check_ping!100.0,20%!500.0,60%&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always restart services after major changes!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And thats all folks! Now if you were to look at your Nagios web interface, you would be able to see the new host you just added, and also a service tied to said host.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Graylong and Nagios are rather easy to install, albeit a bit time consuming and confusing. But they are still very good services in regards to Logging and Monitoring things.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116327</id>
		<title>Graylog&amp;Nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116327"/>
		<updated>2017-01-04T20:04:04Z</updated>

		<summary type="html">&lt;p&gt;Mhass: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Logging and Monitoring - Graylog and Nagios installation.&lt;br /&gt;
&lt;br /&gt;
Group : Cyber Security Engineering (C21).&lt;br /&gt;
&lt;br /&gt;
Page created by Meelis Hass.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
In this page, I will show how a person can easily install and configure Graylog and Nagios in a timely fashion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Graylog =&lt;br /&gt;
//rohkem juttu&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Now before we begin installing Graylog, we should check what version the machine is actully running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is because this guide is intended for 16.04 version of Ubuntu, If you do already have it, skip to actual installation. People who need to upgrade just continue with the following commands.&lt;br /&gt;
&lt;br /&gt;
Next lets upgrade our machine.&lt;br /&gt;
&lt;br /&gt;
*Start off by updating your package list&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Next lets upgrade everything&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then fix the dependencies with this&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get dist-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*And finish off by finishing the upgrade&lt;br /&gt;
&amp;lt;code&amp;gt; sudo do-release-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to the actual meat of the guide, installing graylog. But we cant just jump into installing Graylog itself, because it needs a few services and a setup base to run it, like Elasticsearch and MongoDB.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Starting off with the setup base.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apt-transport-https openjdk-8-jre-headless uuid-runtime pwgen &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now lets install MongoDB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install mongodb-server &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installing Elasticsearch takes a few more commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo &amp;quot;deb https://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install elasticsearch &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We still need to configure Elasticsearch a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; nano /etc/elasticsearch/elasticsearch.yml &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And uncomment and change this line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cluster.name: graylog &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After that, just start the service&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable elasticsearch.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl restart elasticsearch.service &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now we actully start installing Graylog itself! Start off by getting the required packages and then installing them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget https://packages.graylog2.org/repo/packages/graylog-2.1-repository_latest.deb &lt;br /&gt;
&lt;br /&gt;
sudo dpkg -i graylog-2.1-repository_latest.deb&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install graylog-server&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After installing Graylog, we need to add a few extra parts into the configuration file, mainly passwords.&lt;br /&gt;
&lt;br /&gt;
This will generate a password and a sha256sum for it. Do note that the password is required and &#039;&#039;&#039;MUST&#039;&#039;&#039; be 16 characters or longer, otherwise Graylog refuses to function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo -n yourpassword | sha256sum &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The password must be put into &amp;lt;code&amp;gt; /etc/graylog/server/server.conf&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
While in the configuration file, also add your public ip with correct ports into &amp;lt;code&amp;gt; rest_listen_uri &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; web_listen_uri &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Final steps to enable Graylog.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable graylog-server.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl start graylog-server.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there you have it, one fully installed Graylog, ready for all your logging needs!.&lt;br /&gt;
&lt;br /&gt;
After this, you can explore the web interface at the public ip address you set before and start logging whatever you want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Nagios =&lt;br /&gt;
//juttu&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Before installing Nagios, we need to once again check the version&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This guide is intended for 14.04 ubuntu servers, so if you are higher or lower, upgrade/downgrade appropriately. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installing Nagios is a easier said than done, because it needs alot of stuff in advanced, like a LAMP base.&lt;br /&gt;
&lt;br /&gt;
Doing these commands will install Apache, MYSQL and PHP, which are needed for Nagios functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apache2&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install mysql-server php5-mysql&lt;br /&gt;
&lt;br /&gt;
sudo mysql_install_db&lt;br /&gt;
&lt;br /&gt;
sudo mysql_secure_installation&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache2 a bit, go into &amp;lt;code&amp;gt; /etc/apache2/mods-enabled/dir.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change this line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into this line by moving index.php ahead of index.html.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;IfModule mod_dir.c&amp;gt;&lt;br /&gt;
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that just restart Apache service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service apache2 restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now we need to make a user and group who will be dealing with using Nagios.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo useradd nagios&lt;br /&gt;
&lt;br /&gt;
sudo groupadd nagcmd&lt;br /&gt;
&lt;br /&gt;
sudo usermod -a -G nagcmd nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can almost move to building the Nagios Core, but first we need a few dependencies.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install build-essential libgd2-xpm-dev openssl libssl-dev xinetd apache2-utils unzip&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to finally install Nagios itself&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-4.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder and type these commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-group=nagios --with-command-group=nagcmd&lt;br /&gt;
 &lt;br /&gt;
make all &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That final command compiled Nagios, but its not fully done just yet. We still need a few more things to install on it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-commandmode&lt;br /&gt;
&lt;br /&gt;
sudo make install-init&lt;br /&gt;
&lt;br /&gt;
sudo make install-config&lt;br /&gt;
&lt;br /&gt;
sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To be able to issue external commands trough the web interface of Nagios, we need to add the web server user into the nagios group&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo usermod -G nagcmd www-data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will also need Nagios Plugins and NRPE, which are installed in the same fashion as Nagios Core&lt;br /&gt;
&lt;br /&gt;
Nagios Plugins:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nagios-plugins-2.1.1.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NRPE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz&lt;br /&gt;
&lt;br /&gt;
tar xvf nrpe-2.15.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Move to the newly created folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Building NRPE, needs its xinetd startup script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;make all&lt;br /&gt;
&lt;br /&gt;
sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo make install-xinetd&lt;br /&gt;
&lt;br /&gt;
sudo make install-daemon-config&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We also need to open up the xinetd script in &amp;lt;code&amp;gt;/etc/xinetd.d/nrpe&amp;lt;/code&amp;gt; and add the Nagios servers private/public address to the end of it.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;only_from = 127.0.0.1 192.168.56.200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After modifying the file, restart xinetd&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo service xinetd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now Nagios is fully installed, but still needs more configuring.&lt;br /&gt;
&lt;br /&gt;
Lets start off by going into this file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/nagios.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And uncommenting this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#cfg_dir=/usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now create the directory that will store the configuration file for each server that you will monitor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/nagios/etc/servers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Lets also add a command to NRPE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/objects/commands.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the following to the end of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define command{&lt;br /&gt;
        command_name check_nrpe&lt;br /&gt;
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to configure Apache aswell, so lets enable Apache rewrite and cgi modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
sudo a2enmod cgi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use htpasswd to create an admin user, called &amp;quot;nagiosadmin&amp;quot;, that will be used in getting access to the web interface.&lt;br /&gt;
Set a password when prompted by the command, this username and password will be the main login credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally lets make a symlink between the nagios configuration file and the Apache sites-enabled directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ln -s /etc/apache2/sites-available/nagios.conf /etc/apache2/sites-enabled/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And thats it, Nagios is ready to be started up, just restart the service and add Nagios to start on server booting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios start&lt;br /&gt;
&lt;br /&gt;
sudo service apache2 restart&lt;br /&gt;
&lt;br /&gt;
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats all, now you have a fully (hopefully) working Nagios thanks to following these steps.&lt;br /&gt;
&lt;br /&gt;
You can access the webinterface by going here: &amp;lt;code&amp;gt;http://nagios_server_public_ip/nagios&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But lets not stop there, lets try adding something for Nagios to keep an eye on. To do this, lets swap over to another machine that is in the same network as the Nagios server.&lt;br /&gt;
&lt;br /&gt;
On this other machine, lets install NRPE, it will be needed to make Nagios work on the new machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install nagios-plugins nagios-nrpe-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once NRPE is installed, lets go into the configuration file once again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the nagios server ip to the end of the &amp;lt;code&amp;gt;allowed_hosts=127.0.0.1,&amp;lt;/code&amp;gt; segment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As an example, lets monitor one of our filesystems.&lt;br /&gt;
&lt;br /&gt;
Lets look up the filesystems that we have.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;df -h /&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go back into the NRPE configuration file in &amp;lt;code&amp;gt;/etc/nagios/nrpe.cfg&amp;lt;/code&amp;gt; and change these three lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;server_address=client_private_IP&lt;br /&gt;
allowed_hosts=nagios_server_private_IP (you already set this earlier)&lt;br /&gt;
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p (filesystem that you chose)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dont forget to restart the NRPE service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios-nrpe-server restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After all that is done, its time to head back to the machine with the actual Nagios server and the new Host into the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /usr/local/nagios/etc/servers/yourhost.cfg&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this file, you need to add this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define host {&lt;br /&gt;
        use                             linux-server&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        alias                           My first Apache server&lt;br /&gt;
        address                         10.132.234.52 (changeme)&lt;br /&gt;
        max_check_attempts              5&lt;br /&gt;
        check_period                    24x7&lt;br /&gt;
        notification_interval           30&lt;br /&gt;
        notification_period             24x7&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
define service {&lt;br /&gt;
        use                             generic-service&lt;br /&gt;
        host_name                       yourhost (changeme)&lt;br /&gt;
        service_description             PING&lt;br /&gt;
        check_command                   check_ping!100.0,20%!500.0,60%&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always restart services after major changes!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo service nagios reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And thats all folks! Now if you were to look at your Nagios web interface, you would be able to see the new host you just added, and also a service tied to said host.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
Graylong and Nagios are rather easy to install, albeit a bit time consuming and confusing. But they are still very good services in regards to Logging and Monitoring things.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116326</id>
		<title>Graylog&amp;Nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Graylog%26Nagios&amp;diff=116326"/>
		<updated>2017-01-04T18:19:35Z</updated>

		<summary type="html">&lt;p&gt;Mhass: Created page with &amp;quot;Logging and Monitoring - Graylog and Nagios installation.  Group : Cyber Security Engineering (C21).  Page created by Meelis Hass.  = Introduction =  In this page, I will show...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Logging and Monitoring - Graylog and Nagios installation.&lt;br /&gt;
&lt;br /&gt;
Group : Cyber Security Engineering (C21).&lt;br /&gt;
&lt;br /&gt;
Page created by Meelis Hass.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
In this page, I will show how a person can easily install and configure Graylog and Nagios in a timely fashion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Graylog =&lt;br /&gt;
//rohkem juttu&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Now before we begin installing Graylog, we should check what version the machine is actully running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; lsb_release -a &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is because this guide is intended for 16.04 version of Ubuntu, If you do already have it, skip to actual installation. People who need to upgrade just continue with the following commands.&lt;br /&gt;
&lt;br /&gt;
Next lets upgrade our machine.&lt;br /&gt;
&lt;br /&gt;
*Start off by updating your package list&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Next lets upgrade everything&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then fix the dependencies with this&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get dist-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*And finish off by finishing the upgrade&lt;br /&gt;
&amp;lt;code&amp;gt; sudo do-release-upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to the actual meat of the guide, installing graylog. But we cant just jump into installing Graylog itself, because it needs a few services and a setup base to run it, like Elasticsearch and MongoDB.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Starting off with the setup base.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install apt-transport-https openjdk-8-jre-headless uuid-runtime pwgen &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now lets install MongoDB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get install mongodb-server &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installing Elasticsearch takes a few more commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo &amp;quot;deb https://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install elasticsearch &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We still need to configure Elasticsearch a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; nano /etc/elasticsearch/elasticsearch.yml &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And uncomment and change this line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cluster.name: graylog &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After that, just start the service&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable elasticsearch.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl restart elasticsearch.service &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now we actully start installing Graylog itself! Start off by getting the required packages and then installing them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; wget https://packages.graylog2.org/repo/packages/graylog-2.1-repository_latest.deb &lt;br /&gt;
&lt;br /&gt;
sudo dpkg -i graylog-2.1-repository_latest.deb&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install graylog-server&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After installing Graylog, we need to add a few extra parts into the configuration file, mainly passwords.&lt;br /&gt;
&lt;br /&gt;
This will generate a password and a sha256sum for it. Do note that the password is required and &#039;&#039;&#039;MUST&#039;&#039;&#039; be 16 characters or longer, otherwise Graylog refuses to function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; echo -n yourpassword | sha256sum &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The password must be put into &amp;lt;code&amp;gt; /etc/graylog/server/server.conf&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
While in the configuration file, also add your public ip with correct ports into &amp;lt;code&amp;gt; rest_listen_uri &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; web_listen_uri &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Final steps to enable Graylog.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; sudo systemctl daemon-reload&lt;br /&gt;
&lt;br /&gt;
sudo systemctl enable graylog-server.service&lt;br /&gt;
&lt;br /&gt;
sudo systemctl start graylog-server.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there you have it, one fully installed Graylog, ready for all your logging needs!.&lt;br /&gt;
&lt;br /&gt;
After this, you can explore the web interface at the public ip address you set before and start logging whatever you want.&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Cowsay_English&amp;diff=104587</id>
		<title>Cowsay English</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Cowsay_English&amp;diff=104587"/>
		<updated>2016-06-09T09:12:03Z</updated>

		<summary type="html">&lt;p&gt;Mhass: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Cowsay is a very important program for any up-and-coming Ubuntu user, important in the way that it can starve off boredom for a few seconds. Cowsay runs on Unix-like operating systems, like Linux, and the program can be used by any normal user. Installation can need sudo or root access. Cowsay itself creates an ASCII picture of a cow saying a message the user creates. The program has many functions that let it change the output accordingly, by using specific parameters. Piping outputs of other programs into cowsay is easily doable using the piping command. Cowsay was created by Tony Monroe, in 1999. [https://en.wikipedia.org/wiki/Cowsay [1]][http://web.archive.org/web/20071030081644/http://debaday.debian.net/2007/10/28/cowsay-a-configurable-talking-and-thinking-cow/ [2]]&lt;br /&gt;
&lt;br /&gt;
Over the years, Cowsay became a joke in the hacker culture and has become widespread enough for normal recognition. &lt;br /&gt;
&lt;br /&gt;
[[File:CowsayEng2.PNG]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Syntax and Parameters ==&lt;br /&gt;
&lt;br /&gt;
The average syntax for cowsay consists of:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;cowsay&#039;&#039;&#039; (parameter) (message)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; || &#039;&#039;&#039;Functions&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-d&#039;&#039;&#039;|| Dead cow mode, replaces eyes with &#039;&#039;&#039;X&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-g&#039;&#039;&#039;|| Scrooge McDuck mode, replaces eyes with &#039;&#039;&#039;$&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-p&#039;&#039;&#039;|| Tin foil hat mode (without a hat), replaces eyes with &#039;&#039;&#039;@&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-b&#039;&#039;&#039;|| Borg assimilation mode, turns eyes into &#039;&#039;&#039;==&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-t&#039;&#039;&#039;|| Tired cow mode, replaces eyes with &#039;&#039;&#039;--&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-s&#039;&#039;&#039;|| &amp;quot;Stoned&amp;quot; mode, replaces eyes with &#039;&#039;&#039;*&#039;&#039;&#039;, with an additional tongue&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-w&#039;&#039;&#039;|| Suprised mode, replaces eyes with &#039;&#039;&#039;O&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-y&#039;&#039;&#039;|| Young mode, replaces eyes with &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-f&#039;&#039;&#039; cowfile|| Used to replace the cow with other possible creatures, like sheep or penguins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-e&#039;&#039;&#039; eye_string|| Used to specify the eye string on the cow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-T&#039;&#039;&#039; tongue_string|| Used to specify the tounge usage on the cow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-W&#039;&#039;&#039;|| used to specify the width of the speech baloons&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-n&#039;&#039;&#039;|| used to disable line wrap and to create messages with spaces in them&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Gallery ==&lt;br /&gt;
&lt;br /&gt;
Images were generated at http://textart.io/cowsay, One can do this themselves, should they find the .cow files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CowsayEng3.PNG|A sheep&lt;br /&gt;
File:CowsayEng4.PNG|A tiger&lt;br /&gt;
File:CowsayEng5.PNG|Ghostbusters logo&lt;br /&gt;
File:CowsayEng6.PNG|Darth Moo&lt;br /&gt;
File:CowsayEng7.PNG|Beavis&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
So, all in all, Cowsay is a tool to waste time and have fun with. It is something that can be used in the CLI and can be quicker than launching up a normal game to entertain ones self. The program itself is a known joke in the hacker culture and also has numerous ASCII artist make their works for it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Sources &amp;amp; References ==&lt;br /&gt;
&lt;br /&gt;
[1] https://en.wikipedia.org/wiki/Cowsay&lt;br /&gt;
&lt;br /&gt;
[2] http://web.archive.org/web/20071030081644/http://debaday.debian.net/2007/10/28/cowsay-a-configurable-talking-and-thinking-cow/&lt;br /&gt;
&lt;br /&gt;
http://textart.io/cowsay&lt;br /&gt;
&lt;br /&gt;
Article created by Meelis Hass in the Spring semester of 2016&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Cowsay_English&amp;diff=104586</id>
		<title>Cowsay English</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Cowsay_English&amp;diff=104586"/>
		<updated>2016-06-09T09:05:34Z</updated>

		<summary type="html">&lt;p&gt;Mhass: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Cowsay is a very important program for any up-and-coming Ubuntu user, important in the way that it can starve off boredom for a few seconds. Cowsay runs on Unix-like operating systems, like Linux, and the program can be used by any normal user. Installation can need sudo or root access. Cowsay itself creates an ASCII picture of a cow saying a message the user creates. The program has many functions that let it change the output accordingly, by using specific parameters. Piping outputs of other programs into cowsay is easily doable using the piping command. Cowsay was created by Tony Monroe, in 1999. [1][2]&lt;br /&gt;
&lt;br /&gt;
Over the years, Cowsay became a joke in the hacker culture and has become widespread enough for normal recognition. &lt;br /&gt;
&lt;br /&gt;
[[File:CowsayEng2.PNG]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Syntax and Parameters ==&lt;br /&gt;
&lt;br /&gt;
The average syntax for cowsay consists of:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;cowsay&#039;&#039;&#039; (parameter) (message)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; || &#039;&#039;&#039;Functions&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-d&#039;&#039;&#039;|| Dead cow mode, replaces eyes with &#039;&#039;&#039;X&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-g&#039;&#039;&#039;|| Scrooge McDuck mode, replaces eyes with &#039;&#039;&#039;$&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-p&#039;&#039;&#039;|| Tin foil hat mode (without a hat), replaces eyes with &#039;&#039;&#039;@&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-b&#039;&#039;&#039;|| Borg assimilation mode, turns eyes into &#039;&#039;&#039;==&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-t&#039;&#039;&#039;|| Tired cow mode, replaces eyes with &#039;&#039;&#039;--&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-s&#039;&#039;&#039;|| &amp;quot;Stoned&amp;quot; mode, replaces eyes with &#039;&#039;&#039;*&#039;&#039;&#039;, with an additional tongue&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-w&#039;&#039;&#039;|| Suprised mode, replaces eyes with &#039;&#039;&#039;O&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-y&#039;&#039;&#039;|| Young mode, replaces eyes with &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-f&#039;&#039;&#039; cowfile|| Used to replace the cow with other possible creatures, like sheep or penguins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-e&#039;&#039;&#039; eye_string|| Used to specify the eye string on the cow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-T&#039;&#039;&#039; tongue_string|| Used to specify the tounge usage on the cow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-W&#039;&#039;&#039;|| used to specify the width of the speech baloons&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-n&#039;&#039;&#039;|| used to disable line wrap and to create messages with spaces in them&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Gallery ==&lt;br /&gt;
&lt;br /&gt;
Images were generated at http://textart.io/cowsay, One can do this themselves, should they find the .cow files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CowsayEng3.PNG|A sheep&lt;br /&gt;
File:CowsayEng4.PNG|A tiger&lt;br /&gt;
File:CowsayEng5.PNG|Ghostbusters logo&lt;br /&gt;
File:CowsayEng6.PNG|Darth Moo&lt;br /&gt;
File:CowsayEng7.PNG|Beavis&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
So, all in all, Cowsay is a tool to waste time and have fun with. It is something that can be used in the CLI and can be quicker than launching up a normal game to entertain ones self. The program itself is a known joke in the hacker culture and also has numerous ASCII artist make their works for it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Sources &amp;amp; References ==&lt;br /&gt;
&lt;br /&gt;
[1] https://en.wikipedia.org/wiki/Cowsay&lt;br /&gt;
&lt;br /&gt;
[2] http://web.archive.org/web/20071030081644/http://debaday.debian.net/2007/10/28/cowsay-a-configurable-talking-and-thinking-cow/&lt;br /&gt;
&lt;br /&gt;
http://textart.io/cowsay&lt;br /&gt;
&lt;br /&gt;
Article created by Meelis Hass in the Spring semester of 2016&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Cowsay_English&amp;diff=104585</id>
		<title>Cowsay English</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Cowsay_English&amp;diff=104585"/>
		<updated>2016-06-09T09:05:02Z</updated>

		<summary type="html">&lt;p&gt;Mhass: Added references&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Cowsay is a very important program for any up-and-coming Ubuntu user, important in the way that it can starve off boredom for a few seconds. Cowsay runs on Unix-like operating systems, like Linux, and the program can be used by any normal user. Installation can need sudo or root access. Cowsay itself creates an ASCII picture of a cow saying a message the user creates. The program has many functions that let it change the output accordingly, by using specific parameters. Piping outputs of other programs into cowsay is easily doable using the piping command. Cowsay was created by Tony Monroe, in 1999.[1,2]&lt;br /&gt;
&lt;br /&gt;
Over the years, Cowsay became a joke in the hacker culture and has become widespread enough for normal recognition. &lt;br /&gt;
&lt;br /&gt;
[[File:CowsayEng2.PNG]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Syntax and Parameters ==&lt;br /&gt;
&lt;br /&gt;
The average syntax for cowsay consists of:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;cowsay&#039;&#039;&#039; (parameter) (message)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; || &#039;&#039;&#039;Functions&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-d&#039;&#039;&#039;|| Dead cow mode, replaces eyes with &#039;&#039;&#039;X&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-g&#039;&#039;&#039;|| Scrooge McDuck mode, replaces eyes with &#039;&#039;&#039;$&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-p&#039;&#039;&#039;|| Tin foil hat mode (without a hat), replaces eyes with &#039;&#039;&#039;@&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-b&#039;&#039;&#039;|| Borg assimilation mode, turns eyes into &#039;&#039;&#039;==&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-t&#039;&#039;&#039;|| Tired cow mode, replaces eyes with &#039;&#039;&#039;--&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-s&#039;&#039;&#039;|| &amp;quot;Stoned&amp;quot; mode, replaces eyes with &#039;&#039;&#039;*&#039;&#039;&#039;, with an additional tongue&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-w&#039;&#039;&#039;|| Suprised mode, replaces eyes with &#039;&#039;&#039;O&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-y&#039;&#039;&#039;|| Young mode, replaces eyes with &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-f&#039;&#039;&#039; cowfile|| Used to replace the cow with other possible creatures, like sheep or penguins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-e&#039;&#039;&#039; eye_string|| Used to specify the eye string on the cow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-T&#039;&#039;&#039; tongue_string|| Used to specify the tounge usage on the cow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-W&#039;&#039;&#039;|| used to specify the width of the speech baloons&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-n&#039;&#039;&#039;|| used to disable line wrap and to create messages with spaces in them&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Gallery ==&lt;br /&gt;
&lt;br /&gt;
Images were generated at http://textart.io/cowsay, One can do this themselves, should they find the .cow files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CowsayEng3.PNG|A sheep&lt;br /&gt;
File:CowsayEng4.PNG|A tiger&lt;br /&gt;
File:CowsayEng5.PNG|Ghostbusters logo&lt;br /&gt;
File:CowsayEng6.PNG|Darth Moo&lt;br /&gt;
File:CowsayEng7.PNG|Beavis&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
So, all in all, Cowsay is a tool to waste time and have fun with. It is something that can be used in the CLI and can be quicker than launching up a normal game to entertain ones self. The program itself is a known joke in the hacker culture and also has numerous ASCII artist make their works for it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Sources &amp;amp; References ==&lt;br /&gt;
&lt;br /&gt;
[1] https://en.wikipedia.org/wiki/Cowsay&lt;br /&gt;
&lt;br /&gt;
[2] http://web.archive.org/web/20071030081644/http://debaday.debian.net/2007/10/28/cowsay-a-configurable-talking-and-thinking-cow/&lt;br /&gt;
&lt;br /&gt;
http://textart.io/cowsay&lt;br /&gt;
&lt;br /&gt;
Article created by Meelis Hass in the Spring semester of 2016&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Cowsay_English&amp;diff=104339</id>
		<title>Cowsay English</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Cowsay_English&amp;diff=104339"/>
		<updated>2016-06-05T15:53:37Z</updated>

		<summary type="html">&lt;p&gt;Mhass: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Cowsay is a very important program for any up-and-coming Ubuntu user, important in the way that it can starve off boredom for a few seconds. Cowsay runs on Unix-like operating systems, like Linux, and the program can be used by any normal user. Installation can need sudo or root access. Cowsay itself creates an ASCII picture of a cow saying a message the user creates. The program has many functions that let it change the output accordingly, by using specific parameters. Piping outputs of other programs into cowsay is easily doable using the piping command. Cowsay was created by Tony Monroe, in 1999.&lt;br /&gt;
&lt;br /&gt;
Over the years, Cowsay became a joke in the hacker culture and has become widespread enough for normal recognition. &lt;br /&gt;
&lt;br /&gt;
[[File:CowsayEng2.PNG]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Syntax and Parameters ==&lt;br /&gt;
&lt;br /&gt;
The average syntax for cowsay consists of:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;cowsay&#039;&#039;&#039; (parameter) (message)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; || &#039;&#039;&#039;Functions&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-d&#039;&#039;&#039;|| Dead cow mode, replaces eyes with &#039;&#039;&#039;X&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-g&#039;&#039;&#039;|| Scrooge McDuck mode, replaces eyes with &#039;&#039;&#039;$&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-p&#039;&#039;&#039;|| Tin foil hat mode (without a hat), replaces eyes with &#039;&#039;&#039;@&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-b&#039;&#039;&#039;|| Borg assimilation mode, turns eyes into &#039;&#039;&#039;==&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-t&#039;&#039;&#039;|| Tired cow mode, replaces eyes with &#039;&#039;&#039;--&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-s&#039;&#039;&#039;|| &amp;quot;Stoned&amp;quot; mode, replaces eyes with &#039;&#039;&#039;*&#039;&#039;&#039;, with an additional tongue&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-w&#039;&#039;&#039;|| Suprised mode, replaces eyes with &#039;&#039;&#039;O&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-y&#039;&#039;&#039;|| Young mode, replaces eyes with &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-f&#039;&#039;&#039; cowfile|| Used to replace the cow with other possible creatures, like sheep or penguins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-e&#039;&#039;&#039; eye_string|| Used to specify the eye string on the cow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-T&#039;&#039;&#039; tongue_string|| Used to specify the tounge usage on the cow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-W&#039;&#039;&#039;|| used to specify the width of the speech baloons&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-n&#039;&#039;&#039;|| used to disable line wrap and to create messages with spaces in them&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Gallery ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CowsayEng3.PNG|A sheep&lt;br /&gt;
File:CowsayEng4.PNG|A tiger&lt;br /&gt;
File:CowsayEng5.PNG|Ghostbusters logo&lt;br /&gt;
File:CowsayEng6.PNG|Darth Moo&lt;br /&gt;
File:CowsayEng7.PNG|Beavis&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
So, all in all, Cowsay is a tool to waste time and have fun with. It is something that can be used in the CLI and can be quicker than launching up a normal game to entertain ones self. The program itself is a known joke in the hacker culture and also has numerous ASCII artist make their works for it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Sources ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://web.archive.org/web/20071030081644/http://debaday.debian.net/2007/10/28/cowsay-a-configurable-talking-and-thinking-cow/&lt;br /&gt;
&lt;br /&gt;
http://textart.io/cowsay&lt;br /&gt;
&lt;br /&gt;
Article created by Meelis Hass in the Spring semester of 2016&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Cowsay_English&amp;diff=104338</id>
		<title>Cowsay English</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Cowsay_English&amp;diff=104338"/>
		<updated>2016-06-05T15:48:13Z</updated>

		<summary type="html">&lt;p&gt;Mhass: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Cowsay is a very important program for any up-and-coming Ubuntu user, important in the way that it can starve off boredom for a few seconds. Cowsay runs on Unix-like operating systems, like Linux. The program can be used by any normal user. Cowsay itself creates an ASCII picture of a cow saying a message the user creates. The program has many functions that let it change the output accordingly, by using specific parameters. Piping outputs of other programs into cowsay is easily doable using the piping command. Cowsay was created by Tony Monroe, in 1999.&lt;br /&gt;
&lt;br /&gt;
Over the years, Cowsay became a joke in the hacker culture and has become widespread enough for normal recognition. &lt;br /&gt;
&lt;br /&gt;
[[File:CowsayEng2.PNG]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Syntax and Parameters ==&lt;br /&gt;
&lt;br /&gt;
The average syntax for cowsay consists of:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;cowsay&#039;&#039;&#039; (parameter) (message)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; || &#039;&#039;&#039;Functions&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-d&#039;&#039;&#039;|| Dead cow mode, replaces eyes with &#039;&#039;&#039;X&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-g&#039;&#039;&#039;|| Scrooge McDuck mode, replaces eyes with &#039;&#039;&#039;$&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-p&#039;&#039;&#039;|| Tin foil hat mode (without a hat), replaces eyes with &#039;&#039;&#039;@&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-b&#039;&#039;&#039;|| Borg assimilation mode, turns eyes into &#039;&#039;&#039;==&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-t&#039;&#039;&#039;|| Tired cow mode, replaces eyes with &#039;&#039;&#039;--&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-s&#039;&#039;&#039;|| &amp;quot;Stoned&amp;quot; mode, replaces eyes with &#039;&#039;&#039;*&#039;&#039;&#039;, with an additional tongue&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-w&#039;&#039;&#039;|| Suprised mode, replaces eyes with &#039;&#039;&#039;O&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-y&#039;&#039;&#039;|| Young mode, replaces eyes with &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-f&#039;&#039;&#039; cowfile|| Used to replace the cow with other possible creatures, like sheep or penguins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-e&#039;&#039;&#039; eye_string|| Used to specify the eye string on the cow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-T&#039;&#039;&#039; tongue_string|| Used to specify the tounge usage on the cow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-W&#039;&#039;&#039;|| used to specify the width of the speech baloons&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-n&#039;&#039;&#039;|| used to disable line wrap and to create messages with spaces in them&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Gallery ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CowsayEng3.PNG|A sheep&lt;br /&gt;
File:CowsayEng4.PNG|A tiger&lt;br /&gt;
File:CowsayEng5.PNG|Ghostbusters logo&lt;br /&gt;
File:CowsayEng6.PNG|Darth Moo&lt;br /&gt;
File:CowsayEng7.PNG|Beavis&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
So, all in all, Cowsay is a tool to waste time and have fun with. It is something that can be used in the CLI and can be quicker than launching up a normal game to entertain ones self. The program itself is a known joke in the hacker culture and also has numerous ASCII artist make their works for it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Sources ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://web.archive.org/web/20071030081644/http://debaday.debian.net/2007/10/28/cowsay-a-configurable-talking-and-thinking-cow/&lt;br /&gt;
&lt;br /&gt;
http://textart.io/cowsay&lt;br /&gt;
&lt;br /&gt;
Article created by Meelis Hass in the Spring semester of 2016&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Cowsay_English&amp;diff=104337</id>
		<title>Cowsay English</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Cowsay_English&amp;diff=104337"/>
		<updated>2016-06-05T15:45:36Z</updated>

		<summary type="html">&lt;p&gt;Mhass: /* Sources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Cowsay is a very important program for any up-and-coming Ubuntu user, important in the way that it can starve off boredom for a few seconds. Cowsay runs on Unix-like operating systems, like Linux. The program can be used by any normal user. Cowsay itself creates an ASCII picture of a cow saying a message the user creates. The program has many functions that let it change the output accordingly, by using specific parameters. Piping outputs of other programs into cowsay is easily doable using the piping command. Cowsay was created by Tony Monroe, in 1999.&lt;br /&gt;
&lt;br /&gt;
Over the years, Cowsay became a joke in the hacker culture and has become widespread enough for normal recognition. &lt;br /&gt;
&lt;br /&gt;
[[File:CowsayEng2.PNG]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Syntax and Parameters ==&lt;br /&gt;
&lt;br /&gt;
The average syntax for cowsay consists of:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;cowsay&#039;&#039;&#039; (parameter) (message)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; || &#039;&#039;&#039;Functions&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-d&#039;&#039;&#039;|| Dead cow mode, replaces eyes with &#039;&#039;&#039;X&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-g&#039;&#039;&#039;|| Scrooge McDuck mode, replaces eyes with &#039;&#039;&#039;$&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-p&#039;&#039;&#039;|| Tin foil hat mode (without a hat), replaces eyes with &#039;&#039;&#039;@&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-b&#039;&#039;&#039;|| Borg assimilation mode, turns eyes into &#039;&#039;&#039;==&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-t&#039;&#039;&#039;|| Tired cow mode, replaces eyes with &#039;&#039;&#039;--&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-s&#039;&#039;&#039;|| &amp;quot;Stoned&amp;quot; mode, replaces eyes with &#039;&#039;&#039;*&#039;&#039;&#039;, with an additional tongue&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-w&#039;&#039;&#039;|| Suprised mode, replaces eyes with &#039;&#039;&#039;O&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-y&#039;&#039;&#039;|| Young mode, replaces eyes with &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-f&#039;&#039;&#039; cowfile|| Used to replace the cow with other possible creatures, like sheep or penguins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-e&#039;&#039;&#039; eye_string|| Used to specify the eye string on the cow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-T&#039;&#039;&#039; tongue_string|| Used to specify the tounge usage on the cow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-W&#039;&#039;&#039;|| used to specify the width of the speech baloons&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-n&#039;&#039;&#039;|| used to disable line wrap and to create messages with spaces in them&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Gallery ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CowsayEng3.PNG|A sheep&lt;br /&gt;
File:CowsayEng4.PNG|A tiger&lt;br /&gt;
File:CowsayEng5.PNG|Ghostbusters logo&lt;br /&gt;
File:CowsayEng6.PNG|Darth Moo&lt;br /&gt;
File:CowsayEng7.PNG|Beavis&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Sources ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://web.archive.org/web/20071030081644/http://debaday.debian.net/2007/10/28/cowsay-a-configurable-talking-and-thinking-cow/&lt;br /&gt;
&lt;br /&gt;
http://textart.io/cowsay&lt;br /&gt;
&lt;br /&gt;
Article created by Meelis Hass in the Spring semester of 2016&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Cowsay_English&amp;diff=104336</id>
		<title>Cowsay English</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Cowsay_English&amp;diff=104336"/>
		<updated>2016-06-05T15:40:58Z</updated>

		<summary type="html">&lt;p&gt;Mhass: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Cowsay is a very important program for any up-and-coming Ubuntu user, important in the way that it can starve off boredom for a few seconds. Cowsay runs on Unix-like operating systems, like Linux. The program can be used by any normal user. Cowsay itself creates an ASCII picture of a cow saying a message the user creates. The program has many functions that let it change the output accordingly, by using specific parameters. Piping outputs of other programs into cowsay is easily doable using the piping command. Cowsay was created by Tony Monroe, in 1999.&lt;br /&gt;
&lt;br /&gt;
Over the years, Cowsay became a joke in the hacker culture and has become widespread enough for normal recognition. &lt;br /&gt;
&lt;br /&gt;
[[File:CowsayEng2.PNG]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Syntax and Parameters ==&lt;br /&gt;
&lt;br /&gt;
The average syntax for cowsay consists of:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;cowsay&#039;&#039;&#039; (parameter) (message)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; || &#039;&#039;&#039;Functions&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-d&#039;&#039;&#039;|| Dead cow mode, replaces eyes with &#039;&#039;&#039;X&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-g&#039;&#039;&#039;|| Scrooge McDuck mode, replaces eyes with &#039;&#039;&#039;$&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-p&#039;&#039;&#039;|| Tin foil hat mode (without a hat), replaces eyes with &#039;&#039;&#039;@&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-b&#039;&#039;&#039;|| Borg assimilation mode, turns eyes into &#039;&#039;&#039;==&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-t&#039;&#039;&#039;|| Tired cow mode, replaces eyes with &#039;&#039;&#039;--&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-s&#039;&#039;&#039;|| &amp;quot;Stoned&amp;quot; mode, replaces eyes with &#039;&#039;&#039;*&#039;&#039;&#039;, with an additional tongue&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-w&#039;&#039;&#039;|| Suprised mode, replaces eyes with &#039;&#039;&#039;O&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-y&#039;&#039;&#039;|| Young mode, replaces eyes with &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-f&#039;&#039;&#039; cowfile|| Used to replace the cow with other possible creatures, like sheep or penguins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-e&#039;&#039;&#039; eye_string|| Used to specify the eye string on the cow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-T&#039;&#039;&#039; tongue_string|| Used to specify the tounge usage on the cow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-W&#039;&#039;&#039;|| used to specify the width of the speech baloons&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-n&#039;&#039;&#039;|| used to disable line wrap and to create messages with spaces in them&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Gallery ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CowsayEng3.PNG|A sheep&lt;br /&gt;
File:CowsayEng4.PNG|A tiger&lt;br /&gt;
File:CowsayEng5.PNG|Ghostbusters logo&lt;br /&gt;
File:CowsayEng6.PNG|Darth Moo&lt;br /&gt;
File:CowsayEng7.PNG|Beavis&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[1] http://web.archive.org/web/20071030081644/http://debaday.debian.net/2007/10/28/cowsay-a-configurable-talking-and-thinking-cow/&lt;br /&gt;
&lt;br /&gt;
[2] http://textart.io/cowsay&lt;br /&gt;
&lt;br /&gt;
Article created by Meelis Hass in the Spring semester of 2016&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Cowsay_English&amp;diff=104335</id>
		<title>Cowsay English</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Cowsay_English&amp;diff=104335"/>
		<updated>2016-06-05T15:40:10Z</updated>

		<summary type="html">&lt;p&gt;Mhass: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Cowsay is a very important program for any up-and-coming Ubuntu user, important in the way that it can starve off boredom for a few seconds. Cowsay runs on Unix-like operating systems, like Linux. The program can be used by any normal user. Cowsay itself creates an ASCII picture of a cow saying a message the user creates. The program has many functions that let it change the output accordingly, by using specific parameters. Piping outputs of other programs into cowsay is easily doable using the piping command. Cowsay was created by Tony Monroe, in 1999.&lt;br /&gt;
&lt;br /&gt;
Over the years, Cowsay became a joke in the hacker culture and has become widespread enough for normal recognition. &lt;br /&gt;
&lt;br /&gt;
[[File:CowsayEng2.PNG]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Syntax and Parameters ==&lt;br /&gt;
&lt;br /&gt;
The average syntax for cowsay consists of:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;cowsay&#039;&#039;&#039; (parameter) (message)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; || &#039;&#039;&#039;Functions&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-d&#039;&#039;&#039;|| Dead cow mode, replaces eyes with &#039;&#039;&#039;X&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-g&#039;&#039;&#039;|| Scrooge McDuck mode, replaces eyes with &#039;&#039;&#039;$&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-p&#039;&#039;&#039;|| Tin foil hat mode (without a hat), replaces eyes with &#039;&#039;&#039;@&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-b&#039;&#039;&#039;|| Borg assimilation mode, turns eyes into &#039;&#039;&#039;==&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-t&#039;&#039;&#039;|| Tired cow mode, replaces eyes with &#039;&#039;&#039;--&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-s&#039;&#039;&#039;|| &amp;quot;Stoned&amp;quot; mode, replaces eyes with &#039;&#039;&#039;*&#039;&#039;&#039;, with an additional tongue&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-w&#039;&#039;&#039;|| Suprised mode, replaces eyes with &#039;&#039;&#039;O&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-y&#039;&#039;&#039;|| Young mode, replaces eyes with &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-f&#039;&#039;&#039; cowfile|| Used to replace the cow with other possible creatures, like sheep or penguins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-e&#039;&#039;&#039; eye_string|| Used to specify the eye string on the cow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-T&#039;&#039;&#039; tongue_string|| Used to specify the tounge usage on the cow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-W&#039;&#039;&#039;|| used to specify the width of the speech baloons&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-n&#039;&#039;&#039;|| used to disable line wrap and to create messages with spaces in them&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Gallery ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CowsayEng3.PNG|A sheep&lt;br /&gt;
File:CowsayEng4.PNG|A tiger&lt;br /&gt;
File:CowsayEng5.PNG|Ghostbusters logo&lt;br /&gt;
File:CowsayEng6.PNG|Darth Moo&lt;br /&gt;
File:CowsayEng7.PNG|Beavis&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://web.archive.org/web/20071030081644/http://debaday.debian.net/2007/10/28/cowsay-a-configurable-talking-and-thinking-cow/&lt;br /&gt;
&lt;br /&gt;
http://textart.io/cowsay&lt;br /&gt;
&lt;br /&gt;
Article created by Meelis Hass in the Spring semester of 2016&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Cowsay_English&amp;diff=103323</id>
		<title>Cowsay English</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Cowsay_English&amp;diff=103323"/>
		<updated>2016-05-08T16:17:39Z</updated>

		<summary type="html">&lt;p&gt;Mhass: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Cowsay is a very important program for any up-and-coming Ubuntu user, important in the way that it can starve off boredom for a few seconds. Cowsay itself creates an ASCII picture of a cow saying a message the user creates. The program has many functions that let it change the output accordingly, by using specific parameters. Piping outputs of other programs into cowsay is easily doable using the piping command. Cowsay was created by Tony Monroe, in 1999.&lt;br /&gt;
&lt;br /&gt;
Over the years, Cowsay became a joke in the hacker culture and has become widespread enough for normal recognition. &lt;br /&gt;
&lt;br /&gt;
[[File:CowsayEng2.PNG]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Syntax and Parameters ==&lt;br /&gt;
&lt;br /&gt;
The average syntax for cowsay consists of:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;cowsay&#039;&#039;&#039; (parameter) (message)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; || &#039;&#039;&#039;Functions&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-d&#039;&#039;&#039;|| Dead cow mode, replaces eyes with &#039;&#039;&#039;X&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-g&#039;&#039;&#039;|| Scrooge McDuck mode, replaces eyes with &#039;&#039;&#039;$&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-p&#039;&#039;&#039;|| Tin foil hat mode (without a hat), replaces eyes with &#039;&#039;&#039;@&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-b&#039;&#039;&#039;|| Borg assimilation mode, turns eyes into &#039;&#039;&#039;==&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-t&#039;&#039;&#039;|| Tired cow mode, replaces eyes with &#039;&#039;&#039;--&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-s&#039;&#039;&#039;|| &amp;quot;Stoned&amp;quot; mode, replaces eyes with &#039;&#039;&#039;*&#039;&#039;&#039;, with an additional tongue&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-w&#039;&#039;&#039;|| Suprised mode, replaces eyes with &#039;&#039;&#039;O&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-y&#039;&#039;&#039;|| Young mode, replaces eyes with &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-f&#039;&#039;&#039; cowfile|| Used to replace the cow with other possible creatures, like sheep or penguins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-e&#039;&#039;&#039; eye_string|| Used to specify the eye string on the cow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-T&#039;&#039;&#039; tongue_string|| Used to specify the tounge usage on the cow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-W&#039;&#039;&#039;|| used to specify the width of the speech baloons&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-n&#039;&#039;&#039;|| used to disable line wrap and to create messages with spaces in them&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Gallery ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CowsayEng3.PNG|A sheep&lt;br /&gt;
File:CowsayEng4.PNG|A tiger&lt;br /&gt;
File:CowsayEng5.PNG|Ghostbusters logo&lt;br /&gt;
File:CowsayEng6.PNG|Darth Moo&lt;br /&gt;
File:CowsayEng7.PNG|Beavis&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://web.archive.org/web/20071030081644/http://debaday.debian.net/2007/10/28/cowsay-a-configurable-talking-and-thinking-cow/&lt;br /&gt;
&lt;br /&gt;
http://textart.io/cowsay&lt;br /&gt;
&lt;br /&gt;
Article created by Meelis Hass in the Spring semester of 2016&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Operating_systems&amp;diff=103322</id>
		<title>Operating systems</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Operating_systems&amp;diff=103322"/>
		<updated>2016-05-08T16:13:25Z</updated>

		<summary type="html">&lt;p&gt;Mhass: /* Wiki article information */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Operating systems subject related info=&lt;br /&gt;
&lt;br /&gt;
Lecturer: &lt;br /&gt;
&lt;br /&gt;
Katrin Loodus (katrin.loodus@itcollege.ee) &lt;br /&gt;
&lt;br /&gt;
Room 516 (5th floor), phone (6285) 834&lt;br /&gt;
&lt;br /&gt;
All subject related infotmation will be put up on Wiki page, due to the possibility to have access to the materials even after the subject has concluded. Materials, such as tests, lectures and links to additional materials, will remain available throughout the subject teaching period. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Aim of this course=&lt;br /&gt;
&lt;br /&gt;
The aim of this course is to introduce the basics of operating systems and IT system life cycle from the viewpoint of the IT system administrator of operating systems. This subject provides hands-on skills needed to complete other field specific subjects in the curriculum.&lt;br /&gt;
&lt;br /&gt;
Lectures give a theoretical background and the labs give hands-on skills on the same topic using Ubuntu Linux Server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This subject is oriented on hands-on practical assignments to compliment the theoretical side of the subject.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Learning outcome 1: &lt;br /&gt;
&lt;br /&gt;
A student who has completed the subject is able to perform the most common administrative tasks (user management, software management, disk usage, process management) in at least one of the most popular operating system on a server.&lt;br /&gt;
&lt;br /&gt;
Learning outcome 2: &lt;br /&gt;
&lt;br /&gt;
A student who has completed the subject understands and is able to explain orally the basic concepts of operating systems and its security aspects.&lt;br /&gt;
&lt;br /&gt;
Learning outcome 3: &lt;br /&gt;
&lt;br /&gt;
The student is able to document an operating system&#039;s service from an IT systems administrator&#039;s viewpoint.&lt;br /&gt;
&lt;br /&gt;
=Deadlines for assignments 2016=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;03.04.2016&#039;&#039;&#039; - Submission of wiki article&#039;s topic (Sending an e-mail with the chosen topic is mandatory!)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;08.05.2016 23:59&#039;&#039;&#039; - Submission of wiki article and sending an e-mail to the lecturer in order to get it graded&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;10.05.2016&#039;&#039;&#039; - Pre practical test for students, who have done all of their labs&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;23.05.2016&#039;&#039;&#039; - Last option to defend lab work (Lab1 and/or Lab2)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;24.05.2016&#039;&#039;&#039; - Practical test&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;09.06.2016 at 09:00&#039;&#039;&#039; - Both practical and oral exams are in room 319&lt;br /&gt;
&lt;br /&gt;
All dates are inclusive.&lt;br /&gt;
&lt;br /&gt;
=(Occasional) Homework=&lt;br /&gt;
&lt;br /&gt;
==Week 0 &amp;amp; 1==&lt;br /&gt;
&lt;br /&gt;
Get familiar with the Unix command line by trying out this Codeacadamy [https://www.codecademy.com/learn/learn-the-command-line short course].&lt;br /&gt;
&lt;br /&gt;
==Week 11==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;&lt;br /&gt;
This homework is voluntary! &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please test these online courses (especially user management) in https://rangeforce.com environment and send the lecturer feedback you feel you would like to share. It can be about the content, the environment, spelling, storyline etc. &lt;br /&gt;
&lt;br /&gt;
The promo code to get access to the courses is &#039;&#039;&#039;EIK2016&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please send the feedback to my e-mail address: &#039;&#039;&#039;kloodus@itcollege.ee&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Thank you!&lt;br /&gt;
&lt;br /&gt;
=Timetable for lectures 2016=&lt;br /&gt;
&lt;br /&gt;
Public chat for any subject related questions that were left unasked during the lecture: https://chatlink.com/#osadmin_ITKolledz&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;&lt;br /&gt;
Link to lecture and lab captures:&amp;lt;/span&amp;gt; [https://echo360.e-ope.ee/ess/portal/section/d38715c3-2cc6-43ee-bc1c-818df79d0b41 Go to captures]&lt;br /&gt;
&lt;br /&gt;
==Lecture 0==&lt;br /&gt;
February 09th 2016 [http://enos.itcollege.ee/~kloodus/opsys/lecture00%20-%20Introduction%20-%202016.odp Lecture 0 - Introduction to subject (OpenDocument)] [http://enos.itcollege.ee/~kloodus/opsys/lecture00%20-%20Introduction%20-%202016.pdf (PDF) ]&lt;br /&gt;
&lt;br /&gt;
[http://enos.itcollege.ee/~kloodus/opsys/test_answers_spring2016.txt Test answers].&lt;br /&gt;
&lt;br /&gt;
==Lecture 1==&lt;br /&gt;
&lt;br /&gt;
February 12th 2016 [http://enos.itcollege.ee/~kloodus/opsys/lecture01%20-%20OS%20introduction.odp Lecture 1 - Operating systems introduction (OpenDocument)] [http://enos.itcollege.ee/~kloodus/opsys/lecture01%20-%20OS%20introduction.pdf (PDF) ]&lt;br /&gt;
&lt;br /&gt;
* Lecture will be on the February 12th at 8:15 in room 219&lt;br /&gt;
&lt;br /&gt;
* Practice will be on the same day at 10:00 in room 410&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt; Homereading materials:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/playlist?list=PLmbPuZ0NsyGS8ef6zaHd2qYylzsHxL63x Introduction to operating systems (videos)]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Operating_system Operating systems (wikipedia article)]&lt;br /&gt;
&lt;br /&gt;
==Lecture 2==&lt;br /&gt;
&lt;br /&gt;
February 16th 2016 [http://enos.itcollege.ee/~kloodus/opsys/lecture02%20-%20user%20management.odp Lecture 2 - User management (OpenDocument)] [http://enos.itcollege.ee/~kloodus/opsys/lecture02%20-%20user%20management.pdf (PDF) ]&lt;br /&gt;
&lt;br /&gt;
==Lecture 3==&lt;br /&gt;
&lt;br /&gt;
February 23rd 2016 [http://enos.itcollege.ee/~kloodus/opsys/lecture03%20-%20managing%20files%20-%202016.odp Lecture 3 - File permissions (OpenDocument)] [http://enos.itcollege.ee/~kloodus/opsys/lecture03%20-%20managing%20files%20-%202016.pdf (PDF)]&lt;br /&gt;
&lt;br /&gt;
==Lecture 4==&lt;br /&gt;
March 1st 2016 [http://enos.itcollege.ee/~kloodus/opsys/lecture04%20-%20user%20environment%20and%20processes%20-%202016.odp Lecture 4 - User environment and processes (OpenDocument)] [http://enos.itcollege.ee/~kloodus/opsys/lecture04%20-%20user%20environment%20and%20processes%20-%202016.pdf (PDF)]&lt;br /&gt;
&lt;br /&gt;
==Lecture 5==&lt;br /&gt;
&lt;br /&gt;
March 8th 2016 Lecture 5 - [http://enos.itcollege.ee/~kloodus/opsys/lecture05%20-%20FHS%20and%20links%20-%202016.odp Filesystem Hierarchy (OpenDocument)] [http://enos.itcollege.ee/~kloodus/opsys/lecture05%20-%20FHS%20and%20links%20-%202016.pdf (PDF)]&lt;br /&gt;
&lt;br /&gt;
==Lecture 6==&lt;br /&gt;
&lt;br /&gt;
March 15th 2016 [http://enos.itcollege.ee/~kloodus/opsys/lecture06%20-%20Software%20management%20-%202016.odp Lecture 6 - Software management (OpenDocument)] [http://enos.itcollege.ee/~kloodus/opsys/lecture06%20-%20Software%20management%20-%202016.pdf (PDF)]&lt;br /&gt;
&lt;br /&gt;
==Lecture 7==&lt;br /&gt;
&lt;br /&gt;
March 22nd 2016 - [http://enos.itcollege.ee/~kloodus/opsys/lecture07%20-%20Documentation%20-%202016.odp Lecture 7 - Documentation (OpenDocument)] [http://enos.itcollege.ee/~kloodus/opsys/lecture07%20-%20Documentation%20-%202016.pdf (PDF)]&lt;br /&gt;
&lt;br /&gt;
==Lecture 8==&lt;br /&gt;
&lt;br /&gt;
April 5th 2016 - [http://enos.itcollege.ee/~kloodus/opsys/lecture08%20-%20Security%20session%20-%202016.odp Lecture 8 - Security session (OpenDocument)] [http://enos.itcollege.ee/~kloodus/opsys/lecture08%20-%20Security%20session%20-%202016.pdf (PDF)]&lt;br /&gt;
&lt;br /&gt;
==Lecture 9==&lt;br /&gt;
&lt;br /&gt;
April 12th 2016 - No lecture nor labs - Lecturer is away &lt;br /&gt;
&lt;br /&gt;
Substitute lecture and lab time will be announced later&lt;br /&gt;
&lt;br /&gt;
==Lecture 10==&lt;br /&gt;
&lt;br /&gt;
April 19th 2016 - [http://enos.itcollege.ee/~kloodus/opsys/lecture10%20-%20Disks%20and%20Swap%20-%202016.odp Lecture 10 - Disks, partitions and swap area (Open Document)] [http://enos.itcollege.ee/~kloodus/opsys/lecture10%20-%20Disks%20and%20Swap%20-%202016.pdf (PDF)]&lt;br /&gt;
&lt;br /&gt;
==Lecture 11==&lt;br /&gt;
&lt;br /&gt;
April 26th 2016 - [http://enos.itcollege.ee/~kloodus/opsys/lecture11%20-%20RAID,LVM,SAN,NAS%20-%202016.odp Lecture 11 - RAID; LVM, SAN and NAS technologies (Open Document)] [http://enos.itcollege.ee/~kloodus/opsys/lecture11%20-%20RAID,LVM,SAN,NAS%20-%202016.pdf (PDF)]&lt;br /&gt;
&lt;br /&gt;
==Lecture 12==&lt;br /&gt;
May 3rd 2016 - [http://enos.itcollege.ee/~kloodus/opsys/lecture12%20-%20DAS,SAN,NAS,CAS-%202016.odp Lecture 12 - DAS, SAN, NAS and CAS (group work) technologies (cont.) (OpenDocument)] [http://enos.itcollege.ee/~kloodus/opsys/lecture12%20-%20DAS,SAN,NAS,CAS-%202016.pdf (PDF)]&lt;br /&gt;
&lt;br /&gt;
[[http://www.slideshare.net/pranayakumar1986/network-storage Additional reading materials]]&lt;br /&gt;
&lt;br /&gt;
==Lecture 13==&lt;br /&gt;
&lt;br /&gt;
May 10th 2016 - Lecture 13 - Backup and recovery&lt;br /&gt;
&lt;br /&gt;
==Lecture 14 and Lecture 9==&lt;br /&gt;
&lt;br /&gt;
May &#039;&#039;&#039;17th&#039;&#039;&#039; 2016 - Lecture 14 - Miscellaneous topics (will be held in a computer class 319)&lt;br /&gt;
&lt;br /&gt;
May &#039;&#039;&#039;19th 2016 at 10:00 in room 320&#039;&#039;&#039; - Lecture 9 - Monitoring (substitute lecture)&lt;br /&gt;
&lt;br /&gt;
==Lecture 15==&lt;br /&gt;
May 24th 2016 - Lecture 15 - working in IT - merits and demerits &lt;br /&gt;
&lt;br /&gt;
We will not have a lecture in the ordinary sense, instead we&#039;ll have a seminar or discussion on important aspects of working in IT. The ethical, social and personal aspects of it. Terms like &amp;quot;imposter syndrome&amp;quot;, burnout, teamwork and better work environment will be some of the topics covered. Life is not only technical competence, it&#039;s a lot about human interaction as well.&lt;br /&gt;
&lt;br /&gt;
=Lab works=&lt;br /&gt;
&lt;br /&gt;
==Lab 0==&lt;br /&gt;
&lt;br /&gt;
Installing Ubuntu Server 14.04.3 LTS&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Introduction to Unix command line&#039;&#039;&#039; (cd, ls, cat, full path, relative path etc)&lt;br /&gt;
&lt;br /&gt;
==Lab 1== &lt;br /&gt;
&lt;br /&gt;
3 points - &#039;&#039;&#039;Managing users&#039;&#039;&#039; (adduser, addgroup, passwd, /etc/passwd, /etc/shadow)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) Create a user noodle&lt;br /&gt;
&lt;br /&gt;
2) Add a new group food and add a the user noodle to a group called food.&lt;br /&gt;
&lt;br /&gt;
3) Divert the user noodle&#039;s password hash via cowsay to a file called cownoodle.txt.&lt;br /&gt;
&lt;br /&gt;
4) Lock the user noodle and be ready to show me the indication of the user being locked. &lt;br /&gt;
&lt;br /&gt;
5) Change the user&#039;s current home directory into /home/unknown so that the files will also be moved to the new location.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5 points - &#039;&#039;&#039;Managing files&#039;&#039;&#039; (mkdir, cp, mv, rm, touch, nano, less, chmod, chown, rwx, 644 etc)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) Create a folder march in root user directory and for every march day a subfolder with a name day1, day2, day3 … day31. (Example: /root/march/day1 or /root/march/day2 etc)&lt;br /&gt;
&lt;br /&gt;
2) Modify the march folder owner so that it will be student and the new group audio.&lt;br /&gt;
&lt;br /&gt;
3) Modify the march folder&#039;s and its subfolders so that the user can do anything, group can do ls in the folder and cd into it and others can&#039;t do anything with it.&lt;br /&gt;
&lt;br /&gt;
4) Create a hard link called network to a file /etc/network/interfaces &lt;br /&gt;
&lt;br /&gt;
5) Copy /var/log directory into march folder so that the timestamp and user info will be preserved.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4 points - &#039;&#039;&#039;Processes and environment variables&#039;&#039;&#039; (kill, using directing input/output/error: |, &amp;lt;, &amp;gt;, &amp;gt;&amp;gt;; env, PATH, HOME etc)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) Divert the list with the student user&#039;s groups via cowsay into a fail studgroup.txt.&lt;br /&gt;
&lt;br /&gt;
2) Create a environment variable called MYHOME that has the value of the system&#039;s HOME environment variable. (Hint: you have tu use variable symbol here!)&lt;br /&gt;
&lt;br /&gt;
3) Send 2 htop&#039;s to the background and be ready to present how you send a kill signal to the first htop by job number and term signal to the second htop by a process number. &lt;br /&gt;
&lt;br /&gt;
4) Create an alias called bye that logs you out of the terminal. Make this alias permanent. &lt;br /&gt;
&lt;br /&gt;
5) Execute a programm called espdiff and diver the standardoutput to a file called okay.txt and the standard error to a file called notokay.txt. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3 points - &#039;&#039;&#039;Managing software&#039;&#039;&#039; (installation, updating, deleting, apt and dpkg utils)&lt;br /&gt;
&lt;br /&gt;
==Lab 2==&lt;br /&gt;
&lt;br /&gt;
7 points - &lt;br /&gt;
&#039;&#039;&#039;Managing disks by creating partitions&#039;&#039;&#039; (fdisk, mkfs, blkid, mount, umount)&lt;br /&gt;
&lt;br /&gt;
5 points - &lt;br /&gt;
&#039;&#039;&#039;Managing swap&#039;&#039;&#039; (mkswap, swapon, swapoff)&lt;br /&gt;
&lt;br /&gt;
=Practical tests=&lt;br /&gt;
&lt;br /&gt;
==2016==&lt;br /&gt;
&lt;br /&gt;
=Exams=&lt;br /&gt;
&lt;br /&gt;
==2016==&lt;br /&gt;
&lt;br /&gt;
=Wiki article information=&lt;br /&gt;
&lt;br /&gt;
* Choose a topic from personal experience or from topics found on the wiki page&lt;br /&gt;
&lt;br /&gt;
*Send the topic to the lecturer kloodus@itcollege.ee&lt;br /&gt;
&lt;br /&gt;
*Lecturer will confirm the topic&lt;br /&gt;
&lt;br /&gt;
*Write your article in wiki environment &lt;br /&gt;
&lt;br /&gt;
*Inform the lecturer when the article is finished&lt;br /&gt;
&lt;br /&gt;
*Receive feedback with corrections&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt; &lt;br /&gt;
Bare in mind that this is an open environment, so everything you write in your wiki article, will be public :) &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Helpful tips and requirements what is expected of your wiki article: https://docs.google.com/document/d/1TGmcv4CL0csigtzA_1Ti4Ndvvc6AjNchZwJe2Jc7OQc/edit# &lt;br /&gt;
&lt;br /&gt;
===List of the topics chosen:===&lt;br /&gt;
&lt;br /&gt;
[[User:akerge|Artur Kerge]] is doing an article on [[Irssi]].&lt;br /&gt;
&lt;br /&gt;
[[OpenVPN_Access_Server|OpenVPN Access Server]] by  [[User:aovtsinn|Artur Ovtsinnikov]]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.itcollege.ee/index.php/Securing_database_with_command_line_linux#References| Securing database with command line linux] by Mohanad Aly&lt;br /&gt;
&lt;br /&gt;
[[SSH_for_beginners|SSH for beginners]] by [[User:ebarrier|Etienne Barrier]]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.itcollege.ee/index.php/Linux_File_Permissions#References| Linux File Permissions] by Sheela Raj&lt;br /&gt;
&lt;br /&gt;
[https://wiki.itcollege.ee/index.php/User_talk:Lphanvan  Attack A Website by Using Local Method ([[Local Attack]])] by Ender Phan&lt;br /&gt;
&lt;br /&gt;
[https://wiki.itcollege.ee/index.php/Cowsay_English Cowsay] by Meelis Hass&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Cowsay_English&amp;diff=103321</id>
		<title>Cowsay English</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Cowsay_English&amp;diff=103321"/>
		<updated>2016-05-08T16:07:35Z</updated>

		<summary type="html">&lt;p&gt;Mhass: Created page with &amp;quot;__NOTOC__   == Introduction ==  Cowsay is a very important program for any up-and-coming Ubuntu user, important in the way that it can starve off boredom for a few seconds. Co...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Cowsay is a very important program for any up-and-coming Ubuntu user, important in the way that it can starve off boredom for a few seconds. Cowsay itself creates an ASCII picture of a cow saying a message the user creates. The program has many functions that let it change the output accordingly, by using specific parameters. Piping outputs of other programs into cowsay is easily doable using the piping command. Cowsay was created by Tony Monroe, in 1999.&lt;br /&gt;
&lt;br /&gt;
Over the years, Cowsay became a joke in the hacker culture and has become widespread enough for normal recognition. &lt;br /&gt;
&lt;br /&gt;
[[File:CowsayEng2.PNG]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Syntax and Parameters ==&lt;br /&gt;
&lt;br /&gt;
The average syntax for cowsay consists of:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;cowsay&#039;&#039;&#039; (parameter) (message)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; || &#039;&#039;&#039;Functions&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-d&#039;&#039;&#039;|| Dead cow mode, replaces eyes with &#039;&#039;&#039;X&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-g&#039;&#039;&#039;|| Scrooge McDuck mode, replaces eyes with &#039;&#039;&#039;$&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-p&#039;&#039;&#039;|| Tin foil hat mode (without a hat), replaces eyes with &#039;&#039;&#039;@&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-b&#039;&#039;&#039;|| Borg assimilation mode, turns eyes into &#039;&#039;&#039;==&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-t&#039;&#039;&#039;|| Tired cow mode, replaces eyes with &#039;&#039;&#039;--&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-s&#039;&#039;&#039;|| &amp;quot;Stoned&amp;quot; mode, replaces eyes with &#039;&#039;&#039;*&#039;&#039;&#039;, with an additional tongue&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-w&#039;&#039;&#039;|| Suprised mode, replaces eyes with &#039;&#039;&#039;O&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-y&#039;&#039;&#039;|| Young mode, replaces eyes with &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-f&#039;&#039;&#039; cowfile|| Used to replace the cow with other possible creatures, like sheep or penguins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-e&#039;&#039;&#039; eye_string|| Used to specify the eye string on the cow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-T&#039;&#039;&#039; tongue_string|| Used to specify the tounge usage on the cow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-W&#039;&#039;&#039;|| used to specify the width of the speech baloons&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;-n&#039;&#039;&#039;|| used to disable line wrap and to create messages with spaces in them&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Gallery ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CowsayEng3.PNG|A sheep&lt;br /&gt;
File:CowsayEng4.PNG|A tiger&lt;br /&gt;
File:CowsayEng5.PNG|Ghostbusters logo&lt;br /&gt;
File:CowsayEng6.PNG|Darth Moo&lt;br /&gt;
File:CowsayEng7.PNG|Beavis&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://web.archive.org/web/20071030081644/http://debaday.debian.net/2007/10/28/cowsay-a-configurable-talking-and-thinking-cow/&lt;br /&gt;
&lt;br /&gt;
http://textart.io/cowsay&lt;br /&gt;
&lt;br /&gt;
Article created by Meelis Hass in the Spring semester of 2016&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=File:CowsayEng7.PNG&amp;diff=103320</id>
		<title>File:CowsayEng7.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=File:CowsayEng7.PNG&amp;diff=103320"/>
		<updated>2016-05-08T15:59:27Z</updated>

		<summary type="html">&lt;p&gt;Mhass: Cornholio Cowsay&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cornholio Cowsay&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=File:CowsayEng6.PNG&amp;diff=103319</id>
		<title>File:CowsayEng6.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=File:CowsayEng6.PNG&amp;diff=103319"/>
		<updated>2016-05-08T15:59:16Z</updated>

		<summary type="html">&lt;p&gt;Mhass: Darth Cowsay&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Darth Cowsay&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=File:CowsayEng5.PNG&amp;diff=103318</id>
		<title>File:CowsayEng5.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=File:CowsayEng5.PNG&amp;diff=103318"/>
		<updated>2016-05-08T15:58:54Z</updated>

		<summary type="html">&lt;p&gt;Mhass: Ghostbusters Cowsay&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ghostbusters Cowsay&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=File:CowsayEng4.PNG&amp;diff=103317</id>
		<title>File:CowsayEng4.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=File:CowsayEng4.PNG&amp;diff=103317"/>
		<updated>2016-05-08T15:58:37Z</updated>

		<summary type="html">&lt;p&gt;Mhass: Cat Cowsay&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cat Cowsay&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=File:CowsayEng3.PNG&amp;diff=103316</id>
		<title>File:CowsayEng3.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=File:CowsayEng3.PNG&amp;diff=103316"/>
		<updated>2016-05-08T15:58:25Z</updated>

		<summary type="html">&lt;p&gt;Mhass: Sheep Cowsay&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Sheep Cowsay&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=File:CowsayEng2.PNG&amp;diff=103314</id>
		<title>File:CowsayEng2.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=File:CowsayEng2.PNG&amp;diff=103314"/>
		<updated>2016-05-08T15:09:34Z</updated>

		<summary type="html">&lt;p&gt;Mhass: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=File:CowsayEng1.png&amp;diff=103313</id>
		<title>File:CowsayEng1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=File:CowsayEng1.png&amp;diff=103313"/>
		<updated>2016-05-08T14:57:09Z</updated>

		<summary type="html">&lt;p&gt;Mhass: Cowsay picture, taken from the Cowsay Wikipedia article&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cowsay picture, taken from the Cowsay Wikipedia article&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=User_talk:Mhass&amp;diff=100487</id>
		<title>User talk:Mhass</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=User_talk:Mhass&amp;diff=100487"/>
		<updated>2016-01-12T13:08:10Z</updated>

		<summary type="html">&lt;p&gt;Mhass: Created page with &amp;quot;https://wiki.itcollege.ee/index.php/User_talk:Lphanvan#Hardware&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;https://wiki.itcollege.ee/index.php/User_talk:Lphanvan#Hardware&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Category:I600_Introduction_to_Computers_and_Informatics&amp;diff=99828</id>
		<title>Category:I600 Introduction to Computers and Informatics</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Category:I600_Introduction_to_Computers_and_Informatics&amp;diff=99828"/>
		<updated>2016-01-03T12:44:46Z</updated>

		<summary type="html">&lt;p&gt;Mhass: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this course we&#039;ll give an introduction to variety of topics from hardware to software.&lt;br /&gt;
The course will follow roughly the same structure as [https://lagunita.stanford.edu/courses/Engineering/CS101/Summer2014/about Computer Science 101 at Stanford University] with more hands-on approach. This course substitutes Estonian courses I100 Sissejuhatus informaatikasse and [http://www.pld.ttu.ee/~teet/itarvutid.html I201 Arvutid].&lt;br /&gt;
&lt;br /&gt;
Monday lectures will cover more theoretical stuff;&lt;br /&gt;
Thursday workshops are for getting started with new topics;&lt;br /&gt;
the homework assignments connect theoretical with practice and&lt;br /&gt;
Tuesday sessions are for follow up, asking/answering questions and presenting homework.&lt;br /&gt;
Attendance won&#039;t be tracked, the sessions are there if you need help.&lt;br /&gt;
Bring your laptops for Tuesday and Thursday sessions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Course credits: 6 ECTS&lt;br /&gt;
&lt;br /&gt;
Lecturer: Lauri Võsandi&lt;br /&gt;
&lt;br /&gt;
E-mail: lauri [donut] vosandi [plus] i600 [ät] gmail [dotchka] com&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Grading=&lt;br /&gt;
&lt;br /&gt;
Grade mapping:&lt;br /&gt;
&lt;br /&gt;
* 0-50 points, fail&lt;br /&gt;
* 51-60 points, pass 1&lt;br /&gt;
* 61-70 points, satisfactory 2&lt;br /&gt;
* 71-80 points, average 3&lt;br /&gt;
* 81-90 points, good 4&lt;br /&gt;
* 91-100 points, very good 5&lt;br /&gt;
&lt;br /&gt;
Grading is split between theory and practice&lt;br /&gt;
&lt;br /&gt;
* Exam of 50 points, preparation in lectures and general discussion in workshops.&lt;br /&gt;
* Assignments, see instructions and points below.&lt;br /&gt;
* Extra points for improving quality of wiki articles, extracurricular work and also helping others, see points below.&lt;br /&gt;
&lt;br /&gt;
Exam will be halfway between oral and written: You&#039;ll be given 30 minutes to prepare for several random questions and 15 minutes to discuss what you&#039;ve answered.&lt;br /&gt;
If you don&#039;t have prior experience with the topics, it&#039;s highly recommended to take part of the sessions in order to pass the exam. You can use a calculator and this wiki page, don&#039;t rely on the access to terminal or other software tools. You can not access Internet or any remote computers.&lt;br /&gt;
&lt;br /&gt;
Exam sections:&lt;br /&gt;
&lt;br /&gt;
* Execution of ~10 processor instructions&lt;br /&gt;
* Bunch of randomly selected questions from this page&lt;br /&gt;
* Bunch of questions (how much RAM, how big disk, what wireless chipset) asked about a computer you&#039;ll be given&lt;br /&gt;
* Gain SSH access to a machine on the network, basic text file editing skills using nano&lt;br /&gt;
&lt;br /&gt;
Exam times:&lt;br /&gt;
&lt;br /&gt;
* 12. jan 10:00 - &amp;lt;Insert name&amp;gt;&lt;br /&gt;
* 12. jan 10:30 - &amp;lt;Insert name&amp;gt;&lt;br /&gt;
* 12. jan 11:00 - &amp;lt;Insert name&amp;gt;&lt;br /&gt;
* 12. jan 11:30 - &amp;lt;Insert name&amp;gt;&lt;br /&gt;
* 12. jan 13:00 - Artur V. Kerge&lt;br /&gt;
* 12. jan 13:30 - &amp;lt;Insert name&amp;gt;&lt;br /&gt;
* 12. jan 14:00 -  Nazmul Hasan &lt;br /&gt;
* 12. jan 14:30 - &amp;lt;Insert name&amp;gt;&lt;br /&gt;
* 12. jan 15:00 - Meelis Hass&lt;br /&gt;
* 12. jan 15:30 - &amp;lt;Insert name&amp;gt;&lt;br /&gt;
* 13. jan 10:00 - &amp;lt;Insert name&amp;gt;&lt;br /&gt;
* 13. jan 10:30 - &amp;lt;Insert name&amp;gt;&lt;br /&gt;
* 13. jan 11:00 - &amp;lt;Insert name&amp;gt;&lt;br /&gt;
* 13. jan 11:30 - &amp;lt;Insert name&amp;gt;&lt;br /&gt;
* 13. jan 13:00 - &amp;lt;Sheela Gowry&amp;gt;&lt;br /&gt;
* 13. jan 13:30 -  Dmitri Sim&lt;br /&gt;
* 13. jan 14:00 -  Ender&lt;br /&gt;
* 13. jan 14:30 - &amp;lt;Insert name&amp;gt;&lt;br /&gt;
* 13. jan 15:00 - &amp;lt;Insert name&amp;gt;&lt;br /&gt;
* 13. jan 15:30 - Mohanad Aly&lt;br /&gt;
&lt;br /&gt;
=Lecture: Computer hardware=&lt;br /&gt;
&lt;br /&gt;
Jargon: CPU, RAM, ROM, HDD, SSD, PCI, PCI Express, USB 2.0, USB 3.0, VGA, HDMI, DVI, LCD, TFT, LED, OLED, AMOLED, CRT, PWM&lt;br /&gt;
&lt;br /&gt;
[https://echo360.e-ope.ee/ess/echo/presentation/beef71c3-044c-43c9-a326-e1e62cbb5c9b Lecture recording #1]&lt;br /&gt;
&lt;br /&gt;
[https://echo360.e-ope.ee/ess/echo/presentation/36786bbb-84b6-4604-be6f-c363bf22ce8d Lecture recording #2 starting 12:30]&lt;br /&gt;
&lt;br /&gt;
[https://docs.google.com/presentation/d/1OzaqTBAUfMOzhG0HZeSJVSszCmFyn4ug35teYJWkyfM/edit?usp=sharing Lecture slides] Random access memory, permanent storage, buses, input devices, display technologies, networking&lt;br /&gt;
&lt;br /&gt;
Potential exam questions:&lt;br /&gt;
&lt;br /&gt;
* Different buses and their uses&lt;br /&gt;
* What are the differences between hard disk drive (HDD) and solid state drive (SSD)? [http://www.storagereview.com/ssd_vs_hdd]&lt;br /&gt;
* What is the purpose of Flash Translation Layer in terms of solid state drives?&lt;br /&gt;
* What are difference between volatile/non-volatile, RAM, ROM, EEPROM and where are they used?&lt;br /&gt;
* What is data retention?&lt;br /&gt;
* What are difference between asynchronous/synchronous, dynamic/static RAM and where are they used?&lt;br /&gt;
* What is [https://compsci2014.wikispaces.com/2.1.3+Explain+the+use+of+cache+memory cache]? What is cache coherence?&lt;br /&gt;
* What are differences between resistive and capacitive touchscreen? [http://www.alphr.com/realworld/357325/capacitive-or-resistive-whats-the-best-type-of-touchscreen]&lt;br /&gt;
* Explain how [http://www.bidouille.org/hack/mousecam computer mouse] works? [http://www.topdesignmag.com/mouse-history-in-photos/ History of computer mouse].&lt;br /&gt;
* Explain how [http://www.daskeyboard.com/blog/typing-through-time-the-history-of-the-keyboard/ computer keyboard] works? [http://computer.howstuffworks.com/keyboard.htm HowStuffworks article] [http://www.explainthatstuff.com/computerkeyboards.html Explain that Stuff article] [http://www.daskeyboard.com/blog/typing-through-time-the-history-of-the-keyboard/ Keyboard History]&lt;br /&gt;
* Explain how [https://en.wikipedia.org/wiki/Cathode_ray_tube cathode ray tube] (CRT) based screen technology works and name pros/cons. [https://www.youtube.com/watch?v=2czqYV3T_Kc]&lt;br /&gt;
* Explain how [https://en.wikipedia.org/wiki/Liquid-crystal_display liquid crystal displays] (LCD) work and name pros/cons. [https://www.youtube.com/watch?v=nCHgmCxGEzY]&lt;br /&gt;
* Name screen technologies making use of thin film transistor (TFT) technology? [https://en.wikipedia.org/wiki/Thin-film_transistor]&lt;br /&gt;
* Name uses for light polarization filters? [https://en.wikipedia.org/wiki/Polarizing_filter_%28photography%29] [https://en.wikipedia.org/wiki/Polarized_3D_system] &lt;br /&gt;
* What are the benefits of [https://en.wikipedia.org/wiki/Twisted_pair twisted pair cabling] and [https://en.wikipedia.org/wiki/Differential_signaling differential signalling]?&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Active_matrix Active matrix] vs [https://en.wikipedia.org/wiki/Passive_matrix_addressing passive matrix] in display technology&lt;br /&gt;
&lt;br /&gt;
Security section: [http://www.bunniestudios.com/blog/?p=3554 Hacking SD cards]&lt;br /&gt;
&lt;br /&gt;
Assignments:&lt;br /&gt;
* [https://wiki.itcollege.ee/index.php/I600_Introduction_to_Computers_and_Informatics#Assignment:_Investigating_PC_hardware Investigating PC hardware]&lt;br /&gt;
* [https://wiki.itcollege.ee/index.php/I600_Introduction_to_Computers_and_Informatics#Assignment:_Investigating_embedded_hardware Investigating embedded hardware]&lt;br /&gt;
&lt;br /&gt;
=Lecture: Storage abstractions=&lt;br /&gt;
&lt;br /&gt;
In this lecture we&#039;ll talk about permanent storage abstractions: block device, disk, partition, file system, directory/folder, file, journaling, FAT32, NTFS, ext4, HFS+&lt;br /&gt;
&lt;br /&gt;
[https://docs.google.com/presentation/d/1dJ-HMSR9nW8OuZtSTYf5dlFyPsZKGqxlKoEwIHi9h6k/ Lecture slides] &lt;br /&gt;
&lt;br /&gt;
[https://echo360.e-ope.ee/ess/echo/presentation/36786bbb-84b6-4604-be6f-c363bf22ce8d Lecture recording] starts at 47:50.&lt;br /&gt;
&lt;br /&gt;
* What is a [https://en.wikipedia.org/wiki/Block_%28data_storage%29 block device]?&lt;br /&gt;
* What is [https://en.wikipedia.org/wiki/Logical_block_addressing logical block addressing] and what are the benefits compared to older [https://en.wikipedia.org/wiki/Cylinder-head-sector cylinder-head-sector addressing] method in terms of harddisks?&lt;br /&gt;
* What is a [https://en.wikipedia.org/wiki/Disk_partitioning disk partition]?&lt;br /&gt;
* What is a [https://en.wikipedia.org/wiki/File_system file system]?&lt;br /&gt;
* What is [https://en.wikipedia.org/wiki/Journaling_file_system#Write_hazards journaling] in terms of filesystems and what are the benefits? Name some journaled filesystems in use nowadays.&lt;br /&gt;
&lt;br /&gt;
=Lecture: Bootloaders, kernels=&lt;br /&gt;
&lt;br /&gt;
In this lecture we&#039;ll discuss how a computer boots and how an operating system kernel is loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://echo360.e-ope.ee/ess/echo/presentation/04eeebd1-c892-485a-9123-03abaa3ce3ca Lecture recording #1], first half we&#039;ll discuss about first assignment about investigating PC hardware, slides start at 43:40.&lt;br /&gt;
&lt;br /&gt;
[https://echo360.e-ope.ee/ess/echo/presentation/26f1d40d-7830-4e5c-b783-e061c1e91cfc Lecture recording #2], first 15 minutes we&#039;ll discuss about second assignment about investigating embedded hardware, last slides about kernels are discussed from 16:00 up to 27:30. I forgot to switch video input for lecture recording so you&#039;ll have to browse slides from the link below :/&lt;br /&gt;
&lt;br /&gt;
Lecture slides:&lt;br /&gt;
[https://docs.google.com/presentation/d/1ybYQEqCgN1KdVW1sLdwtfRogavgzzMQdUfTcAnxNAf4/ bootloaders],&lt;br /&gt;
[https://docs.google.com/presentation/d/1xDL27k3z_0I-IKzdjKkwhOhBrg0aOnM0w0u1zDwaEWY/ kernels].&lt;br /&gt;
&lt;br /&gt;
Jargon: [https://en.wikipedia.org/wiki/BIOS BIOS] (basic input/output system), [https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface UEFI] (Unified Extensible Firmware Interface), bootloader, kernel, process, context switch, x86 real/protected mode, paged virtual memory, swap/pagefile, [https://en.wikipedia.org/wiki/User_space kernelspace/supervisor mode, userspace], [https://en.wikipedia.org/wiki/Protection_ring#Hypervisor_mode hypervisor mode] (ring -1), [https://en.wikipedia.org/wiki/System_Management_Mode#Problems system management mode] aka (ring -2).&lt;br /&gt;
&lt;br /&gt;
Potential exam questions:&lt;br /&gt;
&lt;br /&gt;
* What is the role of BIOS/UEFI in x86-based machines?&lt;br /&gt;
* Explain step by step how operating system is booted up, see slides for flowchart.&lt;br /&gt;
* Describe the functionality provided by general purpose operating system. See architecture of [https://en.wikipedia.org/wiki/Architecture_of_Windows_NT Windows NT], [http://www.elinux.org/Android_Architecture Android], [https://en.wikipedia.org/wiki/Architecture_of_OS_X OS X].&lt;br /&gt;
* What are the main differences between [https://en.wikipedia.org/wiki/Real_mode real mode] and [https://en.wikipedia.org/wiki/Protected_mode protected mode] of x86-based processor?&lt;br /&gt;
* What happens during context switch?&lt;br /&gt;
* What is the purpose of [https://en.wikipedia.org/wiki/Virtual_memory paged virtual memory]?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Security section: [https://en.wikipedia.org/wiki/DMA_attack DMA attack], [http://www.outsidaz.org/blog/2007/10/22/resetting-root-password-via-grubkernel-boot-options/ editing GRUB entries to gain root shell] without password prompt, [http://www.theinquirer.net/inquirer/news/2421402/serious-intel-cpu-security-exploit-spotted-in-old-x86-chips 20 years old security exploit in x86 processors].&lt;br /&gt;
&lt;br /&gt;
=Lecture: Libraries, frameworks=&lt;br /&gt;
&lt;br /&gt;
[https://echo360.e-ope.ee/ess/echo/presentation/26f1d40d-7830-4e5c-b783-e061c1e91cfc Lecture recording #1], from 00:27:30 up to 1:04:00.&lt;br /&gt;
&lt;br /&gt;
[https://docs.google.com/presentation/d/1q9kGg5AI3AyXglxpJdLjLMpgRLdbF9dl62gauNmDEG8/edit Lecture slides]&lt;br /&gt;
&lt;br /&gt;
Jargon: framework, library, [https://en.wikipedia.org/wiki/Application_binary_interface ABI], [https://en.wikipedia.org/wiki/Application_programming_interface API]&lt;br /&gt;
&lt;br /&gt;
Security section: [http://www.fiercecio.com/story/hackers-exploiting-httpsys-bug-crash-iis-web-servers/2015-04-17 HTTP.sys bug crashes IIS web servers], [http://heartbleed.com/ OpenSSL bug Heartbleed].&lt;br /&gt;
&lt;br /&gt;
=Lecture: Programming languages=&lt;br /&gt;
&lt;br /&gt;
In this lecture we&#039;ll talk about programming languages&lt;br /&gt;
&lt;br /&gt;
Lecture recording: [https://echo360.e-ope.ee/ess/echo/presentation/26f1d40d-7830-4e5c-b783-e061c1e91cfc starting from 1:04:00]&lt;br /&gt;
&lt;br /&gt;
Lecture slides: [https://docs.google.com/presentation/d/1CCZntY7Z-AG_Mice5N2kclDGYI2xVVvRHgWUIs-SxYo/edit programming languages, stack machine]&lt;br /&gt;
&lt;br /&gt;
Jargon: stack machine, lexer/lexeme, token, abstract syntax tree&lt;br /&gt;
&lt;br /&gt;
Potential exam questions:&lt;br /&gt;
&lt;br /&gt;
* What are the major steps of compilation?&lt;br /&gt;
* What are the differences between [https://en.wikipedia.org/wiki/Interpreted_language interpreted], [https://en.wikipedia.org/wiki/Just-in-time_compilation JIT-compilation] and [https://en.wikipedia.org/wiki/Compiler traditional compiling]?&lt;br /&gt;
* What is [https://en.wikipedia.org/wiki/Control_flow control flow]? Loops? Conditional statements?&lt;br /&gt;
&lt;br /&gt;
Assignments:&lt;br /&gt;
&lt;br /&gt;
* [https://wiki.itcollege.ee/index.php/Category:I600_Introduction_to_Computers_and_Informatics#Assignment:_Disassembling_Python Disassembling Python]&lt;br /&gt;
* [https://wiki.itcollege.ee/index.php/Category:I600_Introduction_to_Computers_and_Informatics#Assignment:_Investigating_compilers Investigating compilers]&lt;br /&gt;
&lt;br /&gt;
=Lecture: Data encoding=&lt;br /&gt;
&lt;br /&gt;
[https://echo360.e-ope.ee/ess/echo/presentation/ca8310e9-e82e-4e47-b90a-2e1801bcfada Lecture recording]&lt;br /&gt;
&lt;br /&gt;
[https://docs.google.com/presentation/d/1QV_IMOadIEUTBW7Laqw59j8J7Y8HKwvSDmP-swEEx0s Lecture slides]&lt;br /&gt;
&lt;br /&gt;
In this lecture we&#039;ll talk about bits, bytes, integers, strings, pixels, audio encodings, video encoding etc.&lt;br /&gt;
&lt;br /&gt;
Potential exam questions:&lt;br /&gt;
&lt;br /&gt;
* What is bit? Nibble? Byte? Word?&lt;br /&gt;
* Write 9375 in binary, hexadecimal?&lt;br /&gt;
* Write 0xDEADBEEF in decimal?&lt;br /&gt;
* What is [https://en.wikipedia.org/wiki/Quantization_%28signal_processing%29 quantization] in terms of signal processing?&lt;br /&gt;
* How are [https://en.wikipedia.org/wiki/Integer_%28computer_science%29 integers] stored in binary? What integer range can be described using n bits? How many bits are required to describe integer range from n .. m.&lt;br /&gt;
* How are [https://en.wikipedia.org/wiki/Single-precision_floating-point_format single precision] and [https://en.wikipedia.org/wiki/Double-precision_floating-point_format double precision] floating point numbers stored in binary according to [https://en.wikipedia.org/wiki/IEEE_floating_point IEEE754 standard]? [http://lauri.vosandi.com/hdl/arithmetic/floating-point-representation.html Floating-point multiplication]&lt;br /&gt;
* What is the difference between CMYK and RGB color models? How are YUV, HSV and HSL colorspaces related to RGB? What are sRGB and YCbCr and where are they used?&lt;br /&gt;
* How is data encoded on audio CD-s? What is the [http://lauri.vosandi.com/2013/07/audio-codecs.html capacity of an audio CD]?&lt;br /&gt;
* What is sampling rate? What is bit depth? What is resolution?&lt;br /&gt;
* What is bitrate?&lt;br /&gt;
* What is lossy/lossless compression?&lt;br /&gt;
* What is JPEG suitable for? Is JPEG lossy or lossless compression method?&lt;br /&gt;
* What is PNG suitable for? Does PNG support compression?&lt;br /&gt;
* How are time domain and frequency domain related in terms of signal processing? What is Fourier transform and where it is applied?&lt;br /&gt;
&lt;br /&gt;
Jargon: 44.1kHz sampling rate, 16-bit audio, RGB565 pixel format, RGB888 pixel format&lt;br /&gt;
&lt;br /&gt;
Relevant assignments:&lt;br /&gt;
&lt;br /&gt;
* [https://wiki.itcollege.ee/index.php/Category:I600_Introduction_to_Computers_and_Informatics#Assignment:_Disassembling_Python Disassembling Python]&lt;br /&gt;
* [https://wiki.itcollege.ee/index.php/Category:I600_Introduction_to_Computers_and_Informatics#Assignment:_Investigating_compilers Investigating compilers]&lt;br /&gt;
&lt;br /&gt;
=Lecture: Code execution in processor=&lt;br /&gt;
&lt;br /&gt;
[https://docs.google.com/presentation/d/18wPDLydyZevMi9F0MX7F6eK-NMBZQzGN4mviF_ft8-E/edit Lecture slides]&lt;br /&gt;
&lt;br /&gt;
[https://echo360.e-ope.ee/ess/echo/presentation/41440769-1cd5-4166-bd4e-299c2af3d3e0?ec=true Lecture recording #1]&lt;br /&gt;
&lt;br /&gt;
[https://echo360.e-ope.ee/ess/echo/presentation/7aeb2a04-b0dc-4547-9dee-e541a5f9c99a?ec=true Lecture recording #2] up to 8:35, system calls&lt;br /&gt;
&lt;br /&gt;
It&#039;s highly reccommended to play around with simulators [http://morriswmz.jit.su/static/simple-mips-pipelined.html here is one for MIPS processors].&lt;br /&gt;
&lt;br /&gt;
In this lecture we&#039;ll talk about different processor architectures, instructions, pipelining, function calls, jumps, loops etc.&lt;br /&gt;
&lt;br /&gt;
Assignments:&lt;br /&gt;
&lt;br /&gt;
* [https://wiki.itcollege.ee/index.php/Category:I600_Introduction_to_Computers_and_Informatics#Assignment:_Disassembling_Python Disassembling Python]&lt;br /&gt;
* [https://wiki.itcollege.ee/index.php/Category:I600_Introduction_to_Computers_and_Informatics#Assignment:_Investigating_compilers Investigating compilers]&lt;br /&gt;
&lt;br /&gt;
Exam question:&lt;br /&gt;
&lt;br /&gt;
* Given ~10 instructions and their explainations, follow the instructions and elaborate after every step what happened in the processor?&lt;br /&gt;
&lt;br /&gt;
=Lecture: Microcontrollers=&lt;br /&gt;
&lt;br /&gt;
[https://docs.google.com/presentation/d/1qPyzBBfB1TseEzXjcp4-ZjqSnAwbjDmEqyIYcUGFLG0/edit Lecture slides]&lt;br /&gt;
&lt;br /&gt;
[https://echo360.e-ope.ee/ess/echo/presentation/7aeb2a04-b0dc-4547-9dee-e541a5f9c99a?ec=true Lecture recording] starts at 8:35&lt;br /&gt;
&lt;br /&gt;
Jargon: microprocessor, microcontroller, coprocessor, floating-point unit (FPU), digital signal processor (DSP), field programmable grid array (FPGA), sensors, actuators, digital input/output, analog input, general purpose input/output (GPIO), interrupt, interrupt handler, timer/counter, pulse-width modulation (PWM), &lt;br /&gt;
&lt;br /&gt;
Potential exam question:&lt;br /&gt;
&lt;br /&gt;
* What distinguishes microcontroller from microprocessor?&lt;br /&gt;
* What are the differences between Hardvard architecture and von Neumann architecture?&lt;br /&gt;
* What is an interrupt?&lt;br /&gt;
* What is an timer?&lt;br /&gt;
&lt;br /&gt;
=Lecture: Introduction to Boole algebra=&lt;br /&gt;
&lt;br /&gt;
[https://docs.google.com/presentation/d/1Y1rXvt2oXROhW-LZ07B0Sg90D-_u8SlLUZeaxds7f1g/ Lecture slides]&lt;br /&gt;
&lt;br /&gt;
Exam questions:&lt;br /&gt;
&lt;br /&gt;
* Simplify A AND A OR B&lt;br /&gt;
* Show addition of X and Y in binary&lt;br /&gt;
* Show subtraction of X and Y  in binary&lt;br /&gt;
* Show multiplication of X and Y in binary&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assignments:&lt;br /&gt;
* [https://wiki.itcollege.ee/index.php/Category:I600_Introduction_to_Computers_and_Informatics#Assignment:_Designing_arithmetic-logic_unit Designing arithmetic-logic unit]&lt;br /&gt;
&lt;br /&gt;
=Lecture: Hardware description languages=&lt;br /&gt;
&lt;br /&gt;
[https://docs.google.com/presentation/d/1HO9iPfi8S3ZykuW7IHVm09QamLHiVo6s6lUGwWu4eD4/ Lecture slides]&lt;br /&gt;
&lt;br /&gt;
[https://echo360.e-ope.ee/ess/echo/presentation/b7ca9eb3-5a9d-4e8c-8c1b-25c2891359ee Lecture recording] starts at 05:00&lt;br /&gt;
&lt;br /&gt;
Potential exam questions:&lt;br /&gt;
&lt;br /&gt;
* What are the uses for hardware description languages?&lt;br /&gt;
* What is latch?&lt;br /&gt;
* What is flip-flop?&lt;br /&gt;
* What is mux (multiplexer)?&lt;br /&gt;
* What is register? Register file?&lt;br /&gt;
* What is ALU?&lt;br /&gt;
* What is floating-point unit?&lt;br /&gt;
* What is a cache?&lt;br /&gt;
* What is a bus?&lt;br /&gt;
* Show the circuit diagram for A OR B AND C, NOT A AND B, &amp;lt;insert some other Boole formula here&amp;gt;?&lt;br /&gt;
* Show the truth table for &amp;lt;insert Boole formula here&amp;gt;?&lt;br /&gt;
* Write the equivalent Boole formula of a circuit diagram.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Lecture: Publishing work=&lt;br /&gt;
&lt;br /&gt;
[https://echo360.e-ope.ee/ess/echo/presentation/cd2c0e2b-5f48-4a39-89ca-b75801e5d00b Lecture recording]&lt;br /&gt;
&lt;br /&gt;
[https://docs.google.com/presentation/d/1hCqRjGUx5Yv6iZN4xaz2UICLWbycnM46ctw2zX0g94U/ Lecture slides]&lt;br /&gt;
&lt;br /&gt;
Potential exam questions:&lt;br /&gt;
&lt;br /&gt;
* What are the major implications of MIT, BSD and GPL licenses?&lt;br /&gt;
* What are the differences between copyright, trademark, trade secret?&lt;br /&gt;
* Where would you use waterfall software development model? Where would you use agile?&lt;br /&gt;
* What is the purpose of a version control system?&lt;br /&gt;
* What would you store in a version control system?&lt;br /&gt;
&lt;br /&gt;
=Lecture: Algorithms and data structures=&lt;br /&gt;
&lt;br /&gt;
[https://echo360.e-ope.ee/ess/echo/presentation/1145600e-cef9-40b4-91da-3cc1174e27eb Lecture recording] unfortunately without audio :(&lt;br /&gt;
&lt;br /&gt;
[https://docs.google.com/presentation/d/1vwJvvRerM0rYBaiE3pEX5GUXRHuVJvjTUDKo8fqTq_A/ Lecture slides]&lt;br /&gt;
&lt;br /&gt;
Potential exam questions:&lt;br /&gt;
&lt;br /&gt;
* What is time complexity of algorithm?&lt;br /&gt;
* What is space complexity of algorithm?&lt;br /&gt;
* What&#039;s a good algorithm?&lt;br /&gt;
&lt;br /&gt;
=Lecture: History=&lt;br /&gt;
&lt;br /&gt;
Topics: Computer history, Silicon Valley, standards&lt;br /&gt;
&lt;br /&gt;
[https://echo360.e-ope.ee/ess/echo/presentation/584b21e6-4ead-4cb6-bc41-5c653bc5c3a2 Lecture recording]&lt;br /&gt;
&lt;br /&gt;
[https://docs.google.com/presentation/d/1Ybld2ABpm9QJSLL-Bodr1a5XI5Hk_KM2q_nZVYu2L0c/edit?usp=sharing Lecture slides]&lt;br /&gt;
&lt;br /&gt;
Potential example questions:&lt;br /&gt;
&lt;br /&gt;
* What is [https://en.wikipedia.org/wiki/Moore&#039;s_law Moore&#039;s law]? What is [https://en.wikipedia.org/wiki/Rock&#039;s_law Rock&#039;s law]?&lt;br /&gt;
* What were the major contributing factors for success of Microsoft, Apple, Google, &amp;lt;your favourite company&amp;gt;?&lt;br /&gt;
* What were the major contributing factors to the success of Silicon Valley?&lt;br /&gt;
&lt;br /&gt;
=Assignment: Investigating PC hardware=&lt;br /&gt;
&lt;br /&gt;
Goal: Get familiar with your [https://en.wikipedia.org/wiki/X86 laptop hardware]. Get out of the comfort zone of your primary operating system and try out other operating systems. Learn about [https://en.wikipedia.org/wiki/Full_virtualization hardware virtualization].&lt;br /&gt;
&lt;br /&gt;
Deadline: 16. September&lt;br /&gt;
&lt;br /&gt;
Credits: 5 points plus extra point for being extra thorough about interpreting what you see.&lt;br /&gt;
&lt;br /&gt;
Use what you learned in [[Getting started with Ubuntu]] workshop:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Read the instructions before you act&#039;&#039;&#039;.&lt;br /&gt;
* Place your preferred ISO image to a memory stick using &amp;lt;code&amp;gt;dd&amp;lt;/code&amp;gt; or Win32 Disk Imager and boot it on your personal laptop. You do &#039;&#039;&#039;not&#039;&#039;&#039; need to install Ubuntu on your harddisk, simply click &#039;&#039;&#039;Try Ubuntu&#039;&#039;&#039; once the operating system boots off the memory stick and carry out following tasks.&lt;br /&gt;
* Open up terminal by pressing &amp;lt;code&amp;gt;Ctrl-Alt-T&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Use &amp;lt;code&amp;gt;lsb_release -a&amp;lt;/code&amp;gt; to check what operating system distribution you&#039;re running.&lt;br /&gt;
* Use &amp;lt;code&amp;gt;uname -sr&amp;lt;/code&amp;gt; to check what operating system kernel you&#039;re running. &lt;br /&gt;
* Use &amp;lt;code&amp;gt;cat /proc/cpuinfo&amp;lt;/code&amp;gt; and check processor information. What CPU model and how many cores your computer has?&lt;br /&gt;
* Use &amp;lt;code&amp;gt;arch&amp;lt;/code&amp;gt; to check what CPU architecture is being used by the operating system. Is it 32-bit or 64-bit?&lt;br /&gt;
* Use &amp;lt;code&amp;gt;cat /proc/meminfo&amp;lt;/code&amp;gt; to check memory usage. How much RAM your computer has?&lt;br /&gt;
* Use &amp;lt;code&amp;gt;lspci -t -v -nn&amp;lt;/code&amp;gt; to enumerate PCI and PCI Express devices, attempt to identify what is what.&lt;br /&gt;
* Use &amp;lt;code&amp;gt;lsusb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lsusb -t&amp;lt;/code&amp;gt; to enumerate USB devices, again attempt to identify what is what.&lt;br /&gt;
* Use &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt; to enumerate disks and partitions. How big is your harddisk? How many and how big partitions it has?&lt;br /&gt;
* Use &amp;lt;code&amp;gt;lsblk&amp;lt;/code&amp;gt; to enumerate block devices.&lt;br /&gt;
* Use &amp;lt;code&amp;gt;xrandr&amp;lt;/code&amp;gt; to enumerate display outputs. What video output resolutions are available and which one is currently used?&lt;br /&gt;
* Use &amp;lt;code&amp;gt;cat /proc/asound/cards&amp;lt;/code&amp;gt; to check which audio devices are available.&lt;br /&gt;
* Use &amp;lt;code&amp;gt;dmidecode&amp;lt;/code&amp;gt; to see even more information about your computer.&lt;br /&gt;
* Use &amp;lt;code&amp;gt;ifconfig -a&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ip addr list&amp;lt;/code&amp;gt; to list all network interfaces.&lt;br /&gt;
* Use &amp;lt;code&amp;gt;iwconfig&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;iw list&amp;lt;/code&amp;gt; to list all wireless network interfaces. Is your wireless network interface detected? If not take a guess why?&lt;br /&gt;
* Use &amp;lt;code&amp;gt;hcitool dev&amp;lt;/code&amp;gt; to list bluetooth host controller. Is your bluetooth device detected?&lt;br /&gt;
* Use &amp;lt;code&amp;gt;glxinfo&amp;lt;/code&amp;gt; to check what 3D rendering capabilities are available, is it hardware accelerated? (hint: is direct rendering enabled?)&lt;br /&gt;
* What [https://en.wikipedia.org/wiki/Sound_card audio card] is your machine using? What bus is it using?&lt;br /&gt;
* What [https://en.wikipedia.org/wiki/Graphics_processing_unit graphics controller] is your machine using? What bus is it using?&lt;br /&gt;
* What webcam is your machine using? What bus is it using?&lt;br /&gt;
* What [https://en.wikipedia.org/wiki/Ethernet wired network] chipset your computer has? What bus is it using? &lt;br /&gt;
* What [https://en.wikipedia.org/wiki/IEEE_802.11 wireless network] chipset your computer has? What bus is it using?&lt;br /&gt;
* What [https://en.wikipedia.org/wiki/Bluetooth Bluetooth] device your computer has? What bus is it using?&lt;br /&gt;
* Is there a [https://en.wikipedia.org/wiki/Mobile_broadband_modem cellular modem] connected and how it&#039;s connected?&lt;br /&gt;
* Boot the ISO image in VirtualBox and follow the same steps as above, &#039;&#039;&#039;what are the differences and why&#039;&#039;&#039;?&lt;br /&gt;
* Answer to questions above and send it as [https://en.wikipedia.org/wiki/Plain_text plain text] e-mail to Lauri, make sure you &#039;&#039;&#039;use the address supplied above with the course code&#039;&#039;&#039;, otherwise your mail is not searchable in my mailbox. Attach collected command outputs as [https://en.wikipedia.org/wiki/Plain_text plain text] file, do &#039;&#039;&#039;not&#039;&#039;&#039; send .odt, .doc files, these are not readable on my smartphone. When answering to questions phrase the text in a way that is understandable out of context, so I don&#039;t have to open up wiki to understand what you&#039;re talking about.&lt;br /&gt;
&lt;br /&gt;
Note that I can&#039;t expect you to install Ubuntu on your physical machine, but I can help if you want to do that. You should have Ubuntu ready to go in a virtual machine at least for subsequent sessions. We&#039;re using Ubuntu because it&#039;s widely used on servers and in the cloud, so any Ubuntu skills will definitely come handy in future. If you&#039;re already familiar with Linux, it&#039;s suggested to take a look at other interesting operating systems such as [https://www.freebsd.org/ FreeBSD] or [http://www.openbsd.org/ OpenBSD]. Take a look at [https://www.kali.org/ Kali Linux] if you&#039;re interested in penetration testing.&lt;br /&gt;
&lt;br /&gt;
=Assignment: Investigating embedded hardware=&lt;br /&gt;
&lt;br /&gt;
Background: Most of the smartphones nowadays are using [https://en.wikipedia.org/wiki/System_on_a_chip SoC] built around [https://en.wikipedia.org/wiki/ARM_architecture ARM] processor. Raspberry Pi is an excellent piece of hardware to for checking out how an ARM-based machine looks like.&lt;br /&gt;
&lt;br /&gt;
Goal: Get familiar with hardware ARM-based hardware.&lt;br /&gt;
&lt;br /&gt;
Deadline: 23. September&lt;br /&gt;
&lt;br /&gt;
Points: 4 points&lt;br /&gt;
&lt;br /&gt;
Use what you learned in [[Getting started with Ubuntu]] and [[Getting started with Raspberry Pi]] workshops:&lt;br /&gt;
&lt;br /&gt;
* Read the instructions before you get busy.&lt;br /&gt;
* Boot Raspbian on Raspberry Pi.&lt;br /&gt;
* Use the commands described in previous assignment to examine the environment of Raspbian on Raspberry Pi. What are the major differences compares to your laptop and virtual machine?&lt;br /&gt;
* What buses is Raspberry Pi making use of?&lt;br /&gt;
* What filesystems is Raspbian making use of?&lt;br /&gt;
* Answer to questions above and send it as e-mail to Lauri, make sure you &#039;&#039;&#039;use the address supplied above with the course code&#039;&#039;&#039;, otherwise your mail is not searchable in my mailbox. Attach collected command outputs as [https://en.wikipedia.org/wiki/Plain_text plain text] file, do &#039;&#039;&#039;not&#039;&#039;&#039; send .odt, .doc files, these are not readable on a phone. When answering to questions phrase the text in a way that is understandable out of context, so it is not necessary to open up wiki to understand what you&#039;re talking about.&lt;br /&gt;
&lt;br /&gt;
=Assignment: Investigating LAMP=&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/LAMP_%28software_bundle%29 LAMP] software bundle is consists of Linux-based OS, [https://en.wikipedia.org/wiki/Apache_HTTP_Server Apache web server], [https://en.wikipedia.org/wiki/PHP PHP programming language] runtime and [https://en.wikipedia.org/wiki/MySQL MySQL database].&lt;br /&gt;
Most of the web applications on the Internet including Facebook are built on top of LAMP-styled software stack.&lt;br /&gt;
Use a Raspberry Pi or Ubuntu virtual machine to set up [https://www.raspberrypi.org/learning/lamp-web-server-with-wordpress/ WordPress], [https://doc.owncloud.org/server/8.1/admin_manual/installation/index.html ownCloud] or any well-known web application that makes use of a database such as MySQL.&lt;br /&gt;
To make your life easier also set up SSH public key authentication.&lt;br /&gt;
&lt;br /&gt;
Goal: Get familiar with LAMP stack. Get comfortable with (SSH) public key authentication.&lt;br /&gt;
&lt;br /&gt;
Deadline: 30. September&lt;br /&gt;
&lt;br /&gt;
Points: 4 points&lt;br /&gt;
&lt;br /&gt;
Tasks:&lt;br /&gt;
&lt;br /&gt;
* If you&#039;re using Ubuntu virtual machine approach, see [[Accessing a virtual machine via SSH connection]]&lt;br /&gt;
* Use SSH to connect to your server over the network. If you&#039;re using Windows on your laptop use [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] to gain access to command line and [https://winscp.net/ WinSCP] to copy files, otherwise simply boot Ubuntu in a virtual machine and use &amp;lt;code&amp;gt;ssh username@hostname&amp;lt;/code&amp;gt; to invoke commands and &amp;lt;code&amp;gt;sftp://username@hostname&amp;lt;/code&amp;gt; in the file browser to access filesystem.&lt;br /&gt;
* Set up any of the web applications referenced above. You may be interested in reading also [http://howtoubuntu.org/how-to-install-lamp-on-ubuntu this] and [https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-on-ubuntu-14-04 this].&lt;br /&gt;
* Demonstrate that the web application you installed works in next Tuesday session, screenshots/photos with explanation sent to e-mail above also suffice.&lt;br /&gt;
* Optional: Set up SSH public key authentication to &amp;lt;code&amp;gt;enos.itcollege.ee&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Optional: [https://www.raspberrypi.org/documentation/remote-access/ssh/passwordless.md Set up public key authentication to your Raspberry Pi]. Windows users might want to take a look at [https://winscp.net/eng/docs/ui_puttygen#obtaining_and_starting_puttygen PuTTYgen instructions].&lt;br /&gt;
&lt;br /&gt;
Note: You don&#039;t have to necessarily use Raspberry Pi - Web application installed in Ubuntu VM is also accepted, also if you&#039;re maintaining similar installation of a production server that is accepted as well. [http://www.wampserver.com/en/ WAMP] on Windows is also accepted.&lt;br /&gt;
&lt;br /&gt;
=Assignment: Set up basic IoT scenario=&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Internet_of_Things Internet of Things] is one of the emerging technologies (read: hype). IoT is essentially about getting everything online, including lightbulbs, switches, window shades etc. In this assignment LED symbolizes a light and the task is to implement code which allows user to switch the LED on and off over the network.&lt;br /&gt;
&lt;br /&gt;
[[File:Raspberry-pi-gpio-18-led bb.png|600px]]&lt;br /&gt;
&lt;br /&gt;
Goal: Get familiar how Python code can be started up. Build basic [https://en.wikipedia.org/wiki/Internet_of_Things IoT] appliance, a light that can be turned on and off via the Internet.&lt;br /&gt;
&lt;br /&gt;
Deadline: 7. October&lt;br /&gt;
&lt;br /&gt;
Points: 4 points&lt;br /&gt;
&lt;br /&gt;
* Complete the [http://codeacademy.com/tracks/python Python track at CodeAcademy] if you haven&#039;t done that yet.&lt;br /&gt;
* Follow the wiki page Blinking LED section under [[Getting started with Raspberry Pi]].&lt;br /&gt;
* Get an LED blinking on command-line.&lt;br /&gt;
* Get LED blinking from Python code.&lt;br /&gt;
* Get basic HTTP server running in Python.&lt;br /&gt;
* Combine all of the above, build an HTTP server that can be used to turn LED on and off from via web browser.&lt;br /&gt;
* Optional: Take a peek at next assignment and upload working version to GitHub.&lt;br /&gt;
* Optional: [http://sourceforge.net/p/raspberry-gpio-python/wiki/PWM/ Smoothen the transitions using PWM].&lt;br /&gt;
&lt;br /&gt;
=Assignment: Collaborating using Git=&lt;br /&gt;
&lt;br /&gt;
Software development is usually done by several contributors, to facilitate efficient collaboration a distributed version control system is a must. In this assignment you&#039;ll upload your code to GitHub and modify fellow student&#039;s code to reflect changes in the Raspberry Pi setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Raspberry-pi-rgb-led bb.png|600px]]&lt;br /&gt;
&lt;br /&gt;
Deadline: 14. October&lt;br /&gt;
&lt;br /&gt;
Points: 5&lt;br /&gt;
&lt;br /&gt;
Goal: Get familiar with distributed version control systems. Collaborate.&lt;br /&gt;
&lt;br /&gt;
* Create [https://github.com/ GitHub] account if you haven&#039;t done so yet.&lt;br /&gt;
* Create a Git repository, eg http://github.com/your-username/rpi-iot-example&lt;br /&gt;
* Install Git on your Raspberry Pi by using &amp;lt;code&amp;gt;apt-get install git&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Clone the repository to your Raspberry Pi using &amp;lt;code&amp;gt;git clone http://github.com/your-username/rpi-iot-example&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Move the Python code created earlier to the Git repository directory.&lt;br /&gt;
* Use &amp;lt;code&amp;gt;git add&amp;lt;/code&amp;gt; to add the files.&lt;br /&gt;
* Configure full name: &amp;lt;code&amp;gt;git config --global user.name &amp;quot;Firstname Surname&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
* Configure e-mail: &amp;lt;code&amp;gt;git config --global user.email first.last@domain.tld&amp;lt;/code&amp;gt; &lt;br /&gt;
* Use &amp;lt;code&amp;gt;git commit&amp;lt;/code&amp;gt; to create the [http://blog.no-panic.at/2014/10/20/funny-initial-git-commit-messages/ initial commit].&lt;br /&gt;
* Use &amp;lt;code&amp;gt;git push&amp;lt;/code&amp;gt; to push the commits to GitHub server.&lt;br /&gt;
* Set up [https://help.github.com/articles/generating-ssh-keys/ public key authentication between your laptop and GitHub servers], verify that &amp;lt;code&amp;gt;https://github.com/username.keys&amp;lt;/code&amp;gt; gives the expected result.&lt;br /&gt;
* Use &amp;lt;code&amp;gt;git clone&amp;lt;/code&amp;gt; to clone the repository to your laptop. Ubuntu should first &amp;lt;code&amp;gt;apt-get install git&amp;lt;/code&amp;gt;, Windows and Mac users might want to take a look at [http://git-scm.com/download/ Git homepage]. If you&#039;re looking for graphical user interface take a look at [https://desktop.github.com/ GitHub Desktop] or [https://tortoisegit.org/ TortoiseGit].&lt;br /&gt;
* Create [https://en.wikipedia.org/wiki/README README] in the repository directory, populate it with relevant content - what is it about, who made it etc and commit the changes.&lt;br /&gt;
* In your Raspberry Pi setup replace the single-color LED with RGB LED as shown above.&lt;br /&gt;
* Clone &#039;&#039;&#039;fellow student&#039;s&#039;&#039;&#039; repository and adapt the code to reflect physical changes to the setup, the Python snippet should now permit changing the color of the light, have it blinking and turn it off. Other interesting modes are awarded with extra points.&lt;br /&gt;
* Use either [https://www.atlassian.com/git/tutorials/ Atlassian Tutorials], [http://rogerdudler.github.io/git-guide/ git - the simple guide] or [https://try.github.io/ Try Git] as a reference if you get lost.&lt;br /&gt;
* Document in the README what GPIO pins are used in the code for red, green and blue. Extra points for making the Python code [https://docs.python.org/2/library/argparse.html#module-argparse configurable from command-line].&lt;br /&gt;
* Late submissions will heavily lose points for failure to comply with [http://chris.beams.io/posts/git-commit/ decent commit messages].&lt;br /&gt;
* Send Lauri the URL of your repository at GitHub.&lt;br /&gt;
&lt;br /&gt;
Git resources: [http://git-scm.com/book/en/v2 Pro Git Book] (read the basics to get kickstarted) and [https://www.codecademy.com/en/courses/learn-git/ Codecademy Git course].&lt;br /&gt;
&lt;br /&gt;
=Assignment: Disassembling Python=&lt;br /&gt;
&lt;br /&gt;
CPython is the default, most widely used implementation of the Python programming language. CPython is written in C. CPython compiles Python source into bytecode which is interpreted by a Python virtual (stack) machine. This is very similar to what is done with Java. Use [https://docs.python.org/2/library/dis.html dis] to disassemble a Python function into stack machine instructions. Follow [https://docs.python.org/2/library/dis.html#python-bytecode-instructions bytecode instructions] to determine what each instruction does.&lt;br /&gt;
&lt;br /&gt;
Deadline: 21. October&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example submission==&lt;br /&gt;
&lt;br /&gt;
Consider following Python function, which calculates the sum of squares. For example sum_of_powers(2, 3) == 14 (1**2 + 2**2 + 3**2):&lt;br /&gt;
&lt;br /&gt;
 def sum_of_powers(exponent, numbers):&lt;br /&gt;
     counter = 1&lt;br /&gt;
     return_value = 0&lt;br /&gt;
     while True:&lt;br /&gt;
         if counter &amp;gt; numbers:&lt;br /&gt;
             break&lt;br /&gt;
         return_value += counter ** exponent&lt;br /&gt;
         counter += 1&lt;br /&gt;
     return return_value&lt;br /&gt;
 &lt;br /&gt;
 # Following two lines are the ones which produce the instructions shown below&lt;br /&gt;
 from dis import dis&lt;br /&gt;
 dis(sum_of_powers)&lt;br /&gt;
&lt;br /&gt;
Corresponding Python stack machine instructions extracted with &amp;lt;code&amp;gt;dis&amp;lt;/code&amp;gt; are following. Columns correspond to: line number in the source code, instruction offset (in bytes), instruction name as listed [https://docs.python.org/2/library/dis.html in dis documentation], &lt;br /&gt;
&lt;br /&gt;
 22           0 LOAD_CONST               1 (1)               # Constant of 1 is pushed to stack&lt;br /&gt;
              3 STORE_FAST               2 (counter)         # Pushed value is popped and stored in variable counter&lt;br /&gt;
 &lt;br /&gt;
 23           6 LOAD_CONST               2 (0)               # Constant of 0 is pushed to stack&lt;br /&gt;
              9 STORE_FAST               3 (return_value)    # Pushed value is popped and stored in variable return_value&lt;br /&gt;
 &lt;br /&gt;
 24          12 SETUP_LOOP              43 (to 58)           # Loop until instruction no 58 is set up&lt;br /&gt;
 &lt;br /&gt;
 25     &amp;gt;&amp;gt;   15 LOAD_FAST                2 (counter)             # Value of variable &amp;lt;counter&amp;gt; is pushed to stack&lt;br /&gt;
             18 LOAD_FAST                1 (numbers)             # Value of variable &amp;lt;numbers&amp;gt; is pushed to stack&lt;br /&gt;
             21 COMPARE_OP               4 (&amp;gt;)                   # Two topmost values of stack are popped and compared,&lt;br /&gt;
                                                                 # boolean result is pushed back to the top of stack&lt;br /&gt;
             24 POP_JUMP_IF_FALSE       31                       # If top of the stack if False,&lt;br /&gt;
                                                                 # jump to instruction no 31 is performed.&lt;br /&gt;
                                                                 # Top of the stack is popped&lt;br /&gt;
 &lt;br /&gt;
 26          27 BREAK_LOOP                                       # Execution jumps out of the loop, the one&lt;br /&gt;
                                                                 # that was set up at inst no 12&lt;br /&gt;
             28 JUMP_FORWARD             0 (to 31)               # Placeholder probably due to the way pipeline is handled&lt;br /&gt;
 &lt;br /&gt;
 27     &amp;gt;&amp;gt;   31 LOAD_FAST                3 (return_value)        # Value of variable &amp;lt;return_value&amp;gt; is pushed to stack&lt;br /&gt;
             34 LOAD_FAST                2 (counter)             # Value of variable &amp;lt;counter&amp;gt; is pushed to stack&lt;br /&gt;
             37 LOAD_FAST                0 (exponent)            # Value of variable &amp;lt;exponent&amp;gt; is pushed to stack&lt;br /&gt;
             40 BINARY_POWER                                     # Exponentiation of two topmost values is performed and&lt;br /&gt;
                                                                 # substituted with the result&lt;br /&gt;
             41 INPLACE_ADD                                      # Two topmost values are added and substituted with the sum&lt;br /&gt;
             42 STORE_FAST               3 (return_value)        # Sum of the addition is stored in variable &amp;lt;return_value&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 28          45 LOAD_FAST                2 (counter)             # Value of variable &amp;lt;counter&amp;gt; is pushed to stack&lt;br /&gt;
             48 LOAD_CONST               1 (1)                   # Constant of 1 is pushed to stack&lt;br /&gt;
             51 INPLACE_ADD                                      # Two topmost values are added and substituted with the sum&lt;br /&gt;
             52 STORE_FAST               2 (counter)             # Sum is stored in the variable &amp;lt;counter&amp;gt;&lt;br /&gt;
             55 JUMP_ABSOLUTE           15                       # Code execution jumps to instruction no 15 (the beginning of the loop)&lt;br /&gt;
 &lt;br /&gt;
 29     &amp;gt;&amp;gt;   58 LOAD_FAST                3 (return_value)    # The value of variable &amp;lt;return_value&amp;gt; is pushed to stack&lt;br /&gt;
             61 RETURN_VALUE                                 # Return top of the stack to the function caller&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the Python VM the state consists of:&lt;br /&gt;
&lt;br /&gt;
* Program counter (PC), the number of currently executed instruction&lt;br /&gt;
* The stack and most importantly top of stack (TOS)&lt;br /&gt;
* Constants extracted from source (co_consts)&lt;br /&gt;
* Variables names (co_names)&lt;br /&gt;
* Variables values (co_varnames)&lt;br /&gt;
* There are *no* registers!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Executing the function with arguments exponent=2 and numbers=3 will result in return value of 14, the arguments are already placed in the co_varnames array by the calling function. Also the constants used in the code are present, so you may assume following state in the Python interpreter just before entering the function body:&lt;br /&gt;
&lt;br /&gt;
    -1. stack = []; co_varnames = [2, 3]; co_consts[?, 1, 0]&lt;br /&gt;
&lt;br /&gt;
The steps that Python VM takes to get to the results are following:&lt;br /&gt;
&lt;br /&gt;
     0. LOAD_CONST 1: stack = [1]&lt;br /&gt;
     3. STORE_FAST 2: stack = []; co_varnames = [2, 3, 1]&lt;br /&gt;
     6. LOAD_CONST 2: stack = [0];&lt;br /&gt;
     9. STORE_FAST 3: stack = []; co_varnames = [2, 3, 1, 0]&lt;br /&gt;
    12. SETUP_LOOP 43: stack = []; loop is set up, counter is 1&lt;br /&gt;
 &lt;br /&gt;
    Here we enter loop body for the first time&lt;br /&gt;
    &lt;br /&gt;
    15. LOAD_FAST 2: stack = [1]&lt;br /&gt;
    18. LOAD_FAST 1: stack = [1, 3]&lt;br /&gt;
    21. COMPARE_OP 4: stack = [False]&lt;br /&gt;
    24. POP_JUMP_IF_FALSE 31: stack = []; jump to instruction 31&lt;br /&gt;
    31. LOAD_FAST 3: stack = [0];&lt;br /&gt;
    34. LOAD_FAST 2: stack = [0, 1];&lt;br /&gt;
    37. LOAD_FAST 0: stack = [0, 1, 2];&lt;br /&gt;
    40. BINARY_POWER: stack = [0, 1]&lt;br /&gt;
    41. INPLACE_ADD: stack = [1]&lt;br /&gt;
    42. STORE_FAST 3: stack = []; co_varnames = [2, 3, 1, 1]&lt;br /&gt;
    45. LOAD_FAST 3: stack = [1];&lt;br /&gt;
    48. LOAD_CONST 1: stack = [1, 1];&lt;br /&gt;
    51. INPLACE_ADD: stack = [2]&lt;br /&gt;
    52. STORE_FAST 2: stack = []; co_varnames = [2, 3, 2, 1]&lt;br /&gt;
    53. JUMP_ABSOLUTE 15: jump to instruction no 15, counter is 2&lt;br /&gt;
 &lt;br /&gt;
    Here we enter loop body for the second time&lt;br /&gt;
    &lt;br /&gt;
    15. LOAD_FAST 2: stack = [2]&lt;br /&gt;
    18. LOAD_FAST 1: stack = [2, 3]&lt;br /&gt;
    21. COMPARE_OP: stack = [False]&lt;br /&gt;
    24. POP_JUMP_IF_FALSE 31: stack = []; jump to instruction 31&lt;br /&gt;
    31. LOAD_FAST 3: stack = [1]; here we have only 1**1&lt;br /&gt;
    34. LOAD_FAST 2: stack = [1, 2];&lt;br /&gt;
    37. LOAD_FAST 0: stack = [1, 2, 2];&lt;br /&gt;
    40. BINARY_POWER: stack = [1, 4]&lt;br /&gt;
    41. INPLACE_ADD: stack = [5]; here we already have 1**2 + 2**2&lt;br /&gt;
    42. STORE_FAST 3: stack = []; co_varnames = [2, 3, 2, 5]&lt;br /&gt;
    45. LOAD_FAST 3: stack = [2];&lt;br /&gt;
    48. LOAD_CONST 1: stack = [2, 1];&lt;br /&gt;
    51. INPLACE_ADD: stack = [3]&lt;br /&gt;
    52. STORE_FAST 2: stack = []; co_varnames = [2, 3, 3, 5]&lt;br /&gt;
    53. JUMP_ABSOLUTE 15: jump to instruction no 15, counter is 3&lt;br /&gt;
 &lt;br /&gt;
    Here we enter the loop body third time&lt;br /&gt;
    &lt;br /&gt;
    15. LOAD_FAST 2: stack = [3]&lt;br /&gt;
    18. LOAD_FAST 1: stack = [3, 3]&lt;br /&gt;
    21. COMPARE_OP: stack = [False]&lt;br /&gt;
    24. POP_JUMP_IF_FALSE 31: stack = []; jump to instruction 31&lt;br /&gt;
    31. LOAD_FAST 3: stack = [5]&lt;br /&gt;
    34. LOAD_FAST 2: stack = [5, 3];&lt;br /&gt;
    37. LOAD_FAST 0: stack = [5, 3, 2];&lt;br /&gt;
    40. BINARY_POWER: stack = [5, 9]&lt;br /&gt;
    41. INPLACE_ADD: stack = [14]; here we have 1**2 + 2**2 + 3**2&lt;br /&gt;
    42. STORE_FAST: stack = []; co_varnames = [2, 3, 3, 14]&lt;br /&gt;
    45. LOAD_FAST 3: stack = [3];&lt;br /&gt;
    48. LOAD_CONST 1: stack = [3, 1];&lt;br /&gt;
    51. INPLACE_ADD: stack = [4]&lt;br /&gt;
    52. STORE_FAST 2: stack = []; co_varnames = [2, 3, 4, 14]&lt;br /&gt;
    53. JUMP_ABSOLUTE 15: jump to instruction no 15, counter is 4&lt;br /&gt;
 &lt;br /&gt;
    Here we enter the loop body fourth (!!!) time&lt;br /&gt;
    &lt;br /&gt;
    15. LOAD_FAST 2; stack = [4]&lt;br /&gt;
    18. LOAD_FAST 1; stack = [4, 3]&lt;br /&gt;
    21. COMPARE_OP 4; stack = [True]&lt;br /&gt;
    24. POP_JUMP_IF_FALSE 31; stack = []; but the condition does not hold anymore so we jump out of the loop&lt;br /&gt;
    27. BREAK_LOOP; break out of the loop&lt;br /&gt;
    58. LOAD_FAST 3; stack = [14]&lt;br /&gt;
    61. RETURN_VALUE; return 14 to caller&lt;br /&gt;
&lt;br /&gt;
==Assignment steps==&lt;br /&gt;
&lt;br /&gt;
# Select one of the Fibonacci code examples below.&lt;br /&gt;
# Use &amp;lt;code&amp;gt;from dis import dis&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dis(function_name_goes_here)&amp;lt;/code&amp;gt; to disassemble the function to opcodes.&lt;br /&gt;
# Comment the stack machine instructions as shown above (3p).&lt;br /&gt;
# Invoke the Fibonacci number calculation function with n=2, follow the instructions and elaborate after each instruction executed a) the stack contents b) co_varnames contents c) co_names contents d) what happened as shown above. Note that certain code blocks will be executed repeatedly, which means you&#039;ll have more than &#039;&#039;&#039;30 instructions executed&#039;&#039;&#039; (2p).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Fibonacci with iterators:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def fib(n):&lt;br /&gt;
    a,b = 1,1&lt;br /&gt;
    for i in range(n-1):&lt;br /&gt;
        a,b = b,a+b&lt;br /&gt;
    return a&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fibonacci with recursion:&lt;br /&gt;
&lt;br /&gt;
 def fib(n):&lt;br /&gt;
     if n==1 or n==2:&lt;br /&gt;
         return 1&lt;br /&gt;
     return fib(n-1) + fib(n-2)&lt;br /&gt;
&lt;br /&gt;
Fibonacci with infinite loop and breaks:&lt;br /&gt;
&lt;br /&gt;
 def fib3(n):&lt;br /&gt;
     a,b,i = 1,1,0&lt;br /&gt;
     while True:&lt;br /&gt;
         i += 1&lt;br /&gt;
         if i &amp;gt;= n: break&lt;br /&gt;
         b,a = a+b,b&lt;br /&gt;
     return a&lt;br /&gt;
&lt;br /&gt;
Another variation:&lt;br /&gt;
&lt;br /&gt;
 def fib4(n):&lt;br /&gt;
     a = 1&lt;br /&gt;
     b = 1&lt;br /&gt;
     i = 0&lt;br /&gt;
     while True:&lt;br /&gt;
         i += 1&lt;br /&gt;
         if i &amp;gt;= n: break&lt;br /&gt;
         s = a + b&lt;br /&gt;
         a = b&lt;br /&gt;
         b = s&lt;br /&gt;
     return a&lt;br /&gt;
&lt;br /&gt;
=Assignment: Investigating compilers=&lt;br /&gt;
&lt;br /&gt;
Use what you learned in the [https://wiki.itcollege.ee/index.php/Getting_started_with_GCC Getting started with GCC] session.&lt;br /&gt;
See assignment steps below.&lt;br /&gt;
Everything you need to understand ARM instructions should be [http://aelmahmoudy.users.sourceforge.net/electronix/arm/chapter2.htm here].&lt;br /&gt;
Another good resource seems to be [http://www.davespace.co.uk/arm/introduction-to-arm/ Introduction to ARM] by David Thomas.&lt;br /&gt;
See page 14 of [http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042e/IHI0042E_aapcs.pdf Procedure Call Standard for the ARM® Architecture] if you want to learn more about how function calls are implemented on ARM.&lt;br /&gt;
See [http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0204j/Cihfddaf.html here] for more information about branching instructions: B, BL, BX.&lt;br /&gt;
&amp;lt;Insert extemely useful link here yourself&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Deadline: 4. November&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t have Ubuntu installed on your machine skip next step and use SSH to perform these steps remotely at &amp;lt;code&amp;gt;enos.itcollege.ee&amp;lt;/code&amp;gt;.&lt;br /&gt;
Otherwise install ARM cross-compiler:&lt;br /&gt;
&lt;br /&gt;
 apt-get install gcc-arm-linux-gnueabi&lt;br /&gt;
&lt;br /&gt;
Consider C snippet for calculating integer [https://en.wikipedia.org/wiki/Exponentiation exponentiation], place it in a file &amp;lt;code&amp;gt;power.c&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 int power(long base, long exponent) {&lt;br /&gt;
     int counter;&lt;br /&gt;
     int result = 1;&lt;br /&gt;
     for (counter = 0; counter &amp;lt; exponent; counter++)&lt;br /&gt;
         result *= base;&lt;br /&gt;
     return result;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Generating assembly===&lt;br /&gt;
&lt;br /&gt;
Compile ARM assembly of the code snippet:&lt;br /&gt;
&lt;br /&gt;
 arm-linux-gnueabi-gcc -Os -S power.c -o power.s   # Cross-compile ARM assembly file power.s from C source code file power.c&lt;br /&gt;
 cat power.s                                       # Dump the assembly file on terminal&lt;br /&gt;
&lt;br /&gt;
The compiler should produce something similar to following:&lt;br /&gt;
&lt;br /&gt;
 	.arch armv5t&lt;br /&gt;
 	.fpu softvfp&lt;br /&gt;
 	.eabi_attribute 20, 1&lt;br /&gt;
 	.eabi_attribute 21, 1&lt;br /&gt;
 	.eabi_attribute 23, 3&lt;br /&gt;
 	.eabi_attribute 24, 1&lt;br /&gt;
 	.eabi_attribute 25, 1&lt;br /&gt;
 	.eabi_attribute 26, 2&lt;br /&gt;
 	.eabi_attribute 30, 2&lt;br /&gt;
 	.eabi_attribute 34, 0&lt;br /&gt;
 	.eabi_attribute 18, 4&lt;br /&gt;
 	.file	&amp;quot;power.c&amp;quot;&lt;br /&gt;
 	.text&lt;br /&gt;
 	.align	2&lt;br /&gt;
 	.global	power&lt;br /&gt;
 	.type	power, %function&lt;br /&gt;
 power:&lt;br /&gt;
 	@ args = 0, pretend = 0, frame = 0&lt;br /&gt;
 	@ frame_needed = 0, uses_anonymous_args = 0&lt;br /&gt;
 	@ link register save eliminated.&lt;br /&gt;
 	cmp	r1, #0&lt;br /&gt;
 	mov	r2, #1&lt;br /&gt;
 	ble	.L2&lt;br /&gt;
 	mov	r3, #0&lt;br /&gt;
 .L3:&lt;br /&gt;
 	add	r3, r3, #1&lt;br /&gt;
 	cmp	r3, r1&lt;br /&gt;
 	mul	r2, r0, r2&lt;br /&gt;
 	bne	.L3&lt;br /&gt;
 .L2:&lt;br /&gt;
 	mov	r0, r2&lt;br /&gt;
 	bx	lr&lt;br /&gt;
 	.size	power, .-power&lt;br /&gt;
 	.ident	&amp;quot;GCC: (Ubuntu/Linaro 4.7.3-12ubuntu1) 4.7.3&amp;quot;&lt;br /&gt;
 	.section	.note.GNU-stack,&amp;quot;&amp;quot;,%progbits&lt;br /&gt;
&lt;br /&gt;
===Commenting the assembly===&lt;br /&gt;
&lt;br /&gt;
You can safely ignore the lines starting with dot, these are simply hints for the next stage of the compilation process.&lt;br /&gt;
Thus you&#039;re left only (!!!) 10 actual instructions. Here you can also see what kind of comments are expected from the submission:&lt;br /&gt;
&lt;br /&gt;
 power:&lt;br /&gt;
 	cmp	r1, #0             /* Compare register r1 (second argument) contents against constant 0 */    &lt;br /&gt;
 	mov	r2, #1             /* Copy the constant 1 to register r2 */&lt;br /&gt;
 	ble	.L2                /* Jump to label .L2 if the comparison was false */&lt;br /&gt;
 	mov	r3, #0             /* Copy the constant 0 to register r3 */&lt;br /&gt;
 .L3:&lt;br /&gt;
 	add	r3, r3, #1         /* Perform r3 = r3 + 1 */&lt;br /&gt;
 	cmp	r3, r1             /* Compare register r3 and r1 (second argument) */&lt;br /&gt;
 	mul	r2, r0, r2         /* Perform r2 = r0 (first argument) * r2 */&lt;br /&gt;
 	bne	.L3                /* If r3 and r1 were different jump to label .L3&lt;br /&gt;
 .L2:&lt;br /&gt;
 	mov	r0, r2             /* Copy register r2 contents to register r0 */&lt;br /&gt;
 	bx	lr                 /* Jump back to caller */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Analyzing the code===&lt;br /&gt;
&lt;br /&gt;
Code analysis reveals that registers are mapped as following:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;r0&amp;lt;/code&amp;gt; - argument &amp;lt;code&amp;gt;base&amp;lt;/code&amp;gt; and eventually return value&lt;br /&gt;
* &amp;lt;code&amp;gt;r1&amp;lt;/code&amp;gt; - argument &amp;lt;code&amp;gt;exponent&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;r2&amp;lt;/code&amp;gt; - variable &amp;lt;code&amp;gt;result&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;r3&amp;lt;/code&amp;gt; - variable &amp;lt;code&amp;gt;counter&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can also see how the &amp;lt;code&amp;gt;for&amp;lt;/code&amp;gt; loop gets translated into assembly:&lt;br /&gt;
&lt;br /&gt;
 power:&lt;br /&gt;
 	cmp	r1, #0&lt;br /&gt;
 	mov	r2, #1&lt;br /&gt;
 	ble	.L2&lt;br /&gt;
 	mov	r3, #0&lt;br /&gt;
 .L3:&lt;br /&gt;
 	add	r3, r3, #1 &amp;lt;---+&lt;br /&gt;
 	cmp	r3, r1         | 4 instructions are executed repeatedly&lt;br /&gt;
 	mul	r2, r0, r2     | if exponent is greater than 0&lt;br /&gt;
 	bne	.L3 -----------+&lt;br /&gt;
 .L2:&lt;br /&gt;
 	mov	r0, r2&lt;br /&gt;
 	bx	lr&lt;br /&gt;
&lt;br /&gt;
===Stepping through the instructions===&lt;br /&gt;
&lt;br /&gt;
When we execute the function with for example arguments base=5 and exponent=3 following happens in the processor.&lt;br /&gt;
Note that this will essentially calculates 5 ^ 3 (5 to the power of 3) which is 125.&lt;br /&gt;
Following has been done manually to illustrate how much time does it take to execute the the function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 /* When processor enters the function body the arguments are already placed in registers r0=5 (base), r1=3 (exponent) */&lt;br /&gt;
 cmp r1, #0                        /* Compare exponent to 0 */&lt;br /&gt;
 mov r2, #1                        /* Place constant 1 in register r2,&lt;br /&gt;
                                      this corresponds to result = 1 in C code */&lt;br /&gt;
 ble .L2                           /* Exponent was not less than 0, so no jump to L2&lt;br /&gt;
 mov r3, #0                        /* Place constant 0 in register r3,&lt;br /&gt;
                                      this corresponds to variable counter */&lt;br /&gt;
 &lt;br /&gt;
 add r3, r3, #1                    /* Perform r3 = 0 + 1 which results in 1 being stored to r3&lt;br /&gt;
                                      this corresponds to first invocation of counter++ in C code */&lt;br /&gt;
 cmp r3, r1                        /* Compare counter (1 in this case) to exponent (3), this will be used by bne instruction below */&lt;br /&gt;
 mul r2, r0, r2                    /* Perform r2 = r0 * r2 which results in 1 * 5 = 5 being placed in r2&lt;br /&gt;
                                      this corresponds to first invocation of result *= base in C code */&lt;br /&gt;
 bne .L3                           /* The comparison resulted in counter being not equal to exponent, so we jump back to L3&lt;br /&gt;
                                      this corresponds to first invocation of counter &amp;lt; exponent in C code */&lt;br /&gt;
 &lt;br /&gt;
 add r3, r3, #1                    /* Perform r3 = 1 + 1 which results in 2 being stored to r3&lt;br /&gt;
                                      this corresponds to second invocation of counter++ in C code */&lt;br /&gt;
 cmp r3, r1                        /* Compare counter (2 in this case) to exponent (3), this will be used by bne instruction below */&lt;br /&gt;
 mul r2, r0, r2                    /* Perform r2 = r0 * r2 which results 5 * 5 = 25 being placed in r2&lt;br /&gt;
                                      this corresponds to second invocation of result *= base in C code */&lt;br /&gt;
 bne .L3                           /* The comparison resulted in counter being not equal to exponent, so we jump back to L3&lt;br /&gt;
                                      this corresponds to second invocation of counter &amp;lt; exponent in C code */&lt;br /&gt;
 &lt;br /&gt;
 add r3, r3, #1                    /* Perform r3 = 2 + 1 which results in 3 being stored to r3&lt;br /&gt;
                                      this corresponds to third invocation of counter++ in C code */&lt;br /&gt;
 cmp r3, r1                        /* Compare counter (3 in this case) to exponent (3), this will be used by bne instruction below */&lt;br /&gt;
 mul r2, r0, r2                    /* Perform r2 = r0 * r2 which results 25 * 5 = 125 being placed in r2&lt;br /&gt;
                                      this corresponds to third invocation of result *= base in C code */&lt;br /&gt;
 bne .L3                           /* The comparison resulted in counter being equal to exponent, so we DO NOT jump back to L3 */&lt;br /&gt;
 &lt;br /&gt;
 mov	r0, r2                     /* Copy register r2 contents (125) to register r0 */&lt;br /&gt;
 bx	lr                         /* Jump back to caller */&lt;br /&gt;
 /* Function returns with 125 placed in r0 this is where caller function should expect the return value */&lt;br /&gt;
 /* The other registers will still hold whatever values were left there: r1 = 3, r2 = 125, r3 = 3 */&lt;br /&gt;
&lt;br /&gt;
===ARM registers===&lt;br /&gt;
&lt;br /&gt;
If you get lost with the ARM register naming conventions use following as a guide.&lt;br /&gt;
&lt;br /&gt;
ARM7 has 16x 32-bit registers:&lt;br /&gt;
&lt;br /&gt;
  r0 (a1) - Argument/result/scratch register, this is where first function argument is usually placed&lt;br /&gt;
  r1 (a2) - Argument/result/scratch register, this is where second function argument is placed&lt;br /&gt;
  r2 (a3) - Argument/scratch register 3&lt;br /&gt;
  r3 (a4) - Argument/scratch register 4&lt;br /&gt;
  r4 (v1) - Variable register 1&lt;br /&gt;
  r5 (v2) - Variable register 2&lt;br /&gt;
  r6 (v3) - Variable register 3&lt;br /&gt;
  r7 (v4) - Variable register 4&lt;br /&gt;
  r8 (v5) - Variable register 5&lt;br /&gt;
  r9 (v6) - Variable register 6&lt;br /&gt;
 r10 (v7) - Variable register 7&lt;br /&gt;
 r11 (fp) - Frame pointer, variable register 8 &lt;br /&gt;
 r12 (ip) - Intra-procedure call scratch register&lt;br /&gt;
 r13 (sp) - Stack pointer&lt;br /&gt;
 r14 (lr) - Link register (to which memory address currently&lt;br /&gt;
                           executing function should return to?)&lt;br /&gt;
 r15 (pc) - Program counter (what is the memory address of instruction&lt;br /&gt;
      ^                      that we are going to execute next?)&lt;br /&gt;
      |&lt;br /&gt;
      +- These are simply aliases for the numbered registers and&lt;br /&gt;
         can be used interchangeably.&lt;br /&gt;
&lt;br /&gt;
==Assignment steps==&lt;br /&gt;
&lt;br /&gt;
# Select one of the Fibonacci calculation examples below and use ARM cross compiler as shown above to generate the assembly corresponding to the C source code (1p).&lt;br /&gt;
# Remove the compiler hints (lines starting with dot), this should leave you less than 20 instructions. If it&#039;s more than that try different optimization flags. Analyze and comment the assembly as shown above (1p).&lt;br /&gt;
# Use n=3 as argument and follow the instructions, what values are left in the registers after the function finishes (2p)?&lt;br /&gt;
# Optional/extra: Elaborate step by step what happens in the processor: what instruction is being executed and what values are left in registers after instruction finishes? (1p)&lt;br /&gt;
# Optional/extra: Recompile with different optimization levels: &amp;lt;code&amp;gt;-Os&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;-O0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;-O1&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;-O2&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-O3&amp;lt;/code&amp;gt;. What differences did you notice? (1p)&lt;br /&gt;
# Optional/extra: Take a guess which one of the Fibonacci calculation functions below is the slowest? Which one is the fastest? Why? (1p)&lt;br /&gt;
# Send your conclusions as e-mail attachment to Lauri, attach the commented assembly, make sure you &#039;&#039;&#039;use the address supplied above with the course code&#039;&#039;&#039;, otherwise your mail is not searchable in my mailbox.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Fibonacci calculation using &amp;lt;code&amp;gt;for&amp;lt;/code&amp;gt;-loop:&lt;br /&gt;
&lt;br /&gt;
 int fib(n) {&lt;br /&gt;
     int a = 1;&lt;br /&gt;
     int b = 1;&lt;br /&gt;
     int i;&lt;br /&gt;
     for (i = 0; i &amp;lt; n; i++) {&lt;br /&gt;
         int s = a + b;&lt;br /&gt;
         a = b;&lt;br /&gt;
         b = s;&lt;br /&gt;
     }&lt;br /&gt;
     return a;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Fibonacci calculation using recursion:&lt;br /&gt;
&lt;br /&gt;
 int fib2(n) {&lt;br /&gt;
     if (n == 1 || n== 2) {&lt;br /&gt;
         return 1;&lt;br /&gt;
     } else {&lt;br /&gt;
         return fib(n-1) + fib(n-2);&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Fibonacci calculation using &amp;lt;code&amp;gt;while&amp;lt;/code&amp;gt;-loop:&lt;br /&gt;
&lt;br /&gt;
 int fib4(n) {&lt;br /&gt;
     int a = 1;&lt;br /&gt;
     int b = 1;&lt;br /&gt;
     int i = 0;&lt;br /&gt;
     while(1) {&lt;br /&gt;
         i += 1;&lt;br /&gt;
         if (i &amp;gt;= n) { break; }&lt;br /&gt;
         int s = a + b;&lt;br /&gt;
         a = b;&lt;br /&gt;
         b = s;&lt;br /&gt;
     }&lt;br /&gt;
     return a;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=Assignment: Investigating microcontrollers=&lt;br /&gt;
&lt;br /&gt;
In this assignment we use Arduino to implement traffic lights for [http://www.nobleled.com/uploads/110833/100_101.jpg crossroads].&lt;br /&gt;
If you don&#039;t care much about doing this assignment hands on, you can give a try [https://123d.circuits.io/ online].&lt;br /&gt;
&lt;br /&gt;
==Assignment steps==&lt;br /&gt;
&lt;br /&gt;
* Install Arduino IDE on your personal machine, on Windows/Mac check out [https://www.arduino.cc/ Arduino homepage] for instructions, on Ubuntu &amp;lt;code&amp;gt;apt-get install arduino&amp;lt;/code&amp;gt; should suffice. You can also use school computers, Ubuntu has Arduino preinstalled.&lt;br /&gt;
* From Arduino IDE menu open up File -&amp;gt; Examples -&amp;gt; 01. Basic -&amp;gt; Blink&lt;br /&gt;
* In Arduino IDE menu Tools -&amp;gt; Board -&amp;gt; Arduino Mega2560&lt;br /&gt;
* In Arduino IDE menu Tools -&amp;gt; Serial port -&amp;gt; Select what makes sense&lt;br /&gt;
* On Ubuntu you may have to add yourself to the dialout group before you can access the serial ports. Use the command &amp;lt;code&amp;gt;sudo gpasswd -a $USER dialout&amp;lt;/code&amp;gt;, log out and log in again to your PC.&lt;br /&gt;
* Press the second button in the toolbar to upload the code, make sure the changes take effect on the board. You should see on-board LED blinking.&lt;br /&gt;
* Connect some LED-s to the board. &#039;&#039;&#039;MAKE SURE YOU USE RESISTORS TO PROTECT LED-s AND THE BOARD&#039;&#039;&#039;&lt;br /&gt;
* Implement traffic light cycle using &amp;lt;code&amp;gt;digitalWrite&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;delay&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;loop&amp;lt;/code&amp;gt; function (3p)&lt;br /&gt;
* Use interrupts to read button presses, see example below. Pressing the button should toggle the LED now (1p)&lt;br /&gt;
* Extra: Use [https://www.arduino.cc/en/Reference/AnalogWrite PWM] to implement smoother blinking (1p)&lt;br /&gt;
* Extra: Use [http://lauri.vosandi.com/arduino/lcd1602-key-shield.html LCD1602] shield to display countdown (1p)&lt;br /&gt;
* Use [https://www.arduino.cc/en/Reference/Serial serial] interface to send messages to your PC.&lt;br /&gt;
* You can find useful code snippets for Robotics club equipment [http://lauri.vosandi.com/arduino here]&lt;br /&gt;
&lt;br /&gt;
==Code example: reading button press with interrupts==&lt;br /&gt;
&lt;br /&gt;
Set up a push button as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Arduino-pushbutton_bb.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Insert following code to Arduino IDE and upload it to Arduino, verify that it works:&lt;br /&gt;
&lt;br /&gt;
 int led = 13;&lt;br /&gt;
 int button  = 2;&lt;br /&gt;
 int flag = LOW;&lt;br /&gt;
 &lt;br /&gt;
 void setup() {&lt;br /&gt;
     pinMode(led, OUTPUT);         // Set up pin 13 as digital output&lt;br /&gt;
     pinMode(button, INPUT);       // Set up pin 9 as digital input&lt;br /&gt;
     digitalWrite(button, HIGH);   // Turn in pull-up resistor&lt;br /&gt;
 &lt;br /&gt;
     // Associate interrupt handler with an event&lt;br /&gt;
     attachInterrupt(digitalPinToInterrupt(button), onButtonPressed, FALLING);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void onButtonPressed() {&lt;br /&gt;
     // Keep this as short as possible&lt;br /&gt;
     flag = HIGH;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void loop() {&lt;br /&gt;
     // Do something useful or let processor sleep here&lt;br /&gt;
     if (flag) {&lt;br /&gt;
         digitalWrite(led, HIGH);&lt;br /&gt;
         delay(2000);&lt;br /&gt;
         flag = LOW;&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     digitalWrite(led, LOW);&lt;br /&gt;
     delay(50);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==Code example: Cycling through different traffic light states==&lt;br /&gt;
&lt;br /&gt;
Add LED-s to the design:&lt;br /&gt;
&lt;br /&gt;
[[File:Traffic-lights_bb.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Use following as hint to implement cycling through traffic light states:&lt;br /&gt;
&lt;br /&gt;
 // Define pin numbers&lt;br /&gt;
 int car_green = 5;&lt;br /&gt;
 int car_yellow = 6;&lt;br /&gt;
 int car_red = 7;&lt;br /&gt;
 &lt;br /&gt;
 // For LED-s we&#039;re sinking the 5V voltage, hence LED is turned on when voltage on the pin is LOW&lt;br /&gt;
 int on = LOW;&lt;br /&gt;
 int off = HIGH;&lt;br /&gt;
 &lt;br /&gt;
 void setup() {&lt;br /&gt;
     pinMode(car_green, OUTPUT);&lt;br /&gt;
     pinMode(car_yellow, OUTPUT);&lt;br /&gt;
     pinMode(car_red, OUTPUT);&lt;br /&gt;
     digitalWrite(cars_yellow, off);&lt;br /&gt;
     Serial.begin(9600);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void loop() {&lt;br /&gt;
     Serial.println(&amp;quot;Cars green, pedestrians red for 5 seconds&amp;quot;);&lt;br /&gt;
     digitalWrite(cars_red, off);&lt;br /&gt;
     digitalWrite(cars_green, on);&lt;br /&gt;
     delay(5000);&lt;br /&gt;
 &lt;br /&gt;
     Serial.println(&amp;quot;Green for cars is blinking 5 seconds&amp;quot;);&lt;br /&gt;
     for(int j = 0; j &amp;lt; 10; j++) {&lt;br /&gt;
         digitalWrite(cars_green, j % 2 == 0);&lt;br /&gt;
         delay(500);&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     Serial.println(&amp;quot;Cars red, pedestrians green for 5 seconds&amp;quot;);&lt;br /&gt;
     digitalWrite(cars_green, off);&lt;br /&gt;
     digitalWrite(cars_red, on);&lt;br /&gt;
     delay(5000);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Skeleton of the final submission==&lt;br /&gt;
&lt;br /&gt;
The real traffic light has of course a little bit more states:&lt;br /&gt;
&lt;br /&gt;
 1. Cars green, pedestrians red for 10 seconds&lt;br /&gt;
 2. Cars green **blinking**, pedestrians red for 2 seconds&lt;br /&gt;
 3. Cars red, pedestrians green for 10 seconds&lt;br /&gt;
 4. Cars red, pedestrians green **blinking** for 2 seconds&lt;br /&gt;
 5. Cars yellow, pedestrians red for 2 seconds&lt;br /&gt;
&lt;br /&gt;
So your final code will look something like this:&lt;br /&gt;
&lt;br /&gt;
 // Define pin numbers here&lt;br /&gt;
 &lt;br /&gt;
 // Initially the flag is low&lt;br /&gt;
 int pedestrian_requested_crossing = LOW;&lt;br /&gt;
  &lt;br /&gt;
 void setup() {&lt;br /&gt;
     // Initialize necessary pins as digital outputs&lt;br /&gt;
     // Reset pins with digitalWrite&lt;br /&gt;
 &lt;br /&gt;
     // Initialize button pin as digital input&lt;br /&gt;
     // Enable pull-up resistor on button pin&lt;br /&gt;
     // Associate button interrupt handler function (onButtonPressed) below with the event on the button&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void onButtonPressed() {&lt;br /&gt;
     // Here set pedestrian_requested_crossing flag to HIGH&lt;br /&gt;
     // Don&#039;t do anything else here!&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void loop() {&lt;br /&gt;
     Serial.println(&amp;quot;Cars green, pedestrians red for 5 seconds&amp;quot;);&lt;br /&gt;
     digitalWrite(cars_red, off);&lt;br /&gt;
     digitalWrite(cars_green, on);&lt;br /&gt;
     // Set pedestrian lights here&lt;br /&gt;
     delay(5000);&lt;br /&gt;
 &lt;br /&gt;
     if (pedestrian_requested_crossing) {&lt;br /&gt;
 &lt;br /&gt;
         Serial.println(&amp;quot;Green for cars is blinking 5 seconds&amp;quot;);&lt;br /&gt;
         for(int j = 0; j &amp;lt; 10; j++) {&lt;br /&gt;
             digitalWrite(cars_green, j % 2 == 0);&lt;br /&gt;
             delay(500);&lt;br /&gt;
         }&lt;br /&gt;
 &lt;br /&gt;
         Serial.println(&amp;quot;Cars red, pedestrians green for 5 seconds&amp;quot;);&lt;br /&gt;
         digitalWrite(cars_green, off);&lt;br /&gt;
         digitalWrite(cars_red, on);&lt;br /&gt;
         // Set pedestrian lights here&lt;br /&gt;
         delay(5000);&lt;br /&gt;
 &lt;br /&gt;
         // Add another state here&lt;br /&gt;
 &lt;br /&gt;
         // And another state here&lt;br /&gt;
 &lt;br /&gt;
         // Reset flag here&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=Assignment: Adders with NAND gates=&lt;br /&gt;
&lt;br /&gt;
In this assignment we use chips to build an adder. Get max points (4p) by wiring up half adder and double your points (8p) if you can make full adder work as well :)&lt;br /&gt;
&lt;br /&gt;
[[File:53-7400n-detailed.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Each SN74HC03N chip contains four NAND gates arranged like this, observe the pit on the left. VCC corresponds to 5V power supply and GND corresponds to ground or 0V.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Half adder==&lt;br /&gt;
&lt;br /&gt;
Each [http://www.ti.com/lit/gpn/sn74hc03 SN74HC03] contains 4 NAND gates.&lt;br /&gt;
Use breadboard to wire up half adder with 7400 chips (4p):&lt;br /&gt;
&lt;br /&gt;
[[File:Half-adder_bb.png|700px]]&lt;br /&gt;
&lt;br /&gt;
The truth table for half adder:&lt;br /&gt;
&lt;br /&gt;
   A  |  B  | Cout | Sum  | Human readable (how many bits are high?)&lt;br /&gt;
 -----+-----+------+------+-------------------------------------------&lt;br /&gt;
   0  |  0  |  0   |  0   | 0&lt;br /&gt;
 -----+-----+------+------+-------------------------------------------&lt;br /&gt;
   0  |  1  |  0   |  1   | 1&lt;br /&gt;
 -----+-----+------+------+-------------------------------------------&lt;br /&gt;
   1  |  0  |  0   |  1   | 1&lt;br /&gt;
 -----+-----+------+------+-------------------------------------------&lt;br /&gt;
   1  |  1  |  1   |  0   | 2&lt;br /&gt;
&lt;br /&gt;
==Full adder==&lt;br /&gt;
&lt;br /&gt;
You can double your points if you manage to wire up a full adder (+4p)&lt;br /&gt;
&lt;br /&gt;
[[File:Nand-full-adder.png]]&lt;br /&gt;
&lt;br /&gt;
On a breadboard it looks a bit messy, but if you pay attention to gate numbering as shown above it should make your life significantly easier.&lt;br /&gt;
The gates 1, 2, 3, 4 are placed in the leftmost chip; 5, 6, 7, 8 are placed in the middle one and gate 9 is the only one in the rightmost chip:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Full-adder_bb.png|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   A  |  B  | Cin | Cout | Sum  | Human readable (how many bits are high?)&lt;br /&gt;
 -----+-----+-----+------+------+-------------------------------------------&lt;br /&gt;
   0  |  0  |  0  |  0   |  0   | 0&lt;br /&gt;
 -----+-----+-----+------+------+-------------------------------------------&lt;br /&gt;
   0  |  0  |  1  |  0   |  1   | 1&lt;br /&gt;
 -----+-----+-----+------+------+-------------------------------------------&lt;br /&gt;
   0  |  1  |  0  |  0   |  1   | 1&lt;br /&gt;
 -----+-----+-----+------+------+-------------------------------------------&lt;br /&gt;
   0  |  1  |  1  |  1   |  0   | 2&lt;br /&gt;
 -----+-----+-----+------+------+-------------------------------------------&lt;br /&gt;
   1  |  0  |  0  |  0   |  1   | 1&lt;br /&gt;
 -----+-----+-----+------+------+-------------------------------------------&lt;br /&gt;
   1  |  0  |  1  |  1   |  0   | 2&lt;br /&gt;
 -----+-----+-----+------+------+-------------------------------------------&lt;br /&gt;
   1  |  1  |  0  |  1   |  0   | 2&lt;br /&gt;
 -----+-----+-----+------+------+-------------------------------------------&lt;br /&gt;
   1  |  1  |  1  |  1   |  1   | 3&lt;br /&gt;
&lt;br /&gt;
==Unittest==&lt;br /&gt;
&lt;br /&gt;
Use following code snippet on Arduino to test the circuit, it will shuffle through all the possible inputs and test whether the expected output is on the output pins.&lt;br /&gt;
If you see &amp;lt;code&amp;gt;sum&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;cout&amp;lt;/code&amp;gt; outputs giving 0 all the time it&#039;s likely you have resistors of too low resistance in the circuit which is draining all the voltage on the NAND gate output pins.&lt;br /&gt;
&lt;br /&gt;
 int PIN_A = 2;&lt;br /&gt;
 int PIN_B = 3;&lt;br /&gt;
 int PIN_CIN = 4;&lt;br /&gt;
 int PIN_SUM = 5;&lt;br /&gt;
 int PIN_COUT = 6;&lt;br /&gt;
 &lt;br /&gt;
 void setup() {&lt;br /&gt;
     // Set up serial&lt;br /&gt;
     Serial.begin(9600);&lt;br /&gt;
     &lt;br /&gt;
     // Set up operands&lt;br /&gt;
     pinMode(PIN_A, OUTPUT);&lt;br /&gt;
     pinMode(PIN_B, OUTPUT);&lt;br /&gt;
     pinMode(PIN_CIN, OUTPUT);&lt;br /&gt;
     digitalWrite(PIN_A, HIGH);&lt;br /&gt;
     digitalWrite(PIN_B, HIGH);&lt;br /&gt;
     digitalWrite(PIN_CIN, HIGH);&lt;br /&gt;
     &lt;br /&gt;
     // Set up measurement pins&lt;br /&gt;
     pinMode(PIN_SUM, INPUT);&lt;br /&gt;
     pinMode(PIN_COUT, INPUT);&lt;br /&gt;
     digitalWrite(PIN_SUM, HIGH); // Enable pull-up resistor&lt;br /&gt;
     digitalWrite(PIN_COUT, HIGH); // Enable pull-up resistor&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void test(int a, int b, int cin) {&lt;br /&gt;
     int cout = a &amp;amp;&amp;amp; b || a &amp;amp;&amp;amp; cin || b &amp;amp;&amp;amp; cin;&lt;br /&gt;
     int sum = a ^ b ^ cin;&lt;br /&gt;
     &lt;br /&gt;
     digitalWrite(PIN_A, a);&lt;br /&gt;
     digitalWrite(PIN_B, b);&lt;br /&gt;
     digitalWrite(PIN_CIN, cin);&lt;br /&gt;
     &lt;br /&gt;
     Serial.print(&amp;quot;Writing: a=&amp;quot;);&lt;br /&gt;
     Serial.print(a);&lt;br /&gt;
     Serial.print(&amp;quot;, b=&amp;quot;);&lt;br /&gt;
     Serial.print(b);&lt;br /&gt;
     Serial.print(&amp;quot;, cin=&amp;quot;);&lt;br /&gt;
     Serial.print(cin);&lt;br /&gt;
     Serial.print(&amp;quot;  Expecting: sum=&amp;quot;);&lt;br /&gt;
     Serial.print(sum);&lt;br /&gt;
     Serial.print(&amp;quot;, cout=&amp;quot;);&lt;br /&gt;
     Serial.print(cout);&lt;br /&gt;
     &lt;br /&gt;
     int measured_sum = digitalRead(PIN_SUM);&lt;br /&gt;
     int measured_cout = digitalRead(PIN_COUT);&lt;br /&gt;
 &lt;br /&gt;
     Serial.print(&amp;quot;  Got: sum=&amp;quot;);&lt;br /&gt;
     Serial.print(measured_sum);&lt;br /&gt;
     Serial.print(&amp;quot; cout=&amp;quot;);&lt;br /&gt;
     Serial.print(measured_cout);&lt;br /&gt;
     &lt;br /&gt;
     Serial.print(&amp;quot;  Test:&amp;quot;);&lt;br /&gt;
     if (measured_sum != sum || measured_cout != cout) {&lt;br /&gt;
         Serial.print(&amp;quot;  FAIL&amp;quot;);&lt;br /&gt;
     } else {&lt;br /&gt;
         Serial.print(&amp;quot;  GOOD&amp;quot;);&lt;br /&gt;
     }&lt;br /&gt;
     Serial.println();&lt;br /&gt;
     delay(500);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void loop() {&lt;br /&gt;
     Serial.println(&amp;quot;Running test&amp;quot;);&lt;br /&gt;
     test(0, 0, 0);&lt;br /&gt;
     test(0, 0, 1);&lt;br /&gt;
     test(0, 1, 0);&lt;br /&gt;
     test(0, 1, 1);&lt;br /&gt;
     test(1, 0, 0);&lt;br /&gt;
     test(1, 0, 1);&lt;br /&gt;
     test(1, 1, 0);&lt;br /&gt;
     test(1, 1, 1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=Assignment: Debugging ALU design=&lt;br /&gt;
&lt;br /&gt;
Bob had to ship the ALU design to the hardware manufacturer by yesterday. The project manager is angry about missed deadline. Bob still hasn&#039;t figured out why the ALU is not working properly. Help Bob by figuring out what&#039;s the problem.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re on Ubuntu install GHDL and GtkWave, otherwise simply use a school computer:&lt;br /&gt;
&lt;br /&gt;
 sudo add-apt-repository ppa:pgavin/ghdl&lt;br /&gt;
 sudo apt-get update&lt;br /&gt;
 sudo apt-get install ghdl gtkwave git&lt;br /&gt;
&lt;br /&gt;
Clone the repository&lt;br /&gt;
&lt;br /&gt;
 git clone https://github.com/laurivosandi/vhdl-exercise&lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; to compile the components and run the testbench:&lt;br /&gt;
&lt;br /&gt;
 cd path/to/vhdl-exercise&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
Expected output of the testbench:&lt;br /&gt;
&lt;br /&gt;
 alu_testbench.vhd:77:9:@360ns:(report note): Finished testing addition operation of ALU&lt;br /&gt;
 alu_testbench.vhd:106:9:@1us:(report note): Finished testing subtraction operation of ALU&lt;br /&gt;
 alu_testbench.vhd:135:9:@1640ns:(report note): Finished testing NAND operation of ALU&lt;br /&gt;
 alu_testbench.vhd:166:9:@2280ns:(report note): Finished testing NOR operation of ALU&lt;br /&gt;
&lt;br /&gt;
However there are few bugs in &amp;lt;code&amp;gt;alu.vhd&amp;lt;/code&amp;gt;, find the bugs and correct them. If this is your first experience with VHDL, take a look [http://lauri.vosandi.com/hdl/ here].&lt;br /&gt;
&lt;br /&gt;
=Assignment: Publishing your work=&lt;br /&gt;
&lt;br /&gt;
Deadline: 25. November&lt;br /&gt;
&lt;br /&gt;
* Clean up your Git repositories and send the URL of a repository that you&#039;ve actively worked on (for example the one from Java course) to Lauri, but before check the following:&lt;br /&gt;
** The repository should show changes you&#039;ve made over at least few days.&lt;br /&gt;
** The repository has to contain only plaintext files unless there is a really good reason not to (eg. images).&lt;br /&gt;
** There has to be authorship information in the files.&lt;br /&gt;
** Add &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file to your GitHub repositories to ignore temporary files, see [https://git-scm.com/docs/gitignore Git docs] for more details.&lt;br /&gt;
** Add [http://opensource.org/licenses LICENSE] file in the repository directory and commit the changes. LICENSE should answer to some important questions&lt;br /&gt;
*** Who is the copyright holder?&lt;br /&gt;
*** Under which conditions is redistribution permitted?&lt;br /&gt;
** Add nicely formatted README file, see [https://help.github.com/articles/markdown-basics/ Markdown] (online editor [http://dillinger.io here]) and [http://sphinx-doc.org/rest.html reStructuredText] for more details. README should answer to several silly questions:&lt;br /&gt;
*** What is the repository about?&lt;br /&gt;
*** Who made it?&lt;br /&gt;
*** How can the author be contacted? E-mail address, IRC chat channel on Freenode, Skype username?&lt;br /&gt;
*** How can the code be used? What hardware is necessary? How should the user wire the circuit to make it work? Add images if necessary.&lt;br /&gt;
*** What is the policy for including changes from third party developers?&lt;br /&gt;
* There will be more details here&lt;br /&gt;
&lt;br /&gt;
=Extra points=&lt;br /&gt;
&lt;br /&gt;
Here you can claim extra credit points for various tasks, this is mostly to improve the quality of wiki.itcollege.ee.&lt;br /&gt;
Once you have taken care of the task insert your name in the end of the line with corresponding date.&lt;br /&gt;
&lt;br /&gt;
* Expand [[Getting started with Ubuntu#Installing in VirtualBox]] section with highlighted screenshots of VirtualBox. Points: 1p&lt;br /&gt;
* Create [[Claiming GitHub Student Developer Pack]] with screenshots how to add @itcollege.ee e-mail to your GitHub profile and claim [https://education.github.com/pack Student Developer Pack] Points: 2p&lt;/div&gt;</summary>
		<author><name>Mhass</name></author>
	</entry>
</feed>