<?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>Axertion.com &#187; Server Administration</title>
	<atom:link href="http://www.axertion.com/categories/tutorials/server-administration/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.axertion.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 24 Mar 2016 21:49:25 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.8.1</generator>
	<item>
		<title>Monitor your website&#8217;s uptime using a bash script and a cronjob</title>
		<link>http://www.axertion.com/tutorials/2013/07/monitor-your-websites-uptime-using-a-bash-script-and-a-cronjob/</link>
		<comments>http://www.axertion.com/tutorials/2013/07/monitor-your-websites-uptime-using-a-bash-script-and-a-cronjob/#comments</comments>
		<pubDate>Tue, 30 Jul 2013 15:13:31 +0000</pubDate>
		<dc:creator><![CDATA[Axel]]></dc:creator>
				<category><![CDATA[Server Administration]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.axertion.com/?p=566</guid>
		<description><![CDATA[Maintaining a handful of websites can be stressful. Even more so, not knowing when one of those sites [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Maintaining a handful of websites can be stressful. Even more so, not knowing when one of those sites goes down.</p>
<p>There are services such as <a href="http://www.SiteUptime.com/?aff=156420" target="_blank">SiteUptime</a> that will do this for you out of the box, however there are efficient, free ways of doing this yourself.</p>
<p><strong>Prerequisites:</strong><br />
1. You have permission to create and run bash (shell) scripts on your server.<br />
2. You have permission to create and schedule cronjobs on your server.<br />
3. You have permission to send emails from your server.</p>
<p>Ok, let&#8217;s get started.</p>
<p>1. Create a file on your server called <strong>monitorsites.sh</strong> (the location doesn&#8217;t matter, however I recommend keeping it outside of publicly accessible folders).<br />
2. In monitorsites.sh, paste the following:<br />
<pre><code>
#!/bin/bash

SITESFILE=sites.txt #list the sites you want to monitor in this file
EMAILS=&quot;you@email.com,someoneelse@email.com&quot; #list of email addresses to receive alerts (comma separated)

while read site; do
&nbsp;&nbsp;&nbsp;&nbsp;if [ ! -z &quot;${site}&quot; ]; then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CURL=$(curl -s --head $site)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if echo $CURL | grep &quot;200 OK&quot; &gt; /dev/null
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;The HTTP server on ${site} is up!&quot;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MESSAGE=&quot;This is an alert that your site ${site} has failed to respond 200 OK.&quot;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for EMAIL in $(echo $EMAILS | tr &quot;,&quot; &quot; &quot;); do
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SUBJECT=&quot;$site (http) Failed&quot;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;$MESSAGE&quot; | mail -s &quot;$SUBJECT&quot; $EMAIL
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo $SUBJECT
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;Alert sent to $EMAIL&quot;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;done&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fi
&nbsp;&nbsp;&nbsp;&nbsp;fi
done &lt; $SITESFILE
</code></pre><br />
3. In the monitorsites.sh file, change the <b>EMAILS</b> variable to a comma separate list of email addresses you wish to send the notification to.  For Example: <code>EMAILS=&quot;someone@gmail.com,anotherone@gmail.com&quot;</code></p>
<p>4. Create a file named <strong>sites.txt</strong> in the same folder as monitorsites.sh.  In this file, create a list of complete URLs you wish to monitor.<br />
<pre><code>
http://www.google.com
http://www.axertion.com
http://someotherwebsite.com
</code></pre><br />
<small>Make sure your domain names are absolutely correct.  Double check whether your URLs use WWW or Non-WWW url structures</small></p>
<p>5. Test the script.  Login to your server using SSH, and run the bash file using the following command:<br />
<code>sh monitorsites.sh</code></p>
<p>6. If done correctly, you will see something like this:<br />
<pre><code>
The HTTP server on http://www.google.com is up!
The HTTP server on http://www.axertion.com is up!
http://someotherwebsite.com (http) Failed
Alert sent to you@email.com
Alert sent to someoneelse@email.com
</code></pre></p>
<p>7. To have this script run automatically (say every 5 minutes), you can setup a cronjob.  You can read more on how to do this by reading <a href="http://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/" target="_blank">HowTo: Add Jobs To cron Under Linux or UNIX</a></p>
<p>Once setup, your cronjob will run at the interval you set, and you will receive an email if your site doesn&#8217;t response.</p>
<p>Keep in mind, if your sites are on the same server as this script runs and the cause of downtime is your server going down, you may not receive the alert email.  This should alert you if your apache (httpd) process fails as this script does not rely on that process to run.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.axertion.com/tutorials/2013/07/monitor-your-websites-uptime-using-a-bash-script-and-a-cronjob/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>How to connect and manage your Rackspace Cloud Server locally on your computer</title>
		<link>http://www.axertion.com/tutorials/server-administration/2013/01/how-to-connect-and-manage-your-rackspace-cloud-server-locally-on-your-computer/</link>
		<comments>http://www.axertion.com/tutorials/server-administration/2013/01/how-to-connect-and-manage-your-rackspace-cloud-server-locally-on-your-computer/#comments</comments>
		<pubDate>Thu, 31 Jan 2013 00:40:46 +0000</pubDate>
		<dc:creator><![CDATA[Axel]]></dc:creator>
				<category><![CDATA[Server Administration]]></category>

		<guid isPermaLink="false">http://www.axertion.com/?p=498</guid>
		<description><![CDATA[If you&#8217;re familiar with Rackspace Cloud Databases, you are probably aware that you cannot directly connect to your [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>If you&#8217;re familiar with Rackspace Cloud Databases, you are probably aware that you cannot directly connect to your database remotely (outside of the Rackspace internal network).</p>
<p>You can, however, use an SSH Tunnel to access your database remotely through a rackspace cloud server instance.  Here&#8217;s how.<br />
<span id="more-498"></span></p>
<h2>Prerequisites</h2>
<ul>
<li>You must have a <a href="http://www.rackspace.com/cloudservers" target="_blank">Rackspace Cloud Server Instance</a> with SSH Access</li>
<li>You must have a <a href="http://www.rackspace.com/cloud/public/databases/" target="_blank">Rackspace Cloud Database Instance</a>, with a Database, User &amp; Password assigned to it.</li>
</ul>
<h2>Step 1:  Connect to Cloud Server from PC</h2>
<p>First, we must connect to our Cloud Server using SSH to store the server host key locally. To do this, do the following:</p>
<ol>
<li>Download <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html" target="_blank">plink.exe</a> and save it to your C:\ drive.</li>
<li>Open up Command Prompt, and do the following commands:<br />
<small>Replace <strong>[CLOUD SERVER IP ADDRESS]</strong> with the IP address of your cloud server.</small><br />
<pre><pre>cd C:\
plink.exe -L 3307:[CLOUD SERVER IP ADDRESS]:3306 root@[CLOUD SERVER IP ADDRESS]
</pre></pre></li>
<li>After completing the above commands, you will most  likely see a message saying &#8220;The server&#8217;s host key is not cached&#8230;.&#8221;<br />
Enter <code>y</code> when it asks <strong>Store key in cache?</strong></li>
<li>When prompted for a password, Enter your <strong>Cloud Server root user</strong> password.</li>
<li>You should now be connected to your cloud server using an SSH connection.</li>
</ol>
<h2>Step 2: Connect Using MySQL Management Software</h2>
<p>Now we should be able to connect using a MySQL management tool such as HeidiSQL, which is a completely free solution that offers SSH Tunneling.</p>
<ol>
<li>Download &amp; Install  <a title="HeidiSQL - MySQL made easy" href="http://www.heidisql.com/" target="_blank">HeidiSQL</a></li>
<li>Open HeidiSQL and go to the <strong>Session Manager</strong>.</li>
<li>Create a New Session clicking the <strong>New</strong> button</li>
<li>On the <strong>Settings</strong> tab, enter the following:<br />
<strong>Network Type:</strong> SSH Tunnel<br />
<strong>Hostname/IP:</strong> <code>[HOSTNAME OF CLOUD DATABASE INSTANCE]</code><br />
<strong>User:</strong> <code>[CLOUD DATABASE USERNAME]</code><br />
<strong>Password:</strong> <code>[CLOUD DATABASE PASSWORD]</code><br />
<strong>Port</strong>: <code>3307</code><br />
Uncheck <strong>Compressed client/server protocol<br />
Databases: </strong>[CLOUD DATABASE NAME(S)] &#8211;  comma separated if more than one database.</li>
<li>On the SSH Tunnel tab, enter the following:<br />
<strong>plink.exe location:</strong> Download <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html" target="_blank">plink.exe</a>, and point this to it&#8217;s location<br />
<strong>SSH Host + port:</strong> <code>[CLOUD SERVER HOSTNAME or IP]</code><br />
<strong>Username:</strong> <code>[CLOUD SERVER SSH USERNAME]</code><br />
<strong>Password:</strong> <code>[CLOUD SERVER SSH PASSWORD]</code><br />
<strong>Private Key File:</strong> Not needed, leave blank.<br />
<strong>Local Port:</strong> 3307</li>
<li>Click the <strong>Open</strong> button at the bottom.  You should now be connected to your cloud database.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.axertion.com/tutorials/server-administration/2013/01/how-to-connect-and-manage-your-rackspace-cloud-server-locally-on-your-computer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
