<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5273376812224963235</id><updated>2025-06-19T21:26:51.799+03:00</updated><title type='text'>Shavit Netzer</title><subtitle type='html'>Linux and cloud operations helpful scripts and codes</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://shavitnetzer.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5273376812224963235/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://shavitnetzer.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Shavit Netzer</name><uri>http://www.blogger.com/profile/01566450022345814686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhs4jbx63tA5BEeB3g75WK03D0vWxLjrLp7sk995rNCUL6-1Brxj0gfm1rkppDM1Fvmvilln9CQPH5f1Gty3bJmYZUrTqcusDT7jKrqXB8kLHJy1L2yfGAfAPAZ4rjWzC8/s1600/41368_625684294_9834_n.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>8</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5273376812224963235.post-7179911657577733195</id><published>2015-04-03T18:03:00.002+03:00</published><updated>2015-04-03T18:03:13.930+03:00</updated><title type='text'>Unable to establish connection to http://controller:35357/v2.0/tenants</title><content type='html'>If you get this error while using keystone.&lt;br /&gt;
&lt;br /&gt;
Just hash (#) the line start with driver under [token]&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #444444; font-family: arial; font-size: 12px; line-height: 20.3999996185303px;&quot;&gt;#driver = keystone.token.persistence.backends.sql.Token&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://shavitnetzer.blogspot.com/feeds/7179911657577733195/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shavitnetzer.blogspot.com/2015/04/unable-to-establish-connection-to.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5273376812224963235/posts/default/7179911657577733195'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5273376812224963235/posts/default/7179911657577733195'/><link rel='alternate' type='text/html' href='http://shavitnetzer.blogspot.com/2015/04/unable-to-establish-connection-to.html' title='Unable to establish connection to http://controller:35357/v2.0/tenants'/><author><name>Shavit Netzer</name><uri>http://www.blogger.com/profile/01566450022345814686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhs4jbx63tA5BEeB3g75WK03D0vWxLjrLp7sk995rNCUL6-1Brxj0gfm1rkppDM1Fvmvilln9CQPH5f1Gty3bJmYZUrTqcusDT7jKrqXB8kLHJy1L2yfGAfAPAZ4rjWzC8/s1600/41368_625684294_9834_n.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5273376812224963235.post-1734661270294205843</id><published>2015-03-20T16:07:00.002+02:00</published><updated>2015-03-20T16:07:12.978+02:00</updated><title type='text'>openstack-install error</title><content type='html'>If you get the following , when try to run:&amp;nbsp;openstack-install&lt;br /&gt;
&lt;br /&gt;
Error:&lt;br /&gt;
&lt;br /&gt;
Previous installation detected. Did you mean to run openstack-status instead?&lt;br /&gt;
If attempting to re-install please run &amp;nbsp; &amp;nbsp; $ sudo openstack-install -u&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
you need to delete the following:&amp;nbsp;.cloud-install (under the user home directory)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Enjoy&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://shavitnetzer.blogspot.com/feeds/1734661270294205843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shavitnetzer.blogspot.com/2015/03/openstack-install-error.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5273376812224963235/posts/default/1734661270294205843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5273376812224963235/posts/default/1734661270294205843'/><link rel='alternate' type='text/html' href='http://shavitnetzer.blogspot.com/2015/03/openstack-install-error.html' title='openstack-install error'/><author><name>Shavit Netzer</name><uri>http://www.blogger.com/profile/01566450022345814686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhs4jbx63tA5BEeB3g75WK03D0vWxLjrLp7sk995rNCUL6-1Brxj0gfm1rkppDM1Fvmvilln9CQPH5f1Gty3bJmYZUrTqcusDT7jKrqXB8kLHJy1L2yfGAfAPAZ4rjWzC8/s1600/41368_625684294_9834_n.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5273376812224963235.post-7778361513717221183</id><published>2015-03-20T12:42:00.005+02:00</published><updated>2015-03-20T12:42:59.950+02:00</updated><title type='text'>OpenStack MAAS failed commissioning wakeonlan</title><content type='html'>If you get the error while try to commission or wake on lan,&lt;br /&gt;
&lt;br /&gt;
you will need to check first if you have it installed on your server (MAAS server).&lt;br /&gt;
&lt;br /&gt;
if you check the template:&lt;br /&gt;
/etc/maas/templates/power/ether_wake.template&lt;br /&gt;
&lt;br /&gt;
you will see that it looks for:&lt;br /&gt;
/usr/bin/wakeonlan&lt;br /&gt;
and&lt;br /&gt;
/usr/sbin/etherwake&lt;br /&gt;
&lt;br /&gt;
just install them:&lt;br /&gt;
apt-get install etherwake wakeonlan -y&lt;br /&gt;
&lt;br /&gt;
and if you want to test it for each node: i = interface and b = broadcast&lt;br /&gt;
/usr/sbin/etherwake -i &amp;lt;INTERFACE&amp;gt; -b &amp;lt;MAC&amp;gt;&lt;br /&gt;
/usr/sbin/etherwake -i eth0 -b e8:39:35:39:e3:11&lt;br /&gt;
&lt;br /&gt;
Enjoy,&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://shavitnetzer.blogspot.com/feeds/7778361513717221183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shavitnetzer.blogspot.com/2015/03/openstack-maas-failed-commissioning.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5273376812224963235/posts/default/7778361513717221183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5273376812224963235/posts/default/7778361513717221183'/><link rel='alternate' type='text/html' href='http://shavitnetzer.blogspot.com/2015/03/openstack-maas-failed-commissioning.html' title='OpenStack MAAS failed commissioning wakeonlan'/><author><name>Shavit Netzer</name><uri>http://www.blogger.com/profile/01566450022345814686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhs4jbx63tA5BEeB3g75WK03D0vWxLjrLp7sk995rNCUL6-1Brxj0gfm1rkppDM1Fvmvilln9CQPH5f1Gty3bJmYZUrTqcusDT7jKrqXB8kLHJy1L2yfGAfAPAZ4rjWzC8/s1600/41368_625684294_9834_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5273376812224963235.post-7435422166237857204</id><published>2012-09-14T23:19:00.001+03:00</published><updated>2012-09-14T23:23:58.424+03:00</updated><title type='text'>Chef-client 401 &quot;Unauthorized&quot;</title><content type='html'>If you get this :&amp;nbsp;Net::HTTPServerException: 401 &quot;Unauthorized&quot;&lt;br /&gt;
when running chef-client, you need to verify that you have the fqdn / node name (node_name) in your client configuration.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
so how to solve it:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;vi&amp;nbsp;/etc/chef/client.rb&lt;/li&gt;
&lt;li&gt;add the hostname (node name) as follow (replace the NAME with your server name):&amp;nbsp;node_name &quot;NAME&quot;&lt;/li&gt;
&lt;li&gt;save the file&lt;/li&gt;
&lt;li&gt;run chef-client and enjoy&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
also the following error can point on the same issue:&amp;nbsp;&lt;a href=&quot;http://chef-server:4040/nodes/localhost&quot;&gt;http://chef-server:4040/nodes/localhost&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
the localhost is the default, so you must change the node name to you hostname.&lt;/div&gt;
&lt;div&gt;
BTW - the hostname is the same name you can find when running: knife client list&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://shavitnetzer.blogspot.com/feeds/7435422166237857204/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shavitnetzer.blogspot.com/2012/09/chef-client-401-unauthorized.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5273376812224963235/posts/default/7435422166237857204'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5273376812224963235/posts/default/7435422166237857204'/><link rel='alternate' type='text/html' href='http://shavitnetzer.blogspot.com/2012/09/chef-client-401-unauthorized.html' title='Chef-client 401 &quot;Unauthorized&quot;'/><author><name>Shavit Netzer</name><uri>http://www.blogger.com/profile/01566450022345814686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhs4jbx63tA5BEeB3g75WK03D0vWxLjrLp7sk995rNCUL6-1Brxj0gfm1rkppDM1Fvmvilln9CQPH5f1Gty3bJmYZUrTqcusDT7jKrqXB8kLHJy1L2yfGAfAPAZ4rjWzC8/s1600/41368_625684294_9834_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5273376812224963235.post-1455355344480134466</id><published>2012-08-29T17:23:00.000+03:00</published><updated>2012-08-29T17:23:08.722+03:00</updated><title type='text'>Chef bootstrap - public key failure</title><content type='html'>I tried running chef bootstrap using public key on amazon ec2 server, and get some errors:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; ERROR: ArgumentError: invalid option(s): keys_only&lt;br /&gt;
Or&lt;br /&gt;
&amp;nbsp; &amp;nbsp;/usr/lib/ruby/1.8/net/ssh.rb:155:in `start&#39;: invalid option(s): keys_only (ArgumentError)&lt;br /&gt;
well, i&amp;nbsp;don&#39;t&amp;nbsp;know if it is a bug, but i create a simple solution for this with a simple script&lt;br /&gt;
the following script will allow password, run bootstrap and disallow password&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;This script will change the&amp;nbsp;PasswordAuthentication in&amp;nbsp;/etc/ssh/sshd_config&lt;br /&gt;
will add password: PASSWORD&lt;br /&gt;
will run the bootstrap&lt;br /&gt;
and&amp;nbsp;finally will block using password.&lt;br /&gt;
&lt;br /&gt;
vi&amp;nbsp;knife_add_new_node.sh&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
if [ $# -ne 2 ]&lt;br /&gt;
then&lt;br /&gt;
&amp;nbsp;echo &quot;please run the script as follow: $0 keyname.pem server-address&quot;&lt;br /&gt;
else&lt;br /&gt;
&amp;nbsp;ssh -i ${1} root@${2} &quot;sed -i &#39;s/PasswordAuthentication no/PasswordAuthentication yes/g&#39; /etc/ssh/sshd_config;echo root:PASSWORD | chpasswd;/etc/init.d/ssh restart&quot;&lt;br /&gt;
&amp;nbsp;knife bootstrap ${2} -x root -P PASSWORD&lt;br /&gt;
&amp;nbsp;ssh -i ${1} root@${2} &quot;sed -i &#39;s/PasswordAuthentication yes/PasswordAuthentication no/g&#39; /etc/ssh/sshd_config;/etc/init.d/ssh restart&quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://shavitnetzer.blogspot.com/feeds/1455355344480134466/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shavitnetzer.blogspot.com/2012/08/chef-bootstrap-public-key-failure.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5273376812224963235/posts/default/1455355344480134466'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5273376812224963235/posts/default/1455355344480134466'/><link rel='alternate' type='text/html' href='http://shavitnetzer.blogspot.com/2012/08/chef-bootstrap-public-key-failure.html' title='Chef bootstrap - public key failure'/><author><name>Shavit Netzer</name><uri>http://www.blogger.com/profile/01566450022345814686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhs4jbx63tA5BEeB3g75WK03D0vWxLjrLp7sk995rNCUL6-1Brxj0gfm1rkppDM1Fvmvilln9CQPH5f1Gty3bJmYZUrTqcusDT7jKrqXB8kLHJy1L2yfGAfAPAZ4rjWzC8/s1600/41368_625684294_9834_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5273376812224963235.post-5722640412902164360</id><published>2012-04-22T18:42:00.004+03:00</published><updated>2012-08-29T17:24:55.600+03:00</updated><title type='text'>Nagios with graphs installation (step by step)</title><content type='html'>Did you ever wanted to have alerting system (such as Nagios) and add some graphs&lt;br /&gt;
&lt;div&gt;
you can find here a short post, with a full description of adding graphs to Nagios&lt;/div&gt;
&lt;div&gt;
I also add configuration example&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;apt-get update&lt;/li&gt;
&lt;li&gt;apt-get install nagios3 gcc php5-gd rrdtool librrds-perl make -y&lt;/li&gt;
&lt;li&gt;cd /usr/src/&lt;/li&gt;
&lt;li&gt;wget http://downloads.sourceforge.net/project/pnp4nagios/PNP-0.6/pnp4nagios-0.6.16.tar.gz?r=http%3A%2F%2Fdocs.pnp4nagios.org%2Fpnp-0.6%2Fdwnld&amp;amp;ts=1330609501&amp;amp;use_mirror=garr&lt;/li&gt;
&lt;li&gt;mv pnp4nagios-0.6.16.tar.gz\?r\=http\:%2F%2Fdocs.pnp4nagios.org%2Fpnp-0.6%2Fdwnld pnp4nagios-0.6.16.tar.gz&lt;/li&gt;
&lt;li&gt;tar zxvf pnp4nagios-0.6.16.tar.gz&lt;/li&gt;
&lt;li&gt;cd pnp4nagios-0.6.16&lt;/li&gt;
&lt;li&gt;./configure&lt;/li&gt;
&lt;li&gt;make all&lt;/li&gt;
&lt;li&gt;make fullinstall&lt;/li&gt;
&lt;li&gt;mv /etc/apache2/conf.d/pnp4nagios.conf /etc/apache2/pnp4nagios.ORIG&lt;/li&gt;
&lt;li&gt;cat /etc/apache2/pnp4nagios.ORIG | sed -e &#39;/Auth.*/d&#39; | sed -e &#39;/Require valid-user/d&#39; | tee /etc/apache2/conf.d/pnp4nagios.conf&lt;/li&gt;
&lt;li&gt;/etc/init.d/apache2 reload&lt;/li&gt;
&lt;li&gt;curl http://localhost/pnp4nagios&lt;/li&gt;
&lt;li&gt;mv /usr/local/pnp4nagios/share/install.php /usr/local/pnp4nagios/share/install.php.ORIG&lt;/li&gt;
&lt;li&gt;cd /etc/nagios3/conf.d/&lt;/li&gt;
&lt;li&gt;vi graphs.cfg&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;define host {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; name &amp;nbsp; &amp;nbsp; &amp;nbsp; host-pnp&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&amp;amp;srv=_HOST_&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; register &amp;nbsp; 0&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;define service {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; name &amp;nbsp; &amp;nbsp; &amp;nbsp; srv-pnp&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&amp;amp;srv=$SERVICEDESC$&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; register &amp;nbsp; 0&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;vi /etc/nagios3/nagios.cfg (uncomment the following)&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;process_performance_data=1&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;enable_environment_macros=1&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;use_regexp_matching=1&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;check_external_command=1&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;host_perfdata_command=process-host-perfdata&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;service_perfdata_command=process-service-perfdata&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;user=root&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;group=root&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;vi /usr/local/pnp4nagios/libexec/process_perfdata.pl (comment the following)&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;#if( $&amp;lt; == 0 ){&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;# &amp;nbsp; &amp;nbsp;print &quot;dont try this as root \n&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;# &amp;nbsp; &amp;nbsp;exit 1;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;#}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;vi /etc/nagios3/commands.cfg&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
define command{&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; command_name &amp;nbsp; &amp;nbsp;process-host-perfdata&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; command_line &amp;nbsp; &amp;nbsp;/usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA&lt;/div&gt;
&lt;div&gt;
# &amp;nbsp; &amp;nbsp; &amp;nbsp; command_line &amp;nbsp; &amp;nbsp;/usr/bin/printf &quot;%b&quot; &quot;$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n&quot; &amp;gt;&amp;gt; /var/lib/nagios3/host-perfdata.out&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
# &#39;process-service-perfdata&#39; command definition&lt;/div&gt;
&lt;div&gt;
define command{&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; command_name &amp;nbsp; &amp;nbsp;process-service-perfdata&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; command_line &amp;nbsp; &amp;nbsp;/usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #command_line &amp;nbsp; /usr/bin/printf &quot;%b&quot; &quot;$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n&quot; &amp;gt;&amp;gt; /var/lib/nagios3/service-perfdata.out&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;vi /etc/nagios3/conf.d/hostgroups_nagios2.cfg&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;members &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .*&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;vi /etc/nagios3/conf.d/hosts.cfg&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
define host{&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; use &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; generic-host,host-pnp&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; host_name &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; linux-monitor&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; alias &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; linux-monitor&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; address &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; localhost&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;vi /etc/nagios3/conf.d/services.cfg&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
define service{&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; use &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; generic-service,srv-pnp&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; host_name &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; linux-*&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; service_description &amp;nbsp; &amp;nbsp; PING&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; check_command &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; check_ping!100.0,20%!500.0,60%&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;vi /etc/ssh/ssh_config (in order to prevent ssh check)&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;StrictHostKeyChecking no&lt;/li&gt;
&lt;li&gt;UserKnownHostsFile=/dev/null&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://shavitnetzer.blogspot.com/feeds/5722640412902164360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shavitnetzer.blogspot.com/2012/04/nagios-with-graphs-installation-step-by.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5273376812224963235/posts/default/5722640412902164360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5273376812224963235/posts/default/5722640412902164360'/><link rel='alternate' type='text/html' href='http://shavitnetzer.blogspot.com/2012/04/nagios-with-graphs-installation-step-by.html' title='Nagios with graphs installation (step by step)'/><author><name>Shavit Netzer</name><uri>http://www.blogger.com/profile/01566450022345814686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhs4jbx63tA5BEeB3g75WK03D0vWxLjrLp7sk995rNCUL6-1Brxj0gfm1rkppDM1Fvmvilln9CQPH5f1Gty3bJmYZUrTqcusDT7jKrqXB8kLHJy1L2yfGAfAPAZ4rjWzC8/s1600/41368_625684294_9834_n.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5273376812224963235.post-2346315902397515689</id><published>2012-02-24T19:58:00.000+02:00</published><updated>2012-08-30T22:08:52.555+03:00</updated><title type='text'>EC2 security access when working with ELB</title><content type='html'>&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
As you know /or not, when working with ELB the security
group on the Amazon ec2 instances will not catch the real IP, only the internal ELB ip.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
So, how can we prevent this Security hole?&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Well easy, you can use Apache or NginX, with the
X-Forwarded-For header&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
I will add one example for Nginx (the Nginx will use a proxy
to your local software – elastic, mongo, web server……)&lt;br /&gt;
&lt;br /&gt;
So, copy past and chenge the IP&#39;s :-)&lt;br /&gt;
&lt;br /&gt;
------------------------------------------------------------------------------------------------------------&lt;br /&gt;
&amp;nbsp;&amp;nbsp; upstream backend &amp;nbsp;{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; server 10.10.10.1:9200;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; server 10.10.10.2:9200;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; server 10.10.10.3:9200;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
server {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;listen &amp;nbsp; 80;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;set $allow false;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if ($http_x_forwarded_for ~ &quot; ?100\.100\.100\.100$&quot;) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;set $allow true;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if ($http_x_forward_for ~ &quot; ?100\.100\.100\.101$&quot;) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;set $allow true;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if ($allow = false) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;return 403;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
log_format shavit &#39;$remote_addr $remote_user $time_local $status &#39;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &#39;&quot;$request&quot; $body_bytes_sent &quot;$http_referer&quot; &#39;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &#39;&quot;$http_user_agent&quot; &quot;$http_x_forwarded_for&quot;&#39;;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;access_log &amp;nbsp; /var/log/nginx/test-access.log &amp;nbsp;main;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;root /usr/share/nginx/www;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;index index.html index.htm;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;server_name localhost;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;location / {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;proxy_pass http://backend;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://shavitnetzer.blogspot.com/feeds/2346315902397515689/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shavitnetzer.blogspot.com/2012/02/ec2-security-access-when-working-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5273376812224963235/posts/default/2346315902397515689'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5273376812224963235/posts/default/2346315902397515689'/><link rel='alternate' type='text/html' href='http://shavitnetzer.blogspot.com/2012/02/ec2-security-access-when-working-with.html' title='EC2 security access when working with ELB'/><author><name>Shavit Netzer</name><uri>http://www.blogger.com/profile/01566450022345814686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhs4jbx63tA5BEeB3g75WK03D0vWxLjrLp7sk995rNCUL6-1Brxj0gfm1rkppDM1Fvmvilln9CQPH5f1Gty3bJmYZUrTqcusDT7jKrqXB8kLHJy1L2yfGAfAPAZ4rjWzC8/s1600/41368_625684294_9834_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5273376812224963235.post-8365418264919118329</id><published>2012-02-24T17:55:00.003+02:00</published><updated>2012-08-30T22:45:31.068+03:00</updated><title type='text'>EC2 Instance backup - auto backup for prod</title><content type='html'>&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Did you ever wonder how to automatically create a backup to
only your prod (or some other) environment on Amazon ec2?&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Well this is easy, all you need to do is to add a tag to the
instances and set a cron job.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Copy the following script to your manage machine and replace
the EC2 certs path ….. with your&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;------------------------------------------------------------------------------------------------------------&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
#!/bin/bash -x&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Created by
Shavit Netzer&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;##&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This
script will run every XXX time depend on you&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ##&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; And will
start backup depend on the Backup tag&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;##&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
if [ -z $1 ]&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;then&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp; echo &quot;ERROR -
need to provide params $0 WHEN[h,d,m]&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp; exit&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
fi&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
export EC2_HOME=/path/to/your/ec2-api-tools&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
export JAVA_HOME=/path/to/your/jvm/java-6-sun-1.6.0.26&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
export EC2_PRIVATE_KEY=/path/to/your/pk-XXXX.pem&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
export EC2_CERT=/path/to/your/cert-XXXX.pem&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
export EC2_ID=&#39;XXXX&#39;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
export EC2_SECRET=&#39;XXXX&#39;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
export AWS_ELB_HOME=/path/to/your/ElasticLoadBalancing&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
export AWS_AUTO_SCALING_HOME=/path/to/your/AutoScaling&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
export AWS_CLOUDWATCH_HOME=/path/to/your/CloudWatch&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
listofinstances=&quot;&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
if [ &quot;$1&quot; == &quot;h&quot; ]&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;then&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;
listofinstances=`/usr/src/ec2-api-tools-1.4.4.2/bin/ec2-describe-instances
--region us-east-1 | sed &quot;s#\t#,#g;&quot; | grep ^TAG | grep
&quot;,Backup,&quot; | grep h$`&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
fi&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
if [ &quot;$1&quot; == &quot;d&quot; ]&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;then&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;
listofinstances=`/usr/src/ec2-api-tools-1.4.4.2/bin/ec2-describe-instances
--region us-east-1 | sed &quot;s#\t#,#g;&quot; | grep ^TAG | grep
&quot;,Backup,&quot; | grep d$`&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
fi&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
if [ &quot;$1&quot; == &quot;m&quot; ]&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;then&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;
listofinstances=`/usr/src/ec2-api-tools-1.4.4.2/bin/ec2-describe-instances
--region us-east-1 | sed &quot;s#\t#,#g;&quot; | grep ^TAG | grep
&quot;,Backup,&quot; | grep m$`&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
fi&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
if [ &quot;$listofinstances&quot; != &quot;&quot; ]&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;then&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;
tagnames=`/usr/src/ec2-api-tools-1.4.4.2/bin/ec2-describe-instances
--region us-east-1 | sed &quot;s#\t#,#g;&quot; | grep ^TAG | grep
&quot;,Name,&quot;`&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp; for instance in
$listofinstances&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp; do&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; instanceid=`echo
$instance | awk -F, &#39;{print $3}&#39;`&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; for tname in
$tagnames&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
instancetag=`echo $tname | grep $instanceid`&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if [
&quot;$instancetag&quot; != &quot;&quot; ]&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo
&quot;=== start $instanceid ===&quot; &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATE=`date
+%Y%m%d%H`&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; instancetagname=`echo
$instancetag | awk -F, &#39;{print $5}&#39;`&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; underline=&quot;_&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo
&quot;Create backup for instance $instanceid with name $instancetagname&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo
&quot;/usr/src/ec2-api-tools-1.4.4.2/bin/ec2-create-image $instanceid --name
$DATE$underline$instancetagname --description $DATE$underline$instancetagname
--no-reboot&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ami1=`/usr/src/ec2-api-tools-1.4.4.2/bin/ec2-create-image
$instanceid --name $DATE$underline$instancetagname --description
$DATE$underline$instancetagname --no-reboot`&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo
$ami1 | sed -e &#39;s/IMAGE//&#39; -e &#39;s/ //g&#39;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ami=`echo
$ami1 | sed -e &#39;s/IMAGE//&#39; -e &#39;s/ //g&#39;`&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo
&quot;Adding TAG for the backup&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo
&quot;/usr/src/ec2-api-tools-1.4.4.2/bin/ec2-create-tags $ami --tag
Name=$DATE$underline$instancetagname&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /usr/src/ec2-api-tools-1.4.4.2/bin/ec2-create-tags
$ami --tag Name=$DATE$underline$instancetagname&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo
&quot;=== end $instanceid ===&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fi&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; done&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp; done&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
fi&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://shavitnetzer.blogspot.com/feeds/8365418264919118329/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shavitnetzer.blogspot.com/2012/02/ec2-instance-backup-auto-backup-for.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5273376812224963235/posts/default/8365418264919118329'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5273376812224963235/posts/default/8365418264919118329'/><link rel='alternate' type='text/html' href='http://shavitnetzer.blogspot.com/2012/02/ec2-instance-backup-auto-backup-for.html' title='EC2 Instance backup - auto backup for prod'/><author><name>Shavit Netzer</name><uri>http://www.blogger.com/profile/01566450022345814686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhs4jbx63tA5BEeB3g75WK03D0vWxLjrLp7sk995rNCUL6-1Brxj0gfm1rkppDM1Fvmvilln9CQPH5f1Gty3bJmYZUrTqcusDT7jKrqXB8kLHJy1L2yfGAfAPAZ4rjWzC8/s1600/41368_625684294_9834_n.jpg'/></author><thr:total>1</thr:total></entry></feed>