<?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>s3sync | LogikDevelopment</title>
	<atom:link href="https://www.logikdev.com/tag/s3sync/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.logikdev.com</link>
	<description>&#34;Il n&#039;y a pas de problème, il n&#039;y a que des solutions. L&#039;esprit de l&#039;homme invente ensuite le problème.&#34; André Gide</description>
	<lastBuildDate>Tue, 25 Apr 2017 13:57:14 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.4</generator>
	<item>
		<title>S3 command failed if the time is not synced</title>
		<link>https://www.logikdev.com/2011/12/06/s3-command-failed-if-time-not-synced/</link>
					<comments>https://www.logikdev.com/2011/12/06/s3-command-failed-if-time-not-synced/#comments</comments>
		
		<dc:creator><![CDATA[smoreau]]></dc:creator>
		<pubDate>Tue, 06 Dec 2011 23:11:43 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Amazon S3]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[ntpdate]]></category>
		<category><![CDATA[s3sync]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[system date]]></category>
		<guid isPermaLink="false">https://www.logikdev.com/?p=1610</guid>

					<description><![CDATA[<p>This is already the second post about the s3sync ruby program. The first article was focused on monitoring s3sync with Zabbix. I will talk on this one about an error I got when running the S3 synchronisation: S3 command failed: list_bucket prefix /data max-keys 200 delimiter / With result 403 Forbidden S3 ERROR: # s3sync.rb:290:in [&#8230;]</p>
<p>The post <a href="https://www.logikdev.com/2011/12/06/s3-command-failed-if-time-not-synced/">S3 command failed if the time is not synced</a> first appeared on <a href="https://www.logikdev.com">LogikDevelopment</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>This is already the second post about the <a href="https://forums.aws.amazon.com/thread.jspa?threadID=11975&amp;start=0&amp;tstart=0" target="_blank"><strong>s3sync</strong></a> ruby program. The first article was focused on <a title="Monitor s3sync with Zabbix" href="https://www.logikdev.com/2011/11/24/monitor-s3sync-with-zabbix/">monitoring s3sync with Zabbix</a>.</p>
<p>I will talk on this one about an error I got when running the S3 synchronisation:</p>
<pre>
S3 command failed:
list_bucket prefix /data max-keys 200 delimiter /
With result 403 Forbidden
S3 ERROR: #
s3sync.rb:290:in `+': can't convert nil into Array (TypeError)
	from s3sync.rb:290:in `s3TreeRecurse'
	from s3sync.rb:346:in `main'
	from ./thread_generator.rb:79:in `call'
	from ./thread_generator.rb:79:in `initialize'
	from ./thread_generator.rb:76:in `new'
	from ./thread_generator.rb:76:in `initialize'
	from s3sync.rb:267:in `new'
	from s3sync.rb:267:in `main'
	from s3sync.rb:735
</pre>
<p>As you can see, this error is not very human-friendly! <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f62e.png" alt="😮" class="wp-smiley" style="height: 1em; max-height: 1em;" /> The only thing we know is that the S3 command failed because of the error <code>can't convert nil into Array</code>. It looks to me like an internal error within s3sync&#8230;</p>
<p>But after some investigation, it appears it is simply because the system date on the server is not correct. I cannot tell you how much time I spent on this one!  <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f62f.png" alt="😯" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>Anyway, if you are doing automatic backups as describe on <a href="http://blog.eberly.org/2006/10/09/how-automate-your-backup-to-amazon-s3-using-s3sync/" target="_blank">John Eberly&#8217;s blog</a>, you need to add the following code at the top of your <code>upload.sh</code> script:</p>
<pre class="brush: bash; title: ; notranslate">
# update the system date
/usr/sbin/ntpdate 3.uk.pool.ntp.org 2.uk.pool.ntp.org 1.uk.pool.ntp.org 0.uk.pool.ntp.org
</pre>
<p><strong>NB:</strong> please find below the command lines I use to install <a href="http://www.eecis.udel.edu/~mills/ntp/html/ntpdate.html" target="_blank"><strong>ntpdate</strong></a> on a Debian server:</p>
<pre class="brush: bash; light: true; title: ; notranslate">
apt-get install ntpdate
dpkg-reconfigure tzdata
</pre><p>The post <a href="https://www.logikdev.com/2011/12/06/s3-command-failed-if-time-not-synced/">S3 command failed if the time is not synced</a> first appeared on <a href="https://www.logikdev.com">LogikDevelopment</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.logikdev.com/2011/12/06/s3-command-failed-if-time-not-synced/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Monitor s3sync with Zabbix</title>
		<link>https://www.logikdev.com/2011/11/24/monitor-s3sync-with-zabbix/</link>
					<comments>https://www.logikdev.com/2011/11/24/monitor-s3sync-with-zabbix/#respond</comments>
		
		<dc:creator><![CDATA[smoreau]]></dc:creator>
		<pubDate>Thu, 24 Nov 2011 22:28:53 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Amazon S3]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[s3sync]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[synchronisation]]></category>
		<category><![CDATA[Zabbix]]></category>
		<guid isPermaLink="false">https://www.logikdev.com/?p=1566</guid>

					<description><![CDATA[<p>s3sync is a ruby program that easily transfers directories between a local directory and an S3 bucket:prefix. It behaves somewhat, but not precisely, like the rsync program. I am using this tool to automatically backup the important data from Debian servers to Amazon S3. I am not going to explain here how to install s3sync [&#8230;]</p>
<p>The post <a href="https://www.logikdev.com/2011/11/24/monitor-s3sync-with-zabbix/">Monitor s3sync with Zabbix</a> first appeared on <a href="https://www.logikdev.com">LogikDevelopment</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><a href="https://forums.aws.amazon.com/thread.jspa?threadID=11975&#038;start=0&#038;tstart=0" target="_blank"><strong>s3sync</strong></a> is a ruby program that easily transfers directories between a local directory and an S3 bucket:prefix. It behaves somewhat, but not precisely, like the <strong>rsync</strong> program.</p>
<p>I am using this tool to automatically backup the important data from Debian servers to Amazon S3. I am not going to explain here how to install s3sync as it is not the purpose of this article. However, you can read this very useful article from John Eberly&#8217;s blog: <a href="http://blog.eberly.org/2006/10/09/how-automate-your-backup-to-amazon-s3-using-s3sync/" target="_blank">How I automated my backups to Amazon S3 using s3sync</a>.</p>
<p>If you followed the steps from John Eberly&#8217;s post, you should have an <code>upload.sh</code> script and a crontab job which executes this script periodically.</p>
<p>From this point, here is what you need to do to monitor the success of the synchronisation with <a href="http://www.zabbix.com/" target="_blank"><strong>Zabbix</strong></a>:</p>
<ol>
<li>Add the following code at the end of your <code>upload.sh</code> script:
<pre class="brush: bash; title: ; notranslate">
# print the exit code
RETVAL=$?
&#x5B; $RETVAL -eq 0 ] &amp;&amp; echo &quot;Synchronization succeed&quot;
&#x5B; $RETVAL -ne 0 ] &amp;&amp; echo &quot;Synchronization failed&quot;
</pre>
</li>
<li>Log the output of the cron script as follow:
<pre class="brush: bash; light: true; title: ; notranslate">
30 2 * * sun /path/to/upload.sh &gt; /var/log/s3sync.log 2&gt;&amp;1
</pre>
</li>
<li>On Zabbix, create a new item which will check the existence of the sentence &#8220;Synchronization failed&#8221; in the file <code>/var/log/s3sync.log</code>:<br />
<a href="https://www.logikdev.com/wp-content/uploads/2011/11/zabbix_s3sync_item.png"><img fetchpriority="high" decoding="async" src="https://www.logikdev.com/wp-content/uploads/2011/11/zabbix_s3sync_item-297x300.png" alt="" title="Create a new item on Zabbix to monitor s3sync" width="297" height="300" class="aligncenter size-medium wp-image-1569" srcset="https://www.logikdev.com/wp-content/uploads/2011/11/zabbix_s3sync_item-297x300.png 297w, https://www.logikdev.com/wp-content/uploads/2011/11/zabbix_s3sync_item.png 641w" sizes="(max-width: 297px) 100vw, 297px" /></a><br />
Item key: <code>vfs.file.regmatch[/var/log/s3sync.log,Synchronization failed]</code><br />

</li>
<li>Still on Zabbix, define a new trigger for the previously created item:<br />
<a href="https://www.logikdev.com/wp-content/uploads/2011/11/zabbix_s3sync_trigger.png"><img decoding="async" src="https://www.logikdev.com/wp-content/uploads/2011/11/zabbix_s3sync_trigger-300x160.png" alt="" title="Define a new trigger on Zabbix to monitor s3sync" width="300" height="160" class="aligncenter size-medium wp-image-1570" srcset="https://www.logikdev.com/wp-content/uploads/2011/11/zabbix_s3sync_trigger-300x160.png 300w, https://www.logikdev.com/wp-content/uploads/2011/11/zabbix_s3sync_trigger.png 665w" sizes="(max-width: 300px) 100vw, 300px" /></a><br />
Trigger expression: <code>{Template_AmazonCloud_Debian:vfs.file.regmatch[/var/log/s3sync.log,Synchronization failed].last(0)}=1</code>
</li>
</ol>
<p>With these few steps, you should now receive Zabbix alerts when a backup on S3 fails. 🙂</p><p>The post <a href="https://www.logikdev.com/2011/11/24/monitor-s3sync-with-zabbix/">Monitor s3sync with Zabbix</a> first appeared on <a href="https://www.logikdev.com">LogikDevelopment</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.logikdev.com/2011/11/24/monitor-s3sync-with-zabbix/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
