<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Monitoring &#8211; David&#039;s Homelab</title>
	<atom:link href="https://davidshomelab.com/category/monitoring/feed/" rel="self" type="application/rss+xml" />
	<link>https://davidshomelab.com/</link>
	<description></description>
	<lastBuildDate>Wed, 16 Feb 2022 19:52:19 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.10</generator>

<image>
	<url>https://davidshomelab.com/wp-content/uploads/2020/03/cropped-faviconhighrescentre.png</url>
	<title>Monitoring &#8211; David&#039;s Homelab</title>
	<link>https://davidshomelab.com/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Install Zabbix Proxy on pfSense to Monitor Hosts in Remote Sites</title>
		<link>https://davidshomelab.com/install-zabbix-proxy-on-pfsense-to-monitor-hosts-in-remote-sites/</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Tue, 23 Jun 2020 17:28:53 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[pfsense]]></category>
		<category><![CDATA[zabbix]]></category>
		<guid isPermaLink="false">https://davidshomelab.com/?p=528</guid>

					<description><![CDATA[<p>In a multi-site network you will most likely have VPNs connecting your sites, allowing remote connectivity to your main site. However, as these links are not necessarily 100% reliable, a dropped link could potentially result in the loss of monitoring data for a large number of hosts as the agent does not store any data ... <a title="Install Zabbix Proxy on pfSense to Monitor Hosts in Remote Sites" class="read-more" href="https://davidshomelab.com/install-zabbix-proxy-on-pfsense-to-monitor-hosts-in-remote-sites/" aria-label="More on Install Zabbix Proxy on pfSense to Monitor Hosts in Remote Sites">Read more</a></p>
<p>The post <a rel="nofollow" href="https://davidshomelab.com/install-zabbix-proxy-on-pfsense-to-monitor-hosts-in-remote-sites/">Install Zabbix Proxy on pfSense to Monitor Hosts in Remote Sites</a> appeared first on <a rel="nofollow" href="https://davidshomelab.com/">David&#039;s Homelab</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In a multi-site network you will most likely have VPNs connecting your sites, allowing remote connectivity to your main site. However, as these links are not necessarily 100% reliable, a dropped link could potentially result in the loss of monitoring data for a large number of hosts as the agent does not store any data by itself. By using Zabbix Proxies on remote sites it is possible to configure the agents to communicate only with the local proxy which will then store the data and relay it back to the main server when a link is available. Zabbix Proxy can be installed on any operating system that the Zabbix Server can be installed on but it can also be installed as a package on pfSense. This has the advantages that it does not require maintaining an additional server for each site and provides a simpler interface for configuring the proxy than installing it on a Linux server would.</p>


<h2>Install the Zabbix Proxy plug-in</h2>


<p>In the pfSense management console, go to System &gt; Package Manager &gt; Available Packages and search for &#8220;zabbix-proxy&#8221;. You will see multiple different versions. Unlike the agent, the proxy must be the same version as the server so select the appropriate one for your server. In this case we will install zabbix-proxy5.</p>


<h2>Connect the proxy to the server</h2>


<p>In the pfSense console go to Services &gt; Zabbix Proxy 5.0 and configure the proxy. Set the server to the IP address or hostname of the Zabbix server and the hostname to whatever you will call the proxy within the Zabbix console. The other options can be left as default but can be modified if desired. For example, if you only want the proxy to listen on one interface, set the listen IP to the pfSense IP address for the interface you want to listen on. If you have a large number of proxies you can increase this value to reduce load on the server but doing so will increase the propagation time for any changes you make to your setup.</p>


<p>While testing or for small deployments you may wish to lower the config frequency from the default of 1 hour. This value determines how often the proxy will contact the server to get the current configuration, including the hosts to monitor and the data it is supposed to collect.</p>


<p>Finally, enable the service and save the settings.</p>


<figure class="wp-block-image size-large"><img loading="lazy" width="1002" height="763" src="https://davidshomelab.com/wp-content/uploads/2020/06/image.png" alt="Screenshot of Zabbix proxy settings. Non-default settings:
Enable: Yes
Server: 172.16.24.8
Hostname: proxy-site-a
Config Frequency: 1025" class="wp-image-550" /></figure>


<p>Now the proxy is configured it is time to tell the server where to find it. From the Zabbix console, go to Administration &gt; Proxies. Click &#8220;Create proxy&#8221; to add the new proxy. Enter the name (this is the hostname you configured in the proxy) and the IP address of the proxy.</p>


<figure class="wp-block-image size-large"><img loading="lazy" width="567" height="286" src="https://davidshomelab.com/wp-content/uploads/2020/06/image-1.png" alt="Screenshot of add-proxy screen in Zabbix console.
Proxy Name: proxy-site-a
Proxy Mode: Active
Proxy Address: 172.16.24.1
Description: Site A Zabbix Proxy" class="wp-image-552" /></figure>


<p>Once you have added the proxy, reload the page and check that the proxy shows up in the list and it has a &#8220;last seen&#8221; value. If all is well and the listing shows something similar to the below, the proxy is set up and we are ready to configure hosts to talk to it.</p>


<figure class="wp-block-image size-large"><img loading="lazy" width="853" height="75" src="https://davidshomelab.com/wp-content/uploads/2020/06/image-2.png" alt="Screenshot showing proxy in Zabbix proxy list with last seen value of 1 second" class="wp-image-553" /></figure>


<h2>Configure the proxy to monitor hosts</h2>


<p>Configuring an agent to use a proxy is very similar to configuring it to talk to the server directly. For this example I will modify the CentOS host described in <a href="https://davidshomelab.com/install-zabbix-agent-to-monitor-windows-and-linux-hosts/" target="_blank" rel="noreferrer noopener">my post on configuring Zabbix agents</a> to get it to talk via the proxy.</p>


<p>Log in to the server and open <code>/etc/zabbix/zabbix_agent.conf</code>. Edit the Server and ServerActive values to the IP address or hostname of the Zabbix proxy and save and close the file. Restart the Zabbix agent:</p>


<pre class="wp-block-code"><code>systemctl restart zabbix-agent.service</code></pre>


<p>Now log in to the Zabbix console and go to Configuration &gt; Hosts and select the host you want to monitor via the proxy. In the host settings, click the drop-down next to &#8220;Monitored by proxy&#8221; and select the proxy you have configured the host to talk to. Click &#8220;Update&#8221; to save your settings.</p>


<figure class="wp-block-image size-large"><img loading="lazy" width="847" height="500" src="https://davidshomelab.com/wp-content/uploads/2020/06/image-3.png" alt="Zabbix host configuration screen with Monitored by proxy setting set to proxy-site-a" class="wp-image-554" /></figure>


<p>When you return to the hosts list you will probably see that the host appears to be offline. This is because the proxy will not find out that it is meant to be monitoring the host until the next time it syncs its settings with the server. If you have set a reasonable update frequency you will just need to wait for that period of time and it should start to appear and collect data automatically.</p>


<p>If you need to force the proxy to update immediately, log in to pfSense and go to Status &gt; Services and restart the zabbix_proxy service. When the service starts up this will force a config sync and you should see the host come online within a couple of seconds after the service restarts.</p>
<p>The post <a rel="nofollow" href="https://davidshomelab.com/install-zabbix-proxy-on-pfsense-to-monitor-hosts-in-remote-sites/">Install Zabbix Proxy on pfSense to Monitor Hosts in Remote Sites</a> appeared first on <a rel="nofollow" href="https://davidshomelab.com/">David&#039;s Homelab</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Upgrade Zabbix Server to 5.0 LTS</title>
		<link>https://davidshomelab.com/upgrade-zabbix-server-to-5-0-lts/</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Sat, 30 May 2020 16:29:34 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[centos8]]></category>
		<category><![CDATA[Linux monitoring]]></category>
		<category><![CDATA[zabbix]]></category>
		<guid isPermaLink="false">https://davidshomelab.com/?p=535</guid>

					<description><![CDATA[<p>Earlier this month, Zabbix server 5.0 LTS was released. Version 5.0 brings an updated UI, additional cloud integrations and support for the latest Zabbix agent (the old agent is still supported so you don&#8217;t need to upgrade the agent on all your hosts immediately). If you are using Zabbix Proxy to monitor some of your ... <a title="Upgrade Zabbix Server to 5.0 LTS" class="read-more" href="https://davidshomelab.com/upgrade-zabbix-server-to-5-0-lts/" aria-label="More on Upgrade Zabbix Server to 5.0 LTS">Read more</a></p>
<p>The post <a rel="nofollow" href="https://davidshomelab.com/upgrade-zabbix-server-to-5-0-lts/">Upgrade Zabbix Server to 5.0 LTS</a> appeared first on <a rel="nofollow" href="https://davidshomelab.com/">David&#039;s Homelab</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Earlier this month, Zabbix server 5.0 LTS was released. Version 5.0 brings an updated UI, additional cloud integrations and support for the latest Zabbix agent (the old agent is still supported so you don&#8217;t need to upgrade the agent on all your hosts immediately). If you are using Zabbix Proxy to monitor some of your hosts, you will need to update this at the same time as the proxy and server must have the same major version number as the server.</p>



<p>I will be upgrading the Zabbix server I set up in my previous tutorials on Zabbix so this guide assumes a CentOS 8 operating system. With the exception of the package manager commands, the steps should be more or less the same on any Linux distribution.</p>



<h2>Update your system</h2>



<p>Before making major changes it is worth making sure the base system is up to date to make sure there aren&#8217;t any issues arising from using older packages. Run the following commands to update and reboot the system.</p>



<pre class="wp-block-code"><code>dnf upgrade
reboot</code></pre>



<h2>Back up your current installation</h2>



<p>While the upgrade process shouldn&#8217;t cause too many problems, it will make changes to your database and overwrite the old installation. In the event that this process runs into an error or the machine crashes or loses power while the upgrade is in progress, having a backup of your database and configuration files will make recovery a lot easier.</p>



<p>Create a directory to store all your backups:</p>



<pre class="wp-block-code"><code>mkdir /opt/zabbix-backup
cd /opt/zabbix-backup</code></pre>



<p>Now we will need to stop the Zabbix server to ensure that the database remains in a consistent state while we are performing the backups. Run the following commands to stop Zabbix and write the database to a file:</p>



<pre class="wp-block-code"><code>systemctl stop zabbix-server.service
mysqldump -u&#91;zabbix-user] -p &#91;zabbix database] &gt; zabbix-database.sql</code></pre>



<p>For the <code>mysqldump</code> command, you will need to enter the names of the Zabbix database user and the database in the appropriate places. If you do not remember what these are, check in <code>/etc/zabbix/zabbix_server.conf</code>. The lines you are looking for are <code>DBName</code>, <code>DBUser</code> and <code>DBPassword</code>.</p>



<p>You will also want to back up your  configuration files as follows:</p>



<pre class="wp-block-code"><code>cp /etc/zabbix/zabbix_server.conf /opt/zabbix-backup/
cp /etc/httpd/conf.d/zabbix.conf  /opt/zabbix-backup/
cp -R /usr/share/zabbix/ /opt/zabbix-backup/
cp -R /usr/share/doc/zabbix-* /opt/zabbix-backup/</code></pre>



<h2>Update Zabbix</h2>



<p>Install the new repo by running the following commands:</p>



<pre class="wp-block-code"><code>rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm
dnf clean all </code></pre>



<p>If you are not running CentOS 8, check the <a href="https://www.zabbix.com/download" target="_blank" rel="noreferrer noopener">Zabbix download page</a> for the link the the correct repo for your distribution and the required commands to install it.</p>



<p>This will remove the old 4.0 repo from your system and replace it with the 5.0 repo. Now you can just upgrade your Zabbix packages as follows:</p>



<pre class="wp-block-code"><code>yum upgrade zabbix*</code></pre>



<p>If the update installs without errors, restart the Zabbix server and agent as follows:</p>



<pre class="wp-block-code"><code>systemctl restart zabbix-server.service
systemctl restart zabbix-agent.service</code></pre>



<p>Copy the Apache config file back to its original location and restart Apache:</p>



<pre class="wp-block-code"><code>cp /opt/zabbix-backup/zabbix.conf /etc/httpd/conf.d/
systemctl restart httpd</code></pre>



<p>You should now be able to log in to the Zabbix web console. You&#8217;ll see that the UI now has the navigation menus on the left hand side and the version number at the bottom has changed to 5.0.1. If the page doesn&#8217;t load correctly, clear your browser cache and cookies and try again.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1920" height="785" src="https://davidshomelab.com/wp-content/uploads/2020/05/image.png" alt="Screenshot of Zabbix 5.0.1 dashboard" class="wp-image-536"/></figure>
<p>The post <a rel="nofollow" href="https://davidshomelab.com/upgrade-zabbix-server-to-5-0-lts/">Upgrade Zabbix Server to 5.0 LTS</a> appeared first on <a rel="nofollow" href="https://davidshomelab.com/">David&#039;s Homelab</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Monitor Your Scripts With Zabbix Trappers</title>
		<link>https://davidshomelab.com/monitor-your-scripts-with-zabbix-trappers/</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Sat, 18 Apr 2020 15:55:20 +0000</pubDate>
				<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[zabbix]]></category>
		<category><![CDATA[zabbix sender]]></category>
		<guid isPermaLink="false">https://davidshomelab.com/?p=503</guid>

					<description><![CDATA[<p>While Zabbix can monitor a lot about the system state through agent and SNMP checks, there are situations where you may want to directly send a notification to Zabbix to inform it of a particular system state or notify it that an action has been performed. One example might be if you want to monitor ... <a title="Monitor Your Scripts With Zabbix Trappers" class="read-more" href="https://davidshomelab.com/monitor-your-scripts-with-zabbix-trappers/" aria-label="More on Monitor Your Scripts With Zabbix Trappers">Read more</a></p>
<p>The post <a rel="nofollow" href="https://davidshomelab.com/monitor-your-scripts-with-zabbix-trappers/">Monitor Your Scripts With Zabbix Trappers</a> appeared first on <a rel="nofollow" href="https://davidshomelab.com/">David&#039;s Homelab</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>While Zabbix can monitor a lot about the system state through agent and SNMP checks, there are situations where you may want to directly send a notification to Zabbix to inform it of a particular system state or notify it that an action has been performed. One example might be if you want to monitor an automated task such as installing updates or cleaning up temporary files. While it would be possible to write the data from your task out to a log file and have Zabbix parse that file, often the simplest way to do this is with a trapper. The Zabbix sender application allows you to send an item-value pair to Zabbix from the command line, allowing you to monitor the item within Zabbix and create triggers in the event of an error.</p>



<p>For this tutorial I will create a script in <code>/etc/cron.daily</code> that will delete anything older than 10 days from the <code>/tmp</code> folder and post the results to Zabbix. I will then configure Zabbix to generate alerts if the script returns an error code or if it does not receive any data for more than 24 hours.</p>



<h2>Install the zabbix-sender application</h2>



<p>On the host you want to monitor, you will need to install zabbix-sender. On Windows, the sender is part of the agent installation so if you already have the agent, you also have the sender. On Linux you will need to install the sender separately from the same repo you installed the agent from as follows:</p>



<p>On CentOS:</p>



<pre class="wp-block-code"><code>yum install zabbix-sender</code></pre>



<p>On Ubuntu:</p>



<pre class="wp-block-code"><code>apt install zabbix-sender</code></pre>



<p>If you have not already configured the Zabbix agent and repo on your system refer to my post on <a href="https://davidshomelab.com/install-zabbix-agent-to-monitor-windows-and-linux-hosts/" target="_blank" rel="noreferrer noopener">installing the Zabbix agent on Windows and Linux systems</a> for instructions on how to do this.</p>



<h2>Writing your script</h2>



<p>Create your script to perform whatever task you wish to accomplish. If you just want Zabbix to be notified when the script has run, you don&#8217;t really need to do any additional planning here. However, if you want to send a different value to Zabbix depending on the outcome of the script you will need to implement mechanisms to gather information about whether the script has succeeded. For example, if your script contains 10 actions and any one of them failing would constitute a failure of the whole script you will need to track the status codes of each of them or use conditional branching to cause the script to stop in the event of any error.</p>



<p>In the example below, I am running a find command to find and delete files older than 10 days. I will then save the exit code of that command to a variable so it can be sent to Zabbix. The script should be saved in <code>/etc/cron.daily</code> and marked as executable to run it automatically every day.</p>



<pre class="wp-block-code"><code>#! /bin/bash
find /tmp -type f -atime +10 -delete
statuscode=$?
zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -s "$(hostname)" -k temp.cleanup -o $statuscode</code></pre>



<p>The first two lines of the script should be fairly self explanatory, we simply find files in <code>/tmp</code> and delete them if they have not been accessed in over 10 days. We then save the exit code of that command into the <code>statuscode</code> variable to then be passed to Zabbix. The final line is where we actually send the data to Zabbix. The flags and options used are as follows:</p>



<figure class="wp-block-table is-style-stripes"><table><thead><tr><th>Flag</th><th>Description</th></tr></thead><tbody><tr><td>-c</td><td>The Zabbix configuration file we will use. This will usually be the same configuration file as we use for Zabbix agent but if you want to send the trapper to a different Zabbix server or use different options for connecting to the server you can use a different configuration file.</td></tr><tr><td>-s</td><td>The hostname that the data will be recorded against. This must match a hostname that exists within Zabbix. Normally it will be the hostname of the server the script is running on but you could have one host post data about another host. For example, if you had a script running on a web server that failed to access a database server you might want the web server to send an alert but the alert be recorded against the database server.</td></tr><tr><td>-k</td><td>The item key that the data will be recorded against. In this case we will make an item called temp.cleanup in Zabbix and the script will record its data there.</td></tr><tr><td>-o</td><td>The actual data to send. This can be any string but in this case we use the value of the <code>statuscode</code> variable.</td></tr></tbody></table></figure>



<p>Once you have saved the file, don&#8217;t forget to run <code>chmod u+x</code> against it to mark it as executable otherwise it won&#8217;t run.</p>



<h2>Create the trapper item</h2>



<p>As this is a script which could be adapted for several hosts, instead of just creating a trapper item on the host we want to monitor, we create the item in a template which can then be applied to several hosts. This saves duplicating the effort of creating the item and triggers for every host we want to monitor. In the Zabbix console go to Configuration &gt; Templates &gt; Create template.</p>



<p>Give your new template a name, add it to a group and optionally give it a description. As we may want to collect data on other maintenance scripts I have named the template &#8220;System Maintenance&#8221; so we can create other items in the template and have them automatically apply to the same hosts without needing to create new templates. Examples of such tasks may be system updates or backups.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="641" height="310" src="https://davidshomelab.com/wp-content/uploads/2020/04/image-27.png" alt="Add Template screen:
Template name: System Maintenance
Groups: Templates" class="wp-image-506"/></figure>



<p>Once you have created your template, open it and select the items tab. Click Create item and fill in the details as follows.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="753" height="759" src="https://davidshomelab.com/wp-content/uploads/2020/04/image-28.png" alt="Item creation page. We make  a trapper item called temp.cleanup storing numeric data" class="wp-image-507"/></figure>



<p>It is essential that the type is set to Zabbix trapper and the Key matches whatever key you are sending in your script. The other options can be adjusted as necessary based on your requirements. Also take note of the type of data as this should match whatever data you plan to send. In this case we are sending an integer number so we select Numeric.</p>



<h2>Apply the template to a host</h2>



<p>In the Hosts tab, select the host you want to monitor and open its templates tab and add the template you have just created to the linked templates.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="675" height="107" src="https://davidshomelab.com/wp-content/uploads/2020/04/image-29.png" alt="Linking template to host scree" class="wp-image-508"/></figure>



<p>You should now be able to go to Monitoring &gt; Latest data and filter by the host you want to monitor and the item name. You will see that there currently is no Last value for the item as the script has not yet been run.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1256" height="301" src="https://davidshomelab.com/wp-content/uploads/2020/04/image-31.png" alt="View of the latest data screen showing that the item has been applied to the host but currently has no data" class="wp-image-510"/></figure>



<p>If we now run the script we should see this field update to show the status code of the command. Hopefully this will be &#8220;0&#8221; but if the script failed for some reason it may be a different number.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1693" height="292" src="https://davidshomelab.com/wp-content/uploads/2020/04/image-32.png" alt="View of latest data screen showing that the item now has data" class="wp-image-511"/></figure>



<p>After refreshing the page, we see that the key now has a last check date and a value. As the value is 0 we know the command completed successfully. We can also tell when the information was last received. We can use this to create alerts in the event that the command returns an error code or if it does not appear to get run at all, i.e. no check has been performed in a given time period.</p>



<h2>Create the alert triggers</h2>



<p>Go back to Configuration &gt; Templates and select the template you created. In the triggers tab click Create trigger. We will create two triggers to identify both anticipated failure conditions, one will check if the most recent value is not 0, the other will check if a value has been received in the last 24 hours. </p>



<p>Set the trigger options as follows:</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="737" height="340" src="https://davidshomelab.com/wp-content/uploads/2020/04/image-33.png" alt="Trigger creation screen for monitoring task status code" class="wp-image-512"/></figure>



<p>The <code>{HOST.NAME}</code>macro in the trigger name is used to tell us which host experienced the failure and will be replaced by the actual hostname in the problems list if the trigger is activated. This is not required and you can set the name to anything you like. Set the severity level to an appropriate value based on the type of issue. As failure to clean up temp files is not likely to bring the system down but is something that may warrant investigation I will set it to Warning in this case.</p>



<p>The expression field determines what Zabbix will use to determine if the trigger should be activated. Whenever the given expression evaluates to true it will activate the trigger and when it evaluates to false it will deactivate the trigger. What we are saying here is that when the last value of the temp.cleanup key in the System Maintenance template is not equal to 0 we should set an alert. To add this expression you can either enter it manually or click the Add button and fill in the resulting form as follows:</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="873" height="266" src="https://davidshomelab.com/wp-content/uploads/2020/04/image-34.png" alt="Expression construction wizard for creating expression without having to manually type query" class="wp-image-513"/></figure>



<p>For new users, creating your expressions in this way is likely to be easier than learning the whole expression language in one go.</p>



<p>Click the Add button to save the trigger and then add another trigger to monitor when no data has been received for a period of time.</p>



<p>As before, we give the trigger a name, severity and expression to watch as follows:</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="727" height="336" src="https://davidshomelab.com/wp-content/uploads/2020/04/image-36.png" alt="Trigger creation screen to monitor if data has not been received for 24 hours" class="wp-image-515"/></figure>



<p>Here our expression will evaluate to true if no data has been received for the item in the last 24 hours and create a warning until data is received again. As the script is set to run every 24 hours and might take different amounts of time to run, you might find that this alert triggers for a couple of minutes every day while the script is running. If you run into this you can work around it by setting the nodata period slightly higher, for example 25 hours, to give the script enough time to run.</p>



<p>Click the Add button to add the trigger. You should now have two triggers set to monitor possible ways that the script may fail.</p>



<h2>Testing</h2>



<p>It is always worth testing your triggers to make sure they work as expected. Otherwise you might think you are monitoring something but you are actually not getting alerts when there are problems. To test that our first trigger is working correctly we can just manually run zabbix_sender and send it a non-0 value as follows:</p>



<pre class="wp-block-code"><code>zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -s "$(hostname)" -k temp.cleanup -o 1</code></pre>



<p>This should cause an alert to be triggered and if we look in the problems tab on Zabbix we see that an alert has been generated.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1104" height="92" src="https://davidshomelab.com/wp-content/uploads/2020/04/image-37.png" alt="Problems screen showing that sending a test value of 1 to the key has triggered a warning" class="wp-image-516"/></figure>



<p>We can clear this alert by running the zabbix_sender command again and passing a value of 0:</p>



<pre class="wp-block-code"><code>zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -s "$(hostname)" -k temp.cleanup -o 0</code></pre>



<p>We should now see the problem enter the &#8220;Resolved&#8221; state.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1104" height="92" src="https://davidshomelab.com/wp-content/uploads/2020/04/image-38.png" alt="Problems screen showing that sending a test value of 0 to the key has resolved the warning" class="wp-image-517"/></figure>



<p>Testing the no data received trigger can be done in two ways. Either disable the cron job, wait 24 hours and see if it generates an alert or set the time limit in the trigger expression to a shorter time such as 1 minute and then change it back once you see that the alert has been generated.</p>



<h2>Integration into other languages</h2>



<p>I have described how to use zabbix_sender in Bash and the same concept applies to other command shells such as CMD or PowerShell on Windows. If you are scripting in a different language, check the <a rel="noreferrer noopener" href="https://www.zabbix.com/integrations?cat=api" target="_blank">Zabbix website</a> to see if they offer a module for the language you are using. If not, most languages have modules to allow you to run system shell commands from within your scripts. If this is the case, make sure you have zabbix_sender installed on the system and integrate the shell commands described above. In either case, the process for creating the template items and triggers within Zabbix will be the same regardless of the method you use to pass the data.</p>
<p>The post <a rel="nofollow" href="https://davidshomelab.com/monitor-your-scripts-with-zabbix-trappers/">Monitor Your Scripts With Zabbix Trappers</a> appeared first on <a rel="nofollow" href="https://davidshomelab.com/">David&#039;s Homelab</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Install Zabbix Agent to Monitor Windows and Linux Hosts</title>
		<link>https://davidshomelab.com/install-zabbix-agent-to-monitor-windows-and-linux-hosts/</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Sun, 05 Apr 2020 15:36:42 +0000</pubDate>
				<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[Linux monitoring]]></category>
		<category><![CDATA[Network monitoring]]></category>
		<category><![CDATA[Windows monitoring]]></category>
		<category><![CDATA[zabbix agent]]></category>
		<guid isPermaLink="false">https://davidshomelab.com/?p=395</guid>

					<description><![CDATA[<p>At the end of my previous article we had a functioning Zabbix server set up to monitor itself. To monitor other hosts, we will need to tell Zabbix about other devices on your network. The two main ways Zabbix can monitor a host are via an agent installed on the host or via SNMP. Generally ... <a title="Install Zabbix Agent to Monitor Windows and Linux Hosts" class="read-more" href="https://davidshomelab.com/install-zabbix-agent-to-monitor-windows-and-linux-hosts/" aria-label="More on Install Zabbix Agent to Monitor Windows and Linux Hosts">Read more</a></p>
<p>The post <a rel="nofollow" href="https://davidshomelab.com/install-zabbix-agent-to-monitor-windows-and-linux-hosts/">Install Zabbix Agent to Monitor Windows and Linux Hosts</a> appeared first on <a rel="nofollow" href="https://davidshomelab.com/">David&#039;s Homelab</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>At the end of my <a href="https://davidshomelab.com/zabbix-server-setup/" target="_blank" rel="noreferrer noopener">previous article</a> we had a functioning Zabbix server set up to monitor itself. To monitor other hosts, we will need to tell Zabbix about other devices on your network. The two main ways Zabbix can monitor a host are via an agent installed on the host or via SNMP. Generally you will monitor servers and workstations using Zabbix agent. Network devices such as switches, firewalls or even printers use SNMP. In this article I will describe the process of installing and configuring the Zabbix agent on 4 common operating systems.  I will also cover the process of configuring the Zabbix server to talk to these agents.</p>



<h2>Installing Zabbix Agent</h2>



<h3>Ubuntu 18.04</h3>



<p>As with the server installation, we need to install a package repo for the version of Zabbix we wish to install. As this is a fresh installation we will install the repo for Zabbix 4.0 to be as up to date as possible but older agent versions (as far back as 1.4) will work with the 4.0 version of the server. The agent cannot be newer than the server. For instance, you can&#8217;t install Zabbix agent 4.4 if you are using Zabbix Server 4.0.</p>



<p>To install the repo, we will need to know the repo name for the version of Ubuntu we are using. In this example I am using 18.04 (Bionic Beaver) so the repo name will be &#8220;bionic&#8221;, if you are installing on a different version, you will need to adjust that accordingly in the following commands:</p>



<pre class="wp-block-code"><code>wget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-2+bionic_all.deb
dpkg -i zabbix-release_4.0-2+bionic_all.deb
apt update</code></pre>



<p>Once the repo is installed, we can install the <code>zabbix-agent</code> package via apt:</p>



<pre class="wp-block-code"><code>apt install zabbix-agent</code></pre>



<p>We now need to edit the configuration file to tell the agent where to find the server. Open <code>/etc/zabbix/zabbix_agentd.conf</code> in your preferred text editor and make the following changes to tell the agent which Zabbix servers are allowed to talk to it:</p>



<pre class="wp-block-code"><code>Server=&#91;IP or hostname of your Zabbix server]
ServerActive=&#91;IP or hostname of your Zabbix server]</code></pre>



<p>We also need to tell Zabbix the hostname of the system. This doesn&#8217;t have to be the actual hostname, it is the display name we will use within Zabbix for the system. Comment out the default value of <code>Hostname=Zabbix server</code> and replace it with the following:</p>



<pre class="wp-block-code"><code>HostnameItem=system.hostname</code></pre>



<p>This will tell the agent to automatically populate the hostname value with the system hostname. You could just set the hostname within the configuration file. However, automatically populating it allows you to reuse the same configuration file across all your hosts, simplifying automation if you have a lot of hosts to monitor.</p>



<p>If you have a firewall configured on your server, allow connections from the Zabbix server on port 10050/tcp:</p>



<pre class="wp-block-code"><code>ufw allow from &#91;Zabbix server IP] to any port 10050 proto tcp</code></pre>



<p>Start the Zabbix agent:</p>



<pre class="wp-block-code"><code>systemctl enable zabbix-agent
systemctl restart zabbix-agent</code></pre>



<h3>CentOS 8</h3>



<p>As with the Ubuntu installation, enable the Zabbix repo and install the agent:</p>



<pre class="wp-block-code"><code>rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/8/x86_64/zabbix-release-4.0-2.el8.noarch.rpm
dnf install zabbix-agent</code></pre>



<p>Once the application is installed, edit <code>/etc/zabbix/zabbix_agentd.conf</code> to change the following lines:</p>



<pre class="wp-block-code"><code>Server=&#91;IP or hostname of your Zabbix server]
ServerActive=&#91;IP or hostname of your Zabbix server]
#Hostname=Zabbix server
HostnameItem=system.hostname</code></pre>



<p>If you have already created a config file based on the Ubuntu guide you can copy that file over the default one rather than having to make the changes again.</p>



<p>Allow Zabbix through the firewall:</p>



<pre class="wp-block-code"><code>firewall-cmd --add-rich-rule='rule family="ipv4" source address="172.16.24.8" port protocol="tcp" port="10050" accept' --permanent
firewall-cmd --reload</code></pre>



<p>Restart and enable the Zabbix service:</p>



<pre class="wp-block-code"><code>systemctl enable zabbix-agent
systemctl restart zabbix-agent</code></pre>



<h3>Windows</h3>



<p>Download and install the agent MSI file from <a href="https://www.zabbix.com/downloads/4.0.17/zabbix_agent-4.0.17-windows-amd64-openssl.msi">https://www.zabbix.com/downloads/4.0.17/zabbix_agent-4.0.17-windows-amd64-openssl.msi</a>. During the installer you will be prompted to configure the connection to the server. Enter the details for the hostname and server IP address as follows:</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="457" height="383" src="https://davidshomelab.com/wp-content/uploads/2020/04/image-7.png" alt="Zabbix agent setup screen on Windows" class="wp-image-417"/></figure></div>



<p>If you want to generate a config file that can be used between systems so you can automate installation, finish the installation and find the config file at <code>C:\Program Files\Zabbix Agent\zabbix_agentd.conf</code> and replace the Hostname field for a HostnameItem field as we did with the Linux servers. Then you could deploy the installer and configuration file automatically via group policy. While much of the configuration is the same between Linux and Windows, there are certain differences such as file paths so you can&#8217;t copy the configuration files between Linux and Windows.</p>



<h3>pfSense</h3>



<p>From the pfSense dashboard, go to System &gt; Package Manager &gt; Available Packages and search for &#8220;zabbix-agent4&#8221;. Install the zabbix-agent4 package.</p>



<p>Go to Services &gt; Zabbix Agent 4.0, enable the service and configure the values for Server, ServerActive and Hostname.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1151" height="289" src="https://davidshomelab.com/wp-content/uploads/2020/04/image-8.png" alt="Zabbix agent setup screen on pfSense" class="wp-image-418"/></figure>



<p>The rest of the settings can usually be left as default so scroll to the bottom and click &#8220;Save&#8221;.</p>



<h2>Connect Zabbix agent to Zabbix server</h2>



<p>Now the agent is installed, it must be added to Zabbix. Log in to the Zabbix frontend and go to Configuration &gt; Hosts &gt; Create Host.</p>



<p>Enter the hostname for the device you are adding. This must match the hostname you configured in the agent. If you used the suggested configuration above, this will match the system hostname in most cases but if you set a different hostname set it here as well. Additionally tell Zabbix where to find the agent, this can be either an IP address or a hostname. All hosts must be members of at least one group. Zabbix comes with some pre-configured groups but if you want to create extras you can just type the group name you want into the Groups search field and it will give you the option to add it.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1072" height="705" src="https://davidshomelab.com/wp-content/uploads/2020/04/image-9.png" alt="Host configuration page" class="wp-image-419"/></figure>



<p>Now go to the Templates tab to assign monitoring templates to the host. These templates are lists of checks for the Zabbix server to run and alerts for it to generate. Hosts can have any number of templates applied (although not if 2 templates perform the same check) and you can also assign items to individual hosts without using templates but this should be avoided due to the additional administrative overhead. For our Ubuntu and CentOS servers we will apply the template &#8220;Template OS Linux&#8221; to provide standard checks for system resources such as CPU and RAM usage, disk space, process counts etc. The equivalent templates for Windows and pfSense are &#8220;Template OS Windows&#8221; and &#8220;Template OS FreeBSD&#8221;</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="866" height="236" src="https://davidshomelab.com/wp-content/uploads/2020/04/image-11.png" alt="Host template page" class="wp-image-421"/></figure>



<p>When you select a template from the search bar, you need to click the small Add button to add it to the Linked templates list. The Add button at the bottom of the page will add whatever is in the Linked templates field, not anything in the search bar.</p>



<div class="wp-block-group"><div class="wp-block-group__inner-container">
<div class="wp-block-group"><div class="wp-block-group__inner-container">
<div class="wp-block-media-text alignfull is-stacked-on-mobile" style="grid-template-columns:20% auto"><figure class="wp-block-media-text__media"><img loading="lazy" width="144" height="59" src="https://davidshomelab.com/wp-content/uploads/2020/04/image-13.png" alt="Host connected to Zabbix using agent, identified by green &quot;ZBX&quot; field" class="wp-image-423 size-full"/></figure><div class="wp-block-media-text__content">
<p>Once you have added the templates you want, click the Add button to create the host. It can take a few minutes for the agent and the server to begin talking to each other but when they do, you should see Zabbix Agent availability marked in green against the host you have added.</p>
</div></div>
</div></div>
</div></div>



<p>Add your other hosts and check that they all show up as available in the host list.</p>



<p>You can now check what data you are collecting by going to Monitoring &gt; Overview and selecting &#8220;Data&#8221; from the &#8220;Type&#8221; drop down box.  You should see a large number of monitored items and the latest value for each of them. Note that not all items are applicable to all hosts. If you have hosts running with different configurations you will probably see gaps in this screen.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1910" height="778" src="https://davidshomelab.com/wp-content/uploads/2020/04/image-14.png" alt="Host overview screen" class="wp-image-424"/></figure>



<p>As we are just using the default templates you will probably find that you get a lot of alerts which you might not care about or triggers that are set at the wrong level. Take care to review the alerts you get and decide whether they are relevant to your monitoring needs. Seeing the same alert too often can lead to ignoring it, meaning you might miss an actual issue because you&#8217;re so used to seeing the alert.</p>
<p>The post <a rel="nofollow" href="https://davidshomelab.com/install-zabbix-agent-to-monitor-windows-and-linux-hosts/">Install Zabbix Agent to Monitor Windows and Linux Hosts</a> appeared first on <a rel="nofollow" href="https://davidshomelab.com/">David&#039;s Homelab</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Monitor Your Network  With Zabbix: Server Setup Guide</title>
		<link>https://davidshomelab.com/zabbix-server-setup/</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Thu, 02 Apr 2020 23:29:22 +0000</pubDate>
				<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[zabbix]]></category>
		<guid isPermaLink="false">https://davidshomelab.com/?p=375</guid>

					<description><![CDATA[<p>As your IT environments become larger and more complex, monitoring and alerting becomes a critical component of ensuring that your systems remain online and healthy. By collecting data about the state of your system you can be notified if a host goes down or get advance warning of an impending issue such as a disk ... <a title="Monitor Your Network  With Zabbix: Server Setup Guide" class="read-more" href="https://davidshomelab.com/zabbix-server-setup/" aria-label="More on Monitor Your Network  With Zabbix: Server Setup Guide">Read more</a></p>
<p>The post <a rel="nofollow" href="https://davidshomelab.com/zabbix-server-setup/">Monitor Your Network  With Zabbix: Server Setup Guide</a> appeared first on <a rel="nofollow" href="https://davidshomelab.com/">David&#039;s Homelab</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>As your IT environments become larger and more complex, monitoring and alerting becomes a critical component of ensuring that your systems remain online and healthy. By collecting data about the state of your system you can be notified if a host goes down or get advance warning of an impending issue such as a disk running out of space. Storing this data allows you to analyse it later to troubleshoot more complex or transient issues by correlating data from multiple sources to gather a clearer picture of how components of your environment are interacting.</p>



<p>One such monitoring and alerting tool is Zabbix Server which is able to collect data from a vast range of device types using either an installed agent or, in the case of networking equipment, SNMP. Compared to other open source monitoring solutions such as Nagios, Zabbix is generally simple to set up, comes with a good selection of pre-configured data collection and alerting templates and doesn&#8217;t require enterprise licensing to access the more advanced features.</p>



<p>At the time of writing the latest version of Zabbix is 4.4 and the current long term support (LTS) version is 4.0. In general, the x.0 releases are LTS and supported for 5 years while the interim versions only have a 6 month support lifecycle to allow for faster development. For this guide I will be installing Zabbix 4.0 on CentOS 8.</p>



<h2>Prepare your system</h2>



<p>As per Zabbix&#8217;s recommendation, for a small to medium deployment monitoring up to about 500 hosts, we will provision a VM or physical server with at least 2GB of RAM and 2 CPU cores. We will also want to make sure we have enough disk space to store all the data we collect. As the amount needed will depend on how long you want to store historical data and the number of events your hosts generate it is hard to predict exactly how much is likely to be needed but 50GB should suffice in most cases and, as Zabbix monitors disk space, it will alert you if it is close to running out.</p>



<p>From the base install, install of CentOS, install any available updates and set a static IP address by running the following commands:</p>



<pre class="wp-block-code"><code>dnf -y update
nmcli con mod &#91;network interface name] ipv4.address &#91;your chosen IP address]
nmcli con mod &#91;network interface name] ipv4.gateway &#91;gateway IP address]
nmcli con mod &#91;network interface name] ipv4.dns &#91;your DNS server IP address]
nmcli con mod &#91;network interface name] ipv4.method manual
nmcli con up &#91;network interface name]</code></pre>



<p>Finally, as Zabbix is a networked service you will need to allow incoming connections in the firewall:</p>



<pre class="wp-block-code"><code>firewall-cmd --add-port=80/tcp --add-port=10051/tcp --permanent
firewall-cmd --reload</code></pre>



<h2>Install the Zabbix packages</h2>



<p>Usually the versions of Zabbix in distribution software repos are somewhat out of date so the Zabbix project hosts its own repos for each supported distribution. Each major version is hosted in its own repo, meaning you can continue to get updates and bug fixes for as long as the release is supported without getting rolled over to the next version. When the time comes to do an upgrade to the next major version you would disable the repo you have been using, enable the one for the version you want to move to and then do a package update to move to the new version. You can find the details of the repo you need to add from the <a rel="noreferrer noopener" href="https://www.zabbix.com/download" target="_blank">Zabbix downloads page</a>. As we are using Zabbix 4.0 on CentOS 8 we add the repo as follows:</p>



<pre class="wp-block-code"><code>rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/8/x86_64/zabbix-release-4.0-2.el8.noarch.rpm
dnf clean all</code></pre>



<p>We can now install the required Zabbix packages:</p>



<pre class="wp-block-code"><code>dnf install zabbix-server-mysql zabbix-web-mysql zabbix-agent mariadb-server</code></pre>



<h2>Configure the database</h2>



<p>Before we enable MariaDB for the first time we need to work around an issue where some of the Zabbix table lengths exceed the maximum allowed size in the default MariaDB configuration. Edit the <code>[mysqld]</code> section of the file <code>/etc/my.cfg.d/mariadb-server.cfg</code> to contain the following lines:</p>



<pre class="wp-block-code"><code>innodb-strict-mode=1
innodb_page_size=65536
innodb_log_buffer_size=33554432
innodb_buffer_pool_size=536870912
innodb_default_row_format=dynamic</code></pre>



<p>Please note that this is not possible to do this after the server has been initialised (i.e. after the first time you start the service). If you have started the server but don&#8217;t yet have any databases on it you can reset it back to an uninitialised state by running:</p>



<pre class="wp-block-code"><code>systemctl stop mariadb.service
rm -rf /var/lib/mysql/*</code></pre>



<p>Please note that the above command will wipe any data stored in the database server so don&#8217;t do it if you are using the server to host any other databases. If that is the case you can disable the innodb strict checking before importing the initial database schema and then enable it again afterwards. The SQL commands to do this are:</p>



<pre class="wp-block-code"><code>set global innodb_strict_mode='OFF';
set global innodb_strict_mode='ON';</code></pre>



<p>Perform the standard MariaDB setup to start and enable the database, set a password for the root user, block anonymous access, disable remote root login and remove test databases as follows:</p>



<pre class="wp-block-code"><code>systemctl enable mariadb.service
systemctl start mariadb.service
mysql_secure_installation</code></pre>



<p>Open the MariaDB client as the root user:</p>



<pre class="wp-block-code"><code>mysql -uroot -p</code></pre>



<p>Run the following commands to create the Zabbix database and grant the Zabbix user permission to manage it:</p>



<pre class="wp-block-code"><code>create database zabbix  character set utf8 collate utf8_bin;
grant all on zabbix.* to 'zabbix'@'localhost' identified by '&#91;some secret password]';
flush privileges;
quit;</code></pre>



<p>Import the database template into the Zabbix database. You&#8217;ll do this as the Zabbix user so you will be prompted to enter the password you just set. If you chose a different name for your user and your database adjust the below command accordingly, in our case both are &#8216;zabbix&#8217;:</p>



<pre class="wp-block-code"><code>zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix </code></pre>



<p>The command will take a little while to import all of the tables but once it is complete we can verify that the import has been successful by running the following commands:</p>



<pre class="wp-block-code"><code>mysql -uroot -p zabbix
show tables;
quit;</code></pre>



<p>You should see a long list of tables in the output. If it is blank or says there are no tables, you may have made an error so go back and check.</p>



<p>Finally, we need to tell Zabbix the credentials to use for the database, edit the file <code>/etc/zabbix/zabbix_server.conf</code> and enter the database information in the following lines:</p>



<pre class="wp-block-code"><code>DBName=zabbix
DBUser=zabbix
DBPassword=&#91;your chosen password]</code></pre>



<h2>Set the correct time zone</h2>



<p>We now need to set the time zone Zabbix will use to store event information. You can use the same time zone as your system clock but this is not required. For example, if you are monitoring systems in multiple time zones you may want to use UTC to ensure consistency between systems. You can view the list of available time zones by running:</p>



<pre class="wp-block-code"><code>timedatectl list-timezones</code></pre>



<p>Once you know which time zone you will use, edit <code>/etc/php-fpm.d/zabbix.conf</code> to uncomment the line <code>php_value[date.timezone]</code> and set the value to your chosen time zone.</p>



<h2>Configuring SELinux</h2>



<p>If you are running SELinux on your server (you should be), you will need to make a couple of changes to get it to play nicely with Zabbix. Run:</p>



<pre class="wp-block-code"><code>setsebool -P httpd_can_connect_zabbix on
setsebool -P daemons_enable_cluster_mode on</code></pre>



<p>This allows the Zabbix web frontend to talk to the Zabbix backend. Additionally, you may need to compile a custom module to get the Zabbix server to start. To test if this will be needed run:</p>



<pre class="wp-block-code"><code>systemctl start zabbix-server.service</code></pre>



<p>If you get an error, install the <code>policycoreutils-python-utils</code> package and compile a custom policy as follows:</p>



<pre class="wp-block-code"><code>dnf -y install policycoreutils-python-utils
grep "comm.*zabbix_server.*zabbix_t" /var/log/audit/audit.log | audit2allow -M comm_zabbix_server_zabbix_t
semodule -i comm_zabbix_server_zabbix_t.pp
rm comm_zabbix_server_zabbix_t*</code></pre>



<p>If you attempt to start Zabbix server again it should start without any issues.</p>



<h2>Start and enable the Zabbix server</h2>



<p>We are now ready to start up the Zabbix server, agent and frontend:</p>



<pre class="wp-block-code"><code>systemctl restart zabbix-server zabbix-agent httpd php-fpm
systemctl enable zabbix-server zabbix-agent httpd php-fpm</code></pre>



<h2>Configure the web interface</h2>



<p>Now open a web browser and navigate to your chosen IP address/zabbix. For example, if your server were on 172.16.24.8 you would go to http://172.16.24.8/zabbix. You will see an installer screen which will allow you to complete the last few installation steps to set up the web interface. Click &#8220;Next step&#8221; on the welcome screen to begin.</p>



<p>Zabbix will then check the prerequisites. If you have followed this guide you shouldn&#8217;t run into any issues here but if you do, you most likely need to install additional PHP packages or edit values in <code>/etc/php-fpm.d/zabbix.conf</code> to match the required value. If all is well click &#8220;Next step&#8221;.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="857" height="515" src="https://davidshomelab.com/wp-content/uploads/2020/04/image.png" alt="" class="wp-image-399"/></figure>



<p>Next we have to tell the web interface how to connect to the database. Enter the same values as you set in <code>/etc/zabbix/zabbix_server.conf</code>:</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="857" height="515" src="https://davidshomelab.com/wp-content/uploads/2020/04/image-1.png" alt="" class="wp-image-400"/></figure>



<p>You will next be prompted to tell the Zabbix frontend where it can find the Zabbix server. As we are installing the server and the frontend on the same host, we accept the default value of localhost. You can also optionally give the installation a name of your choosing to identify it:</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="857" height="515" src="https://davidshomelab.com/wp-content/uploads/2020/04/image-3.png" alt="" class="wp-image-403"/></figure>



<p>On the last page before the installation, you are given a summary of the settings you have chosen, give them a quick look over to check they all look ok and then go to the next step to begin the installation.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="857" height="515" src="https://davidshomelab.com/wp-content/uploads/2020/04/image-4.png" alt="" class="wp-image-404"/></figure>



<p>Once the installation is complete, click &#8220;Finish&#8221; to go to the login screen. Sign in with the default login (Username: Admin | Password: zabbix). Note that the username is case sensitive.</p>



<h2>Finishing touches</h2>



<p>Once you&#8217;ve logged in you will see the default dashboard and see that Zabbix has started monitoring itself. In my case we even have an alert that there isn&#8217;t enough free swap space. This is unsurprising as I didn&#8217;t configure a swap partition on this server but it is useful to confirm that the monitoring and alerting is working as it should be.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1920" height="620" src="https://davidshomelab.com/wp-content/uploads/2020/04/image-5.png" alt="" class="wp-image-405"/></figure>



<p>The first thing you should do is click the user icon in the top right corner of the screen next to the logout button and change the password. You can also rename the admin user for additional security.</p>



<p>Of course there is little point in having a monitoring server that only monitors itself so you will eventually want to add additional hosts to monitor. For the time being though, play around with the menus and see what data you are able to collect and the kind of alerts that are getting triggered before you start adding more hosts. A key component of monitoring is figuring out what information you&#8217;re interested in and tuning your monitoring system to match your needs. While it may seem tempting to gather lots of data and start monitoring hundreds of hosts at once, it is very easy to miss key information when you are overloaded with too many alerts so start slow while you&#8217;re testing and learning the system and gradually add hosts to it as you begin to refine your alerts.</p>



<p>Come back soon for future posts on monitoring Windows and Linux hosts, configuring triggers and alerting and adding automation to allow your new monitoring system to scale to large numbers of hosts.</p>



<p><a href="https://davidshomelab.com/install-zabbix-agent-to-monitor-windows-and-linux-hosts/">Zabbix Agent setup on Linux, Windows and pfSense</a></p>
<p>The post <a rel="nofollow" href="https://davidshomelab.com/zabbix-server-setup/">Monitor Your Network  With Zabbix: Server Setup Guide</a> appeared first on <a rel="nofollow" href="https://davidshomelab.com/">David&#039;s Homelab</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
