<?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>foscode</title>
	<atom:link href="http://www.foscode.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.foscode.com</link>
	<description>because code should be free</description>
	<lastBuildDate>Wed, 24 Apr 2013 18:42:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<item>
		<title>indiePub Games (Capsized, Pictago, Hungry Gows)</title>
		<link>http://www.foscode.com/indiepub-games-capsized-pictago-hungry-gows/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=indiepub-games-capsized-pictago-hungry-gows</link>
		<comments>http://www.foscode.com/indiepub-games-capsized-pictago-hungry-gows/#comments</comments>
		<pubDate>Thu, 07 Mar 2013 18:58:04 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[capsized]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[hungry gows]]></category>
		<category><![CDATA[indiepub]]></category>
		<category><![CDATA[pictago]]></category>

		<guid isPermaLink="false">http://www.foscode.com/?p=1017</guid>
		<description><![CDATA[<p>Capsized, Pictago and Hungry Gows now available for download on iOS and soon on Android. <a href="http://www.foscode.com/indiepub-games-capsized-pictago-hungry-gows/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://www.foscode.com/indiepub-games-capsized-pictago-hungry-gows/">indiePub Games (Capsized, Pictago, Hungry Gows)</a> appeared first on <a href="http://www.foscode.com">foscode</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>I know my site doesn&#8217;t have any advertisements and I like to keep it that way, so my users aren&#8217;t distracted by annoying ads that might not interest them anyway. With that being said, I created this post to advertise 3 games the company I work for, <a title="indiePub Entertainment Inc" href="www.indiepubgames.com" target="_blank">indiePub</a>, has developed, and hopefully I can get my users, you, to download these games and support us. 2 of these games are free and won&#8217;t cost you anything, and the other is a paid game. All 3 games are worth your time and I really appreciate it if you could at least download the free ones.</p>
<div align="center">

<a href='http://www.foscode.com/?attachment_id=1011' title='Capsized'><img width="150" height="126" src="http://www.foscode.com/wp-content/uploads/2013/03/Capsized-150x126.jpg" class="attachment-thumbnail" alt="Capsized" title="Capsized" /></a>
<a href='http://www.foscode.com/?attachment_id=1013' title='Hungry_Gows'><img width="150" height="126" src="http://www.foscode.com/wp-content/uploads/2013/03/Hungry_Gows-150x126.jpg" class="attachment-thumbnail" alt="Hungry Gows" title="Hungry_Gows" /></a>
<a href='http://www.foscode.com/?attachment_id=1015' title='Pictago'><img width="150" height="126" src="http://www.foscode.com/wp-content/uploads/2013/03/Pictago-150x126.jpg" class="attachment-thumbnail" alt="Pictago" title="Pictago" /></a>

</div>
<p><span id="more-1017"></span></p>
<p>The first game is called <a title="Hungry Gows" href="https://www.facebook.com/HungryGows" target="_blank">Hungry Gows</a>, currently only available for iOS devices, this game is a free download and can be <a href="https://itunes.apple.com/us/app/hungry-gows/id482597071?mt=8"> downloaded here </a>. Here&#8217;s a brief summary of the game and its trailler:</p>
<p><a title="Hungry Gows" href="https://www.facebook.com/HungryGows" target="_blank">Hungry Gows</a></p>
<p><iframe width="688" height="387" src="http://www.youtube.com/embed/J-8_UYjR28E?feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p>Detach and destroy all the Hungry Gows in this 2D physics-based puzzle game featuring adorable aliens hell-bent on devouring the cities of Loomville, Mootown and Acecity.</p>
<p>Use well-timed taps to create cascading carnage and clear each level using the least number of moves possible. Drop Gows on moving wheels of spikey death, smash them into walls or even bash them into each other for cartoony fun and destruction.</p>
<p>Each type of Gow interacts with the environment in a unique way, allowing multiple solutions to all 60 puzzles. Get into a Gow smashing groove and you can unlock all 25 Achievements.</p>
<p>You can also use your pictures or photos to create customized Gows using the Hungry Gows Facemaker feature.</p>
<p>The next game is called Capsized+, also only available for iOS devices and PC, this game will cost you some, currently priced at $2.99, but make sure to check the apple store and Steam for any price updates and special promotions. <a href="https://itunes.apple.com/us/app/hungry-gows/id482597071?mt=8"> iOS downloads are available here</a>. Here&#8217;s a brief description and trailler:</p>
<p><a title="Capsized+" href="https://itunes.apple.com/app/id516387847" target="_blank">Capsized+</a> </p>
<p><iframe width="688" height="387" src="http://www.youtube.com/embed/0ZbHMVNWY1I?feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p>Feverishly blast through a hostile planet packed with blood-sucking aliens in CAPSIZED+, an action-packed survival shooter.</p>
<p>You are a marooned space traveler whose ship has crash landed on a mysterious alien planet and must navigate through beautiful but perilous environments while fighting bloodthirsty creatures to save your crewmates and escape with your lives.</p>
<p>Use a grappling hook, jet pack, high-tech weapons and awesome powerups – create friggin’ black holes! &#8211; to fight through non-linear levels set in explorable, hostile environments.</p>
<p>CAPSIZED+ INCLUDES:</p>
<p>- Campaign Mode: Test your mettle in thirteen levels with lush and varied terrains.<br />
- Three Arcade Modes: Fight endless waves of enemies in Survival Mode, grab oxygen to survive Last Gasp Challenges or test your survival skills in the weapons-free Armless Mode.<br />
- GameCenter Achievements: Prove your intergalactic survival skills by earning all twelve achievements.<br />
- Lush Environments – Enjoy strange and amazing landscapes illustrated in a unique, hand-drawn style. Check out the screen shots.<br />
- Intense Gameplay – Test your constitution with more than twenty hours of heart-throbbing, thumb-busting action.</p>
<p>And last but not least on our list is Pictago, available for free on both iOS and Android. </p>
<p><a title="Pictago" href="https://www.facebook.com/pictagogame" target="_blank">Pictago</a></p>
<div align="center">

<a href='http://www.foscode.com/?attachment_id=1027' title='pictago_sample'><img width="150" height="150" src="http://www.foscode.com/wp-content/uploads/2013/03/pictago_sample-150x150.jpg" class="attachment-thumbnail" alt="Pictago Sample Game" title="pictago_sample" /></a>
<a href='http://www.foscode.com/?attachment_id=1031' title='pictago_play'><img width="150" height="150" src="http://www.foscode.com/wp-content/uploads/2013/03/pictago_play-150x150.jpg" class="attachment-thumbnail" alt="pictago_play" title="pictago_play" /></a>
<a href='http://www.foscode.com/?attachment_id=1033' title='pictago_score'><img width="150" height="150" src="http://www.foscode.com/wp-content/uploads/2013/03/pictago_score-150x150.jpg" class="attachment-thumbnail" alt="pictago_score" title="pictago_score" /></a>

</div>
<p>Pictago is a do it yourself puzzle, hidden item, picture game where you can set up scenes, snap what you see or use any image already in your iOS/Android device’s Photo Gallery and then turn them into hidden object games using Pictago’s simple touch-and-drag tools. Pictago can be download for <a href="https://itunes.apple.com/us/app/pictago/id529900415?mt=8" target="_blank">iOS here </a> and <a href="https://play.google.com/store/apps/details?id=com.indiePub.Pictago" target="_blank">Android here</a>.</p>
<p>Pictago’s possibilities are limited only by your imagination.</p>
<p>Pictago’s features include:</p>
<p>    The ability to use any image in your Photo Gallery, take new photos from within the Pictago app or import your Facebook photos and turn them into games.<br />
    The ability to share your games with friends and family through Facebook, Twitter and email.<br />
    A simple and familiar touch-and-drag tagging mechanic.<br />
    Two game modes: List Mode where friends search for tagged items in any order and Single Item Mode where friends try to find hidden items in a specific order, one at a time.<br />
    A Hints system to help to find those especially well-hidden objects.<br />
    A Tag Back feature to quickly re-tag a game and send it back to your Friend.<br />
    A Leaderboard for each game.<br />
    A World Feed where you can play the best games created by Pictago users from around the world.</p>
<p>And this concludes my intro to our games. Please download them and let your friends know, and their friends know and the friends of their friends know and so on. Thank you for stopping by and please share with others, after all, code should be free and please support independent game developers by downloading thier games.<a href="http://www.foscode.com/wp-content/uploads/2010/04/foscode_logo_sm.png"><img src="http://www.foscode.com/wp-content/uploads/2010/04/foscode_logo_sm.png" alt="foscode.com | because code should be free" title="FOSCODE" width="227" height="18" class="alignright size-full wp-image-221" /></a></p>
<p>The post <a href="http://www.foscode.com/indiepub-games-capsized-pictago-hungry-gows/">indiePub Games (Capsized, Pictago, Hungry Gows)</a> appeared first on <a href="http://www.foscode.com">foscode</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.foscode.com/indiepub-games-capsized-pictago-hungry-gows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Monitor PHP-FPM and Nginx With Zabbix</title>
		<link>http://www.foscode.com/monitor-phpfpm-nginx-zabbix/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=monitor-phpfpm-nginx-zabbix</link>
		<comments>http://www.foscode.com/monitor-phpfpm-nginx-zabbix/#comments</comments>
		<pubDate>Fri, 28 Dec 2012 20:53:49 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[PHP-FPM]]></category>
		<category><![CDATA[Zabbix]]></category>

		<guid isPermaLink="false">http://www.foscode.com/?p=1007</guid>
		<description><![CDATA[<p>This is another quick tutorial, this time I&#8217;ll show you how to configure your server to allow zabbix to monitor Nginx and PHP-FPM. This tutorial assumes you&#8217;ve already installed zabbix on your monitoring server and also the server to be &#8230; <a href="http://www.foscode.com/monitor-phpfpm-nginx-zabbix/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://www.foscode.com/monitor-phpfpm-nginx-zabbix/">How To Monitor PHP-FPM and Nginx With Zabbix</a> appeared first on <a href="http://www.foscode.com">foscode</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>This is another quick tutorial, this time I&#8217;ll show you how to configure your server to allow zabbix to monitor Nginx and PHP-FPM. This tutorial assumes you&#8217;ve already installed zabbix on your monitoring server and also the server to be monitored. For simplicity sake, let&#8217;s call your zabbix server (the one doing the monitoring) zabbix_mon and let&#8217;s call the server you would like to monitor, server1. Zabbix is an open source monitoring solution available <a href="http://www.zabbix.com" title="Zabbix" target="_blank">here</a>, Nginx is an httpd and reverse proxy server, found <a href="http://nginx.org/en" title="Nginx" target="_blank">here</a> and php-fpm is an alternative PHP FastCGI found <a href="http://php-fpm.org" title="PHP-FPM" target="_blank">here</a>.<br />
Ok, with that out of the way, let set this up.<br />
<span id="more-1007"></span><br />
1. First, assuming you already have both Nginx and PHP-FPM installed and configured on server1, enable php-fpm status page in php-fpm config file (just make sure this line exists and it is not commented out):</p>
<pre class="brush: bash">
sudo vim /etc/php-fpm.d/www.conf

pm.status_path = /phpfpm-status
</pre>
<p>2. restart php-fpm</p>
<pre class="brush: bash">
sudo /etc/init.d/php-fpm restart
</pre>
<p>Now allow nginx to server both php-fpm and nginx status pages. Create 2 separate config files, one for nginx status and another for php-fpm status:</p>
<p>3. Create a new config file under /etc/nginx/virtual.d/ for php-fpm status</p>
<pre class="brush: bash">
sudo vim /etc/nginx/virtual.d/fpmstatus.conf


#
# Enable php-fpm status
#
server {
    listen       55888;

    location /phpfpm-status {
        fastcgi_pass   unix:/tmp/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        allow 127.0.0.1;
        allow 111.111.111.111;    # Put your zabbix_mon zabbix monitoring server here
        deny all;
    }
}
</pre>
<p>4. Create a new config file under /etc/nginx/virtual.d/ for nginx status</p>
<pre class="brush: bash">
sudo vim /etc/nginx/virtual.d/nginxstatus.conf

# Enable nginx status
server {

   listen 55777;

   location /nginx-status {
        stub_status on;
        access_log   off;
        allow 127.0.0.1;
        allow 111.111.111.111;    # Put your zabbix_mon zabbix monitoring server here
        deny all;
        }
}
</pre>
<p>5. Reload nginx</p>
<pre class="brush: bash">
sudo /etc/init.d/nginx reload
</pre>
<p>6. Test both status pages:</p>
<pre class="brush: bash">
curl http://127.0.0.1:55888/phpfpm-status

pool:                 www
process manager:      dynamic
start time:           18/Dec/2012:13:26:29 -0600
start since:          867269
accepted conn:        902240
listen queue:         0
max listen queue:     0
listen queue len:     0
idle processes:       19
active processes:     1
total processes:      20
max active processes: 121
max children reached: 30


curl http://127.0.0.1:55777/nginx-status
Active connections: 1 
server accepts handled requests
 474931 474931 474995 
Reading: 0 Writing: 1 Waiting: 0 
</pre>
<p>7. Install perl(LWP::UserAgent)</p>
<pre class="brush: bash">
sudo yum install perl-libwww-perl
</pre>
<p>8. Create a script for zabbix:</p>
<pre class="brush: bash">
sudo vim /usr/local/zabbix/plugins/php-fpm_status.pl

#!/usr/bin/perl
#
# Boris HUISGEN &lt;bhuisgen@hbis.fr&gt;

use LWP::UserAgent;

my $URL = &quot;http://127.0.0.1:55888/phpfpm-status&quot;;

#
# DO NOT MODIFY AFTER THIS LINE
#

my $ua = LWP::UserAgent-&gt;new(timeout =&gt; 15);
my $response = $ua-&gt;request(HTTP::Request-&gt;new(&#039;GET&#039;, $URL));

my $conn = 0;
my $idle = 0;
my $active = 0;
my $total = 0;
my $maxchildren = 0;

foreach (split(/\n/, $response-&gt;content)) {
 $conn = $1 if (/^accepted conn:\s+(\d+)/);
 $idle = $1 if (/^idle processes:\s+(\d+)/);
 $active = $1 if (/^active processes:\s+(\d+)/);
 $total = $1 if (/^total processes:\s+(\d+)/);
 $maxchildren = $1 if (/^max children reached:\s+(\d+)/);
  }

 print &quot;Accepted conn: $conn\tIdle proc: $idle\tActive proc: $active\tTotal proc: $total\tMax children: $maxchildren\n&quot;;
</pre>
<p>9. Create the file with zabbix parameters (this file calls the file above) </p>
<pre class="brush: bash">
sudo vim /usr/local/etc/zabbix_agentd.conf.d/php_fpm

UserParameter=php.conn,/usr/local/zabbix/plugins/php-fpm_status.pl|cut -f1|cut -d&quot; &quot; -f3
UserParameter=php.idle,/usr/local/zabbix/plugins/php-fpm_status.pl|cut -f2|cut -d&quot; &quot; -f3
UserParameter=php.active,/usr/local/zabbix/plugins/php-fpm_status.pl|cut -f3|cut -d&quot; &quot; -f3
UserParameter=php.total,/usr/local/zabbix/plugins/php-fpm_status.pl|cut -f4|cut -d&quot; &quot; -f3
UserParameter=php.maxchildren,/usr/local/zabbix/plugins/php-fpm_status.pl|cut -f5|cut -d&quot; &quot; -f3
</pre>
<p>10. Also create the monitor for nginx</p>
<pre class="brush: bash">
sudo vim /usr/local/etc/zabbix_agentd.conf.d/nginx_monitor

UserParameter=nginx.active[*],wget -O- -q http://localhost:55777/nginx-status | grep &#039;Active&#039; | awk &#039;{print $NF}&#039;
UserParameter=nginx.reading[*],wget -O- -q http://localhost:55777/nginx-status | grep &#039;Reading&#039; | awk &#039;{print $$2}&#039;
UserParameter=nginx.writing[*],wget -O- -q http://localhost:55777/nginx-status | grep &#039;Writing&#039; | awk &#039;{print $$4}&#039;
UserParameter=nginx.waiting[*],wget -O- -q http://localhost:55777/nginx-status | grep &#039;Waiting&#039; | awk &#039;{print $$6}&#039;
UserParameter=nginx.accepted[*],wget -O- -q http://localhost:55777/nginx-status | awk NR==3 | awk &#039;{print $$1}&#039;
UserParameter=nginx.handled[*],wget -O- -q http://localhost:55777/nginx-status | awk NR==3 | awk &#039;{print $$2}&#039;
UserParameter=nginx.requests[*],wget -O- -q http://localhost:55777/nginx-status | awk NR==3 | awk &#039;{print $$3}&#039;
</pre>
<p>11. Change permissions on both files (assuming your zabbix user and group is called zabbix):</p>
<pre class="brush: bash">
sudo chown zabbix.zabbix /usr/local/etc/zabbix_agentd.conf.d/php_fpm
sudo chmod 775 /usr/local/etc/zabbix_agentd.conf.d/php_fpm
sudo chown zabbix.zabbix /usr/local/zabbix/plugins/php-fpm_status.pl
sudo chmod 775 /usr/local/zabbix/plugins/php-fpm_status.pl
</pre>
<p>12. Add the new files to zabbix config so it loads the parameters</p>
<pre class="brush: bash">
sudo vim /usr/local/etc/zabbix_agentd.conf

Include=/usr/local/etc/zabbix_agentd.conf.d/php_fpm
Include=/usr/local/etc/zabbix_agentd.conf.d/nginx_monitor
</pre>
<p>13. Restart zabbix to load the new parameters</p>
<pre class="brush: bash">
sudo /etc/init.d/zabbix_agentd stop
sudo /etc/init.d/zabbix_agentd start
</pre>
<p>14. Load the templates below to zabbix_mon and apply the templates to the servers you&#8217;d like to monitor (using the zabbix web page for your zabbix_mon server):</p>
<p>php-fpm-zabbix-template.xml</p>
<pre class="brush: xml">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;zabbix_export&gt;
    &lt;version&gt;2.0&lt;/version&gt;
    &lt;date&gt;2012-12-28T20:30:14Z&lt;/date&gt;
    &lt;groups&gt;
        &lt;group&gt;
            &lt;name&gt;Templates&lt;/name&gt;
        &lt;/group&gt;
    &lt;/groups&gt;
    &lt;templates&gt;
        &lt;template&gt;
            &lt;template&gt;Template_PHP_FPM&lt;/template&gt;
            &lt;name&gt;Template PHP FPM&lt;/name&gt;
            &lt;groups&gt;
                &lt;group&gt;
                    &lt;name&gt;Templates&lt;/name&gt;
                &lt;/group&gt;
            &lt;/groups&gt;
            &lt;applications&gt;
                &lt;application&gt;
                    &lt;name&gt;PHP FPM&lt;/name&gt;
                &lt;/application&gt;
            &lt;/applications&gt;
            &lt;items&gt;
                &lt;item&gt;
                    &lt;name&gt;PHP - number of active processes&lt;/name&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;snmp_community&gt;&lt;/snmp_community&gt;
                    &lt;multiplier&gt;0&lt;/multiplier&gt;
                    &lt;snmp_oid&gt;&lt;/snmp_oid&gt;
                    &lt;key&gt;php.active&lt;/key&gt;
                    &lt;delay&gt;15&lt;/delay&gt;
                    &lt;history&gt;90&lt;/history&gt;
                    &lt;trends&gt;365&lt;/trends&gt;
                    &lt;status&gt;0&lt;/status&gt;
                    &lt;value_type&gt;3&lt;/value_type&gt;
                    &lt;allowed_hosts&gt;&lt;/allowed_hosts&gt;
                    &lt;units&gt;&lt;/units&gt;
                    &lt;delta&gt;0&lt;/delta&gt;
                    &lt;snmpv3_securityname&gt;&lt;/snmpv3_securityname&gt;
                    &lt;snmpv3_securitylevel&gt;0&lt;/snmpv3_securitylevel&gt;
                    &lt;snmpv3_authpassphrase&gt;&lt;/snmpv3_authpassphrase&gt;
                    &lt;snmpv3_privpassphrase&gt;&lt;/snmpv3_privpassphrase&gt;
                    &lt;formula&gt;1&lt;/formula&gt;
                    &lt;delay_flex&gt;&lt;/delay_flex&gt;
                    &lt;params&gt;&lt;/params&gt;
                    &lt;ipmi_sensor&gt;&lt;/ipmi_sensor&gt;
                    &lt;data_type&gt;0&lt;/data_type&gt;
                    &lt;authtype&gt;0&lt;/authtype&gt;
                    &lt;username&gt;&lt;/username&gt;
                    &lt;password&gt;&lt;/password&gt;
                    &lt;publickey&gt;&lt;/publickey&gt;
                    &lt;privatekey&gt;&lt;/privatekey&gt;
                    &lt;port&gt;&lt;/port&gt;
                    &lt;description&gt;&lt;/description&gt;
                    &lt;inventory_link&gt;0&lt;/inventory_link&gt;
                    &lt;applications&gt;
                        &lt;application&gt;
                            &lt;name&gt;PHP FPM&lt;/name&gt;
                        &lt;/application&gt;
                    &lt;/applications&gt;
                    &lt;valuemap/&gt;
                &lt;/item&gt;
                &lt;item&gt;
                    &lt;name&gt;PHP - number of idle processes&lt;/name&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;snmp_community&gt;&lt;/snmp_community&gt;
                    &lt;multiplier&gt;0&lt;/multiplier&gt;
                    &lt;snmp_oid&gt;&lt;/snmp_oid&gt;
                    &lt;key&gt;php.idle&lt;/key&gt;
                    &lt;delay&gt;15&lt;/delay&gt;
                    &lt;history&gt;90&lt;/history&gt;
                    &lt;trends&gt;365&lt;/trends&gt;
                    &lt;status&gt;0&lt;/status&gt;
                    &lt;value_type&gt;3&lt;/value_type&gt;
                    &lt;allowed_hosts&gt;&lt;/allowed_hosts&gt;
                    &lt;units&gt;&lt;/units&gt;
                    &lt;delta&gt;0&lt;/delta&gt;
                    &lt;snmpv3_securityname&gt;&lt;/snmpv3_securityname&gt;
                    &lt;snmpv3_securitylevel&gt;0&lt;/snmpv3_securitylevel&gt;
                    &lt;snmpv3_authpassphrase&gt;&lt;/snmpv3_authpassphrase&gt;
                    &lt;snmpv3_privpassphrase&gt;&lt;/snmpv3_privpassphrase&gt;
                    &lt;formula&gt;1&lt;/formula&gt;
                    &lt;delay_flex&gt;&lt;/delay_flex&gt;
                    &lt;params&gt;&lt;/params&gt;
                    &lt;ipmi_sensor&gt;&lt;/ipmi_sensor&gt;
                    &lt;data_type&gt;0&lt;/data_type&gt;
                    &lt;authtype&gt;0&lt;/authtype&gt;
                    &lt;username&gt;&lt;/username&gt;
                    &lt;password&gt;&lt;/password&gt;
                    &lt;publickey&gt;&lt;/publickey&gt;
                    &lt;privatekey&gt;&lt;/privatekey&gt;
                    &lt;port&gt;&lt;/port&gt;
                    &lt;description&gt;&lt;/description&gt;
                    &lt;inventory_link&gt;0&lt;/inventory_link&gt;
                    &lt;applications&gt;
                        &lt;application&gt;
                            &lt;name&gt;PHP FPM&lt;/name&gt;
                        &lt;/application&gt;
                    &lt;/applications&gt;
                    &lt;valuemap/&gt;
                &lt;/item&gt;
                &lt;item&gt;
                    &lt;name&gt;PHP - number of max children reached&lt;/name&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;snmp_community&gt;&lt;/snmp_community&gt;
                    &lt;multiplier&gt;0&lt;/multiplier&gt;
                    &lt;snmp_oid&gt;&lt;/snmp_oid&gt;
                    &lt;key&gt;php.maxchildren&lt;/key&gt;
                    &lt;delay&gt;15&lt;/delay&gt;
                    &lt;history&gt;90&lt;/history&gt;
                    &lt;trends&gt;365&lt;/trends&gt;
                    &lt;status&gt;0&lt;/status&gt;
                    &lt;value_type&gt;3&lt;/value_type&gt;
                    &lt;allowed_hosts&gt;&lt;/allowed_hosts&gt;
                    &lt;units&gt;&lt;/units&gt;
                    &lt;delta&gt;0&lt;/delta&gt;
                    &lt;snmpv3_securityname&gt;&lt;/snmpv3_securityname&gt;
                    &lt;snmpv3_securitylevel&gt;0&lt;/snmpv3_securitylevel&gt;
                    &lt;snmpv3_authpassphrase&gt;&lt;/snmpv3_authpassphrase&gt;
                    &lt;snmpv3_privpassphrase&gt;&lt;/snmpv3_privpassphrase&gt;
                    &lt;formula&gt;1&lt;/formula&gt;
                    &lt;delay_flex&gt;&lt;/delay_flex&gt;
                    &lt;params&gt;&lt;/params&gt;
                    &lt;ipmi_sensor&gt;&lt;/ipmi_sensor&gt;
                    &lt;data_type&gt;0&lt;/data_type&gt;
                    &lt;authtype&gt;0&lt;/authtype&gt;
                    &lt;username&gt;&lt;/username&gt;
                    &lt;password&gt;&lt;/password&gt;
                    &lt;publickey&gt;&lt;/publickey&gt;
                    &lt;privatekey&gt;&lt;/privatekey&gt;
                    &lt;port&gt;&lt;/port&gt;
                    &lt;description&gt;&lt;/description&gt;
                    &lt;inventory_link&gt;0&lt;/inventory_link&gt;
                    &lt;applications&gt;
                        &lt;application&gt;
                            &lt;name&gt;PHP FPM&lt;/name&gt;
                        &lt;/application&gt;
                    &lt;/applications&gt;
                    &lt;valuemap/&gt;
                &lt;/item&gt;
                &lt;item&gt;
                    &lt;name&gt;PHP - number of total accepted connections&lt;/name&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;snmp_community&gt;&lt;/snmp_community&gt;
                    &lt;multiplier&gt;0&lt;/multiplier&gt;
                    &lt;snmp_oid&gt;&lt;/snmp_oid&gt;
                    &lt;key&gt;php.conn&lt;/key&gt;
                    &lt;delay&gt;15&lt;/delay&gt;
                    &lt;history&gt;90&lt;/history&gt;
                    &lt;trends&gt;365&lt;/trends&gt;
                    &lt;status&gt;0&lt;/status&gt;
                    &lt;value_type&gt;3&lt;/value_type&gt;
                    &lt;allowed_hosts&gt;&lt;/allowed_hosts&gt;
                    &lt;units&gt;&lt;/units&gt;
                    &lt;delta&gt;0&lt;/delta&gt;
                    &lt;snmpv3_securityname&gt;&lt;/snmpv3_securityname&gt;
                    &lt;snmpv3_securitylevel&gt;0&lt;/snmpv3_securitylevel&gt;
                    &lt;snmpv3_authpassphrase&gt;&lt;/snmpv3_authpassphrase&gt;
                    &lt;snmpv3_privpassphrase&gt;&lt;/snmpv3_privpassphrase&gt;
                    &lt;formula&gt;1&lt;/formula&gt;
                    &lt;delay_flex&gt;&lt;/delay_flex&gt;
                    &lt;params&gt;&lt;/params&gt;
                    &lt;ipmi_sensor&gt;&lt;/ipmi_sensor&gt;
                    &lt;data_type&gt;0&lt;/data_type&gt;
                    &lt;authtype&gt;0&lt;/authtype&gt;
                    &lt;username&gt;&lt;/username&gt;
                    &lt;password&gt;&lt;/password&gt;
                    &lt;publickey&gt;&lt;/publickey&gt;
                    &lt;privatekey&gt;&lt;/privatekey&gt;
                    &lt;port&gt;&lt;/port&gt;
                    &lt;description&gt;&lt;/description&gt;
                    &lt;inventory_link&gt;0&lt;/inventory_link&gt;
                    &lt;applications&gt;
                        &lt;application&gt;
                            &lt;name&gt;PHP FPM&lt;/name&gt;
                        &lt;/application&gt;
                    &lt;/applications&gt;
                    &lt;valuemap/&gt;
                &lt;/item&gt;
                &lt;item&gt;
                    &lt;name&gt;PHP - number of total processes&lt;/name&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;snmp_community&gt;&lt;/snmp_community&gt;
                    &lt;multiplier&gt;0&lt;/multiplier&gt;
                    &lt;snmp_oid&gt;&lt;/snmp_oid&gt;
                    &lt;key&gt;php.total&lt;/key&gt;
                    &lt;delay&gt;15&lt;/delay&gt;
                    &lt;history&gt;90&lt;/history&gt;
                    &lt;trends&gt;365&lt;/trends&gt;
                    &lt;status&gt;0&lt;/status&gt;
                    &lt;value_type&gt;3&lt;/value_type&gt;
                    &lt;allowed_hosts&gt;&lt;/allowed_hosts&gt;
                    &lt;units&gt;&lt;/units&gt;
                    &lt;delta&gt;0&lt;/delta&gt;
                    &lt;snmpv3_securityname&gt;&lt;/snmpv3_securityname&gt;
                    &lt;snmpv3_securitylevel&gt;0&lt;/snmpv3_securitylevel&gt;
                    &lt;snmpv3_authpassphrase&gt;&lt;/snmpv3_authpassphrase&gt;
                    &lt;snmpv3_privpassphrase&gt;&lt;/snmpv3_privpassphrase&gt;
                    &lt;formula&gt;1&lt;/formula&gt;
                    &lt;delay_flex&gt;&lt;/delay_flex&gt;
                    &lt;params&gt;&lt;/params&gt;
                    &lt;ipmi_sensor&gt;&lt;/ipmi_sensor&gt;
                    &lt;data_type&gt;0&lt;/data_type&gt;
                    &lt;authtype&gt;0&lt;/authtype&gt;
                    &lt;username&gt;&lt;/username&gt;
                    &lt;password&gt;&lt;/password&gt;
                    &lt;publickey&gt;&lt;/publickey&gt;
                    &lt;privatekey&gt;&lt;/privatekey&gt;
                    &lt;port&gt;&lt;/port&gt;
                    &lt;description&gt;&lt;/description&gt;
                    &lt;inventory_link&gt;0&lt;/inventory_link&gt;
                    &lt;applications&gt;
                        &lt;application&gt;
                            &lt;name&gt;PHP FPM&lt;/name&gt;
                        &lt;/application&gt;
                    &lt;/applications&gt;
                    &lt;valuemap/&gt;
                &lt;/item&gt;
            &lt;/items&gt;
            &lt;discovery_rules/&gt;
            &lt;macros/&gt;
            &lt;templates/&gt;
            &lt;screens/&gt;
        &lt;/template&gt;
    &lt;/templates&gt;
    &lt;graphs&gt;
        &lt;graph&gt;
            &lt;name&gt;PHP FPM Scoreboard&lt;/name&gt;
            &lt;width&gt;900&lt;/width&gt;
            &lt;height&gt;200&lt;/height&gt;
            &lt;yaxismin&gt;0.0000&lt;/yaxismin&gt;
            &lt;yaxismax&gt;100.0000&lt;/yaxismax&gt;
            &lt;show_work_period&gt;0&lt;/show_work_period&gt;
            &lt;show_triggers&gt;0&lt;/show_triggers&gt;
            &lt;type&gt;0&lt;/type&gt;
            &lt;show_legend&gt;1&lt;/show_legend&gt;
            &lt;show_3d&gt;0&lt;/show_3d&gt;
            &lt;percent_left&gt;0.0000&lt;/percent_left&gt;
            &lt;percent_right&gt;0.0000&lt;/percent_right&gt;
            &lt;ymin_type_1&gt;1&lt;/ymin_type_1&gt;
            &lt;ymax_type_1&gt;0&lt;/ymax_type_1&gt;
            &lt;ymin_item_1&gt;0&lt;/ymin_item_1&gt;
            &lt;ymax_item_1&gt;0&lt;/ymax_item_1&gt;
            &lt;graph_items&gt;
                &lt;graph_item&gt;
                    &lt;sortorder&gt;0&lt;/sortorder&gt;
                    &lt;drawtype&gt;1&lt;/drawtype&gt;
                    &lt;color&gt;009900&lt;/color&gt;
                    &lt;yaxisside&gt;0&lt;/yaxisside&gt;
                    &lt;calc_fnc&gt;2&lt;/calc_fnc&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;item&gt;
                        &lt;host&gt;Template_PHP_FPM&lt;/host&gt;
                        &lt;key&gt;php.conn&lt;/key&gt;
                    &lt;/item&gt;
                &lt;/graph_item&gt;
                &lt;graph_item&gt;
                    &lt;sortorder&gt;1&lt;/sortorder&gt;
                    &lt;drawtype&gt;5&lt;/drawtype&gt;
                    &lt;color&gt;888800&lt;/color&gt;
                    &lt;yaxisside&gt;0&lt;/yaxisside&gt;
                    &lt;calc_fnc&gt;2&lt;/calc_fnc&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;item&gt;
                        &lt;host&gt;Template_PHP_FPM&lt;/host&gt;
                        &lt;key&gt;php.total&lt;/key&gt;
                    &lt;/item&gt;
                &lt;/graph_item&gt;
                &lt;graph_item&gt;
                    &lt;sortorder&gt;2&lt;/sortorder&gt;
                    &lt;drawtype&gt;5&lt;/drawtype&gt;
                    &lt;color&gt;FFA500&lt;/color&gt;
                    &lt;yaxisside&gt;0&lt;/yaxisside&gt;
                    &lt;calc_fnc&gt;2&lt;/calc_fnc&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;item&gt;
                        &lt;host&gt;Template_PHP_FPM&lt;/host&gt;
                        &lt;key&gt;php.idle&lt;/key&gt;
                    &lt;/item&gt;
                &lt;/graph_item&gt;
                &lt;graph_item&gt;
                    &lt;sortorder&gt;3&lt;/sortorder&gt;
                    &lt;drawtype&gt;5&lt;/drawtype&gt;
                    &lt;color&gt;EEEE00&lt;/color&gt;
                    &lt;yaxisside&gt;0&lt;/yaxisside&gt;
                    &lt;calc_fnc&gt;2&lt;/calc_fnc&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;item&gt;
                        &lt;host&gt;Template_PHP_FPM&lt;/host&gt;
                        &lt;key&gt;php.active&lt;/key&gt;
                    &lt;/item&gt;
                &lt;/graph_item&gt;
                &lt;graph_item&gt;
                    &lt;sortorder&gt;4&lt;/sortorder&gt;
                    &lt;drawtype&gt;5&lt;/drawtype&gt;
                    &lt;color&gt;DD0000&lt;/color&gt;
                    &lt;yaxisside&gt;0&lt;/yaxisside&gt;
                    &lt;calc_fnc&gt;2&lt;/calc_fnc&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;item&gt;
                        &lt;host&gt;Template_PHP_FPM&lt;/host&gt;
                        &lt;key&gt;php.maxchildren&lt;/key&gt;
                    &lt;/item&gt;
                &lt;/graph_item&gt;
            &lt;/graph_items&gt;
        &lt;/graph&gt;
    &lt;/graphs&gt;
&lt;/zabbix_export&gt;
</pre>
<p>nginx-zabbix-template.xml</p>
<pre class="brush: xml">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;zabbix_export&gt;
    &lt;version&gt;2.0&lt;/version&gt;
    &lt;date&gt;2012-12-28T20:29:03Z&lt;/date&gt;
    &lt;groups&gt;
        &lt;group&gt;
            &lt;name&gt;Templates&lt;/name&gt;
        &lt;/group&gt;
    &lt;/groups&gt;
    &lt;templates&gt;
        &lt;template&gt;
            &lt;template&gt;Tpl_Nginx_Monitor&lt;/template&gt;
            &lt;name&gt;Template Nginx Monitor&lt;/name&gt;
            &lt;groups&gt;
                &lt;group&gt;
                    &lt;name&gt;Templates&lt;/name&gt;
                &lt;/group&gt;
            &lt;/groups&gt;
            &lt;applications&gt;
                &lt;application&gt;
                    &lt;name&gt;Nginx&lt;/name&gt;
                &lt;/application&gt;
            &lt;/applications&gt;
            &lt;items&gt;
                &lt;item&gt;
                    &lt;name&gt;Nginx Accepted&lt;/name&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;snmp_community&gt;&lt;/snmp_community&gt;
                    &lt;multiplier&gt;0&lt;/multiplier&gt;
                    &lt;snmp_oid&gt;&lt;/snmp_oid&gt;
                    &lt;key&gt;nginx.accepted[]&lt;/key&gt;
                    &lt;delay&gt;30&lt;/delay&gt;
                    &lt;history&gt;60&lt;/history&gt;
                    &lt;trends&gt;365&lt;/trends&gt;
                    &lt;status&gt;0&lt;/status&gt;
                    &lt;value_type&gt;3&lt;/value_type&gt;
                    &lt;allowed_hosts&gt;&lt;/allowed_hosts&gt;
                    &lt;units&gt;&lt;/units&gt;
                    &lt;delta&gt;0&lt;/delta&gt;
                    &lt;snmpv3_securityname&gt;&lt;/snmpv3_securityname&gt;
                    &lt;snmpv3_securitylevel&gt;0&lt;/snmpv3_securitylevel&gt;
                    &lt;snmpv3_authpassphrase&gt;&lt;/snmpv3_authpassphrase&gt;
                    &lt;snmpv3_privpassphrase&gt;&lt;/snmpv3_privpassphrase&gt;
                    &lt;formula&gt;1&lt;/formula&gt;
                    &lt;delay_flex&gt;&lt;/delay_flex&gt;
                    &lt;params&gt;&lt;/params&gt;
                    &lt;ipmi_sensor&gt;&lt;/ipmi_sensor&gt;
                    &lt;data_type&gt;0&lt;/data_type&gt;
                    &lt;authtype&gt;0&lt;/authtype&gt;
                    &lt;username&gt;&lt;/username&gt;
                    &lt;password&gt;&lt;/password&gt;
                    &lt;publickey&gt;&lt;/publickey&gt;
                    &lt;privatekey&gt;&lt;/privatekey&gt;
                    &lt;port&gt;&lt;/port&gt;
                    &lt;description&gt;&lt;/description&gt;
                    &lt;inventory_link&gt;0&lt;/inventory_link&gt;
                    &lt;applications&gt;
                        &lt;application&gt;
                            &lt;name&gt;Nginx&lt;/name&gt;
                        &lt;/application&gt;
                    &lt;/applications&gt;
                    &lt;valuemap/&gt;
                &lt;/item&gt;
                &lt;item&gt;
                    &lt;name&gt;Nginx Active&lt;/name&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;snmp_community&gt;&lt;/snmp_community&gt;
                    &lt;multiplier&gt;0&lt;/multiplier&gt;
                    &lt;snmp_oid&gt;&lt;/snmp_oid&gt;
                    &lt;key&gt;nginx.active[]&lt;/key&gt;
                    &lt;delay&gt;30&lt;/delay&gt;
                    &lt;history&gt;60&lt;/history&gt;
                    &lt;trends&gt;365&lt;/trends&gt;
                    &lt;status&gt;0&lt;/status&gt;
                    &lt;value_type&gt;3&lt;/value_type&gt;
                    &lt;allowed_hosts&gt;&lt;/allowed_hosts&gt;
                    &lt;units&gt;&lt;/units&gt;
                    &lt;delta&gt;0&lt;/delta&gt;
                    &lt;snmpv3_securityname&gt;&lt;/snmpv3_securityname&gt;
                    &lt;snmpv3_securitylevel&gt;0&lt;/snmpv3_securitylevel&gt;
                    &lt;snmpv3_authpassphrase&gt;&lt;/snmpv3_authpassphrase&gt;
                    &lt;snmpv3_privpassphrase&gt;&lt;/snmpv3_privpassphrase&gt;
                    &lt;formula&gt;1&lt;/formula&gt;
                    &lt;delay_flex&gt;&lt;/delay_flex&gt;
                    &lt;params&gt;&lt;/params&gt;
                    &lt;ipmi_sensor&gt;&lt;/ipmi_sensor&gt;
                    &lt;data_type&gt;0&lt;/data_type&gt;
                    &lt;authtype&gt;0&lt;/authtype&gt;
                    &lt;username&gt;&lt;/username&gt;
                    &lt;password&gt;&lt;/password&gt;
                    &lt;publickey&gt;&lt;/publickey&gt;
                    &lt;privatekey&gt;&lt;/privatekey&gt;
                    &lt;port&gt;&lt;/port&gt;
                    &lt;description&gt;&lt;/description&gt;
                    &lt;inventory_link&gt;0&lt;/inventory_link&gt;
                    &lt;applications&gt;
                        &lt;application&gt;
                            &lt;name&gt;Nginx&lt;/name&gt;
                        &lt;/application&gt;
                    &lt;/applications&gt;
                    &lt;valuemap/&gt;
                &lt;/item&gt;
                &lt;item&gt;
                    &lt;name&gt;Nginx Handled&lt;/name&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;snmp_community&gt;&lt;/snmp_community&gt;
                    &lt;multiplier&gt;0&lt;/multiplier&gt;
                    &lt;snmp_oid&gt;&lt;/snmp_oid&gt;
                    &lt;key&gt;nginx.handled[]&lt;/key&gt;
                    &lt;delay&gt;30&lt;/delay&gt;
                    &lt;history&gt;60&lt;/history&gt;
                    &lt;trends&gt;365&lt;/trends&gt;
                    &lt;status&gt;0&lt;/status&gt;
                    &lt;value_type&gt;3&lt;/value_type&gt;
                    &lt;allowed_hosts&gt;&lt;/allowed_hosts&gt;
                    &lt;units&gt;&lt;/units&gt;
                    &lt;delta&gt;0&lt;/delta&gt;
                    &lt;snmpv3_securityname&gt;&lt;/snmpv3_securityname&gt;
                    &lt;snmpv3_securitylevel&gt;0&lt;/snmpv3_securitylevel&gt;
                    &lt;snmpv3_authpassphrase&gt;&lt;/snmpv3_authpassphrase&gt;
                    &lt;snmpv3_privpassphrase&gt;&lt;/snmpv3_privpassphrase&gt;
                    &lt;formula&gt;1&lt;/formula&gt;
                    &lt;delay_flex&gt;&lt;/delay_flex&gt;
                    &lt;params&gt;&lt;/params&gt;
                    &lt;ipmi_sensor&gt;&lt;/ipmi_sensor&gt;
                    &lt;data_type&gt;0&lt;/data_type&gt;
                    &lt;authtype&gt;0&lt;/authtype&gt;
                    &lt;username&gt;&lt;/username&gt;
                    &lt;password&gt;&lt;/password&gt;
                    &lt;publickey&gt;&lt;/publickey&gt;
                    &lt;privatekey&gt;&lt;/privatekey&gt;
                    &lt;port&gt;&lt;/port&gt;
                    &lt;description&gt;&lt;/description&gt;
                    &lt;inventory_link&gt;0&lt;/inventory_link&gt;
                    &lt;applications&gt;
                        &lt;application&gt;
                            &lt;name&gt;Nginx&lt;/name&gt;
                        &lt;/application&gt;
                    &lt;/applications&gt;
                    &lt;valuemap/&gt;
                &lt;/item&gt;
                &lt;item&gt;
                    &lt;name&gt;Nginx Reading&lt;/name&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;snmp_community&gt;&lt;/snmp_community&gt;
                    &lt;multiplier&gt;0&lt;/multiplier&gt;
                    &lt;snmp_oid&gt;&lt;/snmp_oid&gt;
                    &lt;key&gt;nginx.reading[]&lt;/key&gt;
                    &lt;delay&gt;30&lt;/delay&gt;
                    &lt;history&gt;60&lt;/history&gt;
                    &lt;trends&gt;365&lt;/trends&gt;
                    &lt;status&gt;0&lt;/status&gt;
                    &lt;value_type&gt;3&lt;/value_type&gt;
                    &lt;allowed_hosts&gt;&lt;/allowed_hosts&gt;
                    &lt;units&gt;&lt;/units&gt;
                    &lt;delta&gt;0&lt;/delta&gt;
                    &lt;snmpv3_securityname&gt;&lt;/snmpv3_securityname&gt;
                    &lt;snmpv3_securitylevel&gt;0&lt;/snmpv3_securitylevel&gt;
                    &lt;snmpv3_authpassphrase&gt;&lt;/snmpv3_authpassphrase&gt;
                    &lt;snmpv3_privpassphrase&gt;&lt;/snmpv3_privpassphrase&gt;
                    &lt;formula&gt;1&lt;/formula&gt;
                    &lt;delay_flex&gt;&lt;/delay_flex&gt;
                    &lt;params&gt;&lt;/params&gt;
                    &lt;ipmi_sensor&gt;&lt;/ipmi_sensor&gt;
                    &lt;data_type&gt;0&lt;/data_type&gt;
                    &lt;authtype&gt;0&lt;/authtype&gt;
                    &lt;username&gt;&lt;/username&gt;
                    &lt;password&gt;&lt;/password&gt;
                    &lt;publickey&gt;&lt;/publickey&gt;
                    &lt;privatekey&gt;&lt;/privatekey&gt;
                    &lt;port&gt;&lt;/port&gt;
                    &lt;description&gt;&lt;/description&gt;
                    &lt;inventory_link&gt;0&lt;/inventory_link&gt;
                    &lt;applications&gt;
                        &lt;application&gt;
                            &lt;name&gt;Nginx&lt;/name&gt;
                        &lt;/application&gt;
                    &lt;/applications&gt;
                    &lt;valuemap/&gt;
                &lt;/item&gt;
                &lt;item&gt;
                    &lt;name&gt;Nginx Requests&lt;/name&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;snmp_community&gt;&lt;/snmp_community&gt;
                    &lt;multiplier&gt;0&lt;/multiplier&gt;
                    &lt;snmp_oid&gt;&lt;/snmp_oid&gt;
                    &lt;key&gt;nginx.requests[]&lt;/key&gt;
                    &lt;delay&gt;30&lt;/delay&gt;
                    &lt;history&gt;60&lt;/history&gt;
                    &lt;trends&gt;365&lt;/trends&gt;
                    &lt;status&gt;0&lt;/status&gt;
                    &lt;value_type&gt;3&lt;/value_type&gt;
                    &lt;allowed_hosts&gt;&lt;/allowed_hosts&gt;
                    &lt;units&gt;&lt;/units&gt;
                    &lt;delta&gt;0&lt;/delta&gt;
                    &lt;snmpv3_securityname&gt;&lt;/snmpv3_securityname&gt;
                    &lt;snmpv3_securitylevel&gt;0&lt;/snmpv3_securitylevel&gt;
                    &lt;snmpv3_authpassphrase&gt;&lt;/snmpv3_authpassphrase&gt;
                    &lt;snmpv3_privpassphrase&gt;&lt;/snmpv3_privpassphrase&gt;
                    &lt;formula&gt;1&lt;/formula&gt;
                    &lt;delay_flex&gt;&lt;/delay_flex&gt;
                    &lt;params&gt;&lt;/params&gt;
                    &lt;ipmi_sensor&gt;&lt;/ipmi_sensor&gt;
                    &lt;data_type&gt;0&lt;/data_type&gt;
                    &lt;authtype&gt;0&lt;/authtype&gt;
                    &lt;username&gt;&lt;/username&gt;
                    &lt;password&gt;&lt;/password&gt;
                    &lt;publickey&gt;&lt;/publickey&gt;
                    &lt;privatekey&gt;&lt;/privatekey&gt;
                    &lt;port&gt;&lt;/port&gt;
                    &lt;description&gt;&lt;/description&gt;
                    &lt;inventory_link&gt;0&lt;/inventory_link&gt;
                    &lt;applications&gt;
                        &lt;application&gt;
                            &lt;name&gt;Nginx&lt;/name&gt;
                        &lt;/application&gt;
                    &lt;/applications&gt;
                    &lt;valuemap/&gt;
                &lt;/item&gt;
                &lt;item&gt;
                    &lt;name&gt;Nginx Waiting&lt;/name&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;snmp_community&gt;&lt;/snmp_community&gt;
                    &lt;multiplier&gt;0&lt;/multiplier&gt;
                    &lt;snmp_oid&gt;&lt;/snmp_oid&gt;
                    &lt;key&gt;nginx.waiting[]&lt;/key&gt;
                    &lt;delay&gt;30&lt;/delay&gt;
                    &lt;history&gt;60&lt;/history&gt;
                    &lt;trends&gt;365&lt;/trends&gt;
                    &lt;status&gt;0&lt;/status&gt;
                    &lt;value_type&gt;3&lt;/value_type&gt;
                    &lt;allowed_hosts&gt;&lt;/allowed_hosts&gt;
                    &lt;units&gt;&lt;/units&gt;
                    &lt;delta&gt;0&lt;/delta&gt;
                    &lt;snmpv3_securityname&gt;&lt;/snmpv3_securityname&gt;
                    &lt;snmpv3_securitylevel&gt;0&lt;/snmpv3_securitylevel&gt;
                    &lt;snmpv3_authpassphrase&gt;&lt;/snmpv3_authpassphrase&gt;
                    &lt;snmpv3_privpassphrase&gt;&lt;/snmpv3_privpassphrase&gt;
                    &lt;formula&gt;1&lt;/formula&gt;
                    &lt;delay_flex&gt;&lt;/delay_flex&gt;
                    &lt;params&gt;&lt;/params&gt;
                    &lt;ipmi_sensor&gt;&lt;/ipmi_sensor&gt;
                    &lt;data_type&gt;0&lt;/data_type&gt;
                    &lt;authtype&gt;0&lt;/authtype&gt;
                    &lt;username&gt;&lt;/username&gt;
                    &lt;password&gt;&lt;/password&gt;
                    &lt;publickey&gt;&lt;/publickey&gt;
                    &lt;privatekey&gt;&lt;/privatekey&gt;
                    &lt;port&gt;&lt;/port&gt;
                    &lt;description&gt;&lt;/description&gt;
                    &lt;inventory_link&gt;0&lt;/inventory_link&gt;
                    &lt;applications&gt;
                        &lt;application&gt;
                            &lt;name&gt;Nginx&lt;/name&gt;
                        &lt;/application&gt;
                    &lt;/applications&gt;
                    &lt;valuemap/&gt;
                &lt;/item&gt;
                &lt;item&gt;
                    &lt;name&gt;Nginx Writing&lt;/name&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;snmp_community&gt;&lt;/snmp_community&gt;
                    &lt;multiplier&gt;0&lt;/multiplier&gt;
                    &lt;snmp_oid&gt;&lt;/snmp_oid&gt;
                    &lt;key&gt;nginx.writing[]&lt;/key&gt;
                    &lt;delay&gt;30&lt;/delay&gt;
                    &lt;history&gt;60&lt;/history&gt;
                    &lt;trends&gt;365&lt;/trends&gt;
                    &lt;status&gt;0&lt;/status&gt;
                    &lt;value_type&gt;3&lt;/value_type&gt;
                    &lt;allowed_hosts&gt;&lt;/allowed_hosts&gt;
                    &lt;units&gt;&lt;/units&gt;
                    &lt;delta&gt;0&lt;/delta&gt;
                    &lt;snmpv3_securityname&gt;&lt;/snmpv3_securityname&gt;
                    &lt;snmpv3_securitylevel&gt;0&lt;/snmpv3_securitylevel&gt;
                    &lt;snmpv3_authpassphrase&gt;&lt;/snmpv3_authpassphrase&gt;
                    &lt;snmpv3_privpassphrase&gt;&lt;/snmpv3_privpassphrase&gt;
                    &lt;formula&gt;1&lt;/formula&gt;
                    &lt;delay_flex&gt;&lt;/delay_flex&gt;
                    &lt;params&gt;&lt;/params&gt;
                    &lt;ipmi_sensor&gt;&lt;/ipmi_sensor&gt;
                    &lt;data_type&gt;0&lt;/data_type&gt;
                    &lt;authtype&gt;0&lt;/authtype&gt;
                    &lt;username&gt;&lt;/username&gt;
                    &lt;password&gt;&lt;/password&gt;
                    &lt;publickey&gt;&lt;/publickey&gt;
                    &lt;privatekey&gt;&lt;/privatekey&gt;
                    &lt;port&gt;&lt;/port&gt;
                    &lt;description&gt;&lt;/description&gt;
                    &lt;inventory_link&gt;0&lt;/inventory_link&gt;
                    &lt;applications&gt;
                        &lt;application&gt;
                            &lt;name&gt;Nginx&lt;/name&gt;
                        &lt;/application&gt;
                    &lt;/applications&gt;
                    &lt;valuemap/&gt;
                &lt;/item&gt;
            &lt;/items&gt;
            &lt;discovery_rules/&gt;
            &lt;macros/&gt;
            &lt;templates/&gt;
            &lt;screens/&gt;
        &lt;/template&gt;
    &lt;/templates&gt;
    &lt;graphs&gt;
        &lt;graph&gt;
            &lt;name&gt;Nginx Scoreboard&lt;/name&gt;
            &lt;width&gt;900&lt;/width&gt;
            &lt;height&gt;200&lt;/height&gt;
            &lt;yaxismin&gt;0.0000&lt;/yaxismin&gt;
            &lt;yaxismax&gt;100.0000&lt;/yaxismax&gt;
            &lt;show_work_period&gt;1&lt;/show_work_period&gt;
            &lt;show_triggers&gt;0&lt;/show_triggers&gt;
            &lt;type&gt;0&lt;/type&gt;
            &lt;show_legend&gt;1&lt;/show_legend&gt;
            &lt;show_3d&gt;0&lt;/show_3d&gt;
            &lt;percent_left&gt;0.0000&lt;/percent_left&gt;
            &lt;percent_right&gt;0.0000&lt;/percent_right&gt;
            &lt;ymin_type_1&gt;0&lt;/ymin_type_1&gt;
            &lt;ymax_type_1&gt;0&lt;/ymax_type_1&gt;
            &lt;ymin_item_1&gt;0&lt;/ymin_item_1&gt;
            &lt;ymax_item_1&gt;0&lt;/ymax_item_1&gt;
            &lt;graph_items&gt;
                &lt;graph_item&gt;
                    &lt;sortorder&gt;0&lt;/sortorder&gt;
                    &lt;drawtype&gt;5&lt;/drawtype&gt;
                    &lt;color&gt;555555&lt;/color&gt;
                    &lt;yaxisside&gt;0&lt;/yaxisside&gt;
                    &lt;calc_fnc&gt;2&lt;/calc_fnc&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;item&gt;
                        &lt;host&gt;Tpl_Nginx_Monitor&lt;/host&gt;
                        &lt;key&gt;nginx.requests[]&lt;/key&gt;
                    &lt;/item&gt;
                &lt;/graph_item&gt;
                &lt;graph_item&gt;
                    &lt;sortorder&gt;1&lt;/sortorder&gt;
                    &lt;drawtype&gt;5&lt;/drawtype&gt;
                    &lt;color&gt;CCFFFF&lt;/color&gt;
                    &lt;yaxisside&gt;0&lt;/yaxisside&gt;
                    &lt;calc_fnc&gt;2&lt;/calc_fnc&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;item&gt;
                        &lt;host&gt;Tpl_Nginx_Monitor&lt;/host&gt;
                        &lt;key&gt;nginx.handled[]&lt;/key&gt;
                    &lt;/item&gt;
                &lt;/graph_item&gt;
                &lt;graph_item&gt;
                    &lt;sortorder&gt;2&lt;/sortorder&gt;
                    &lt;drawtype&gt;1&lt;/drawtype&gt;
                    &lt;color&gt;009900&lt;/color&gt;
                    &lt;yaxisside&gt;0&lt;/yaxisside&gt;
                    &lt;calc_fnc&gt;2&lt;/calc_fnc&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;item&gt;
                        &lt;host&gt;Tpl_Nginx_Monitor&lt;/host&gt;
                        &lt;key&gt;nginx.accepted[]&lt;/key&gt;
                    &lt;/item&gt;
                &lt;/graph_item&gt;
                &lt;graph_item&gt;
                    &lt;sortorder&gt;3&lt;/sortorder&gt;
                    &lt;drawtype&gt;1&lt;/drawtype&gt;
                    &lt;color&gt;CCCCCC&lt;/color&gt;
                    &lt;yaxisside&gt;0&lt;/yaxisside&gt;
                    &lt;calc_fnc&gt;2&lt;/calc_fnc&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;item&gt;
                        &lt;host&gt;Tpl_Nginx_Monitor&lt;/host&gt;
                        &lt;key&gt;nginx.active[]&lt;/key&gt;
                    &lt;/item&gt;
                &lt;/graph_item&gt;
                &lt;graph_item&gt;
                    &lt;sortorder&gt;4&lt;/sortorder&gt;
                    &lt;drawtype&gt;1&lt;/drawtype&gt;
                    &lt;color&gt;FFA500&lt;/color&gt;
                    &lt;yaxisside&gt;0&lt;/yaxisside&gt;
                    &lt;calc_fnc&gt;2&lt;/calc_fnc&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;item&gt;
                        &lt;host&gt;Tpl_Nginx_Monitor&lt;/host&gt;
                        &lt;key&gt;nginx.writing[]&lt;/key&gt;
                    &lt;/item&gt;
                &lt;/graph_item&gt;
                &lt;graph_item&gt;
                    &lt;sortorder&gt;5&lt;/sortorder&gt;
                    &lt;drawtype&gt;1&lt;/drawtype&gt;
                    &lt;color&gt;EEEE00&lt;/color&gt;
                    &lt;yaxisside&gt;0&lt;/yaxisside&gt;
                    &lt;calc_fnc&gt;2&lt;/calc_fnc&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;item&gt;
                        &lt;host&gt;Tpl_Nginx_Monitor&lt;/host&gt;
                        &lt;key&gt;nginx.reading[]&lt;/key&gt;
                    &lt;/item&gt;
                &lt;/graph_item&gt;
                &lt;graph_item&gt;
                    &lt;sortorder&gt;6&lt;/sortorder&gt;
                    &lt;drawtype&gt;1&lt;/drawtype&gt;
                    &lt;color&gt;DD0000&lt;/color&gt;
                    &lt;yaxisside&gt;0&lt;/yaxisside&gt;
                    &lt;calc_fnc&gt;2&lt;/calc_fnc&gt;
                    &lt;type&gt;0&lt;/type&gt;
                    &lt;item&gt;
                        &lt;host&gt;Tpl_Nginx_Monitor&lt;/host&gt;
                        &lt;key&gt;nginx.waiting[]&lt;/key&gt;
                    &lt;/item&gt;
                &lt;/graph_item&gt;
            &lt;/graph_items&gt;
        &lt;/graph&gt;
    &lt;/graphs&gt;
&lt;/zabbix_export&gt;
</pre>
<p>That&#8217;s it, now you will be able to monitor both nginx and php-fpm from zabbix, just remember to import both templates above into your zabbix server and apply them to each of the servers you&#8217;d like to monitor. Thanks for stopping by once again and remember, share with others, after all, code should be free.<img src="http://www.foscode.com/wp-content/uploads/2010/04/foscode_logo_sm.png" alt="foscode.com | because code should be free" title="FOSCODE" width="227" height="18" class="alignright size-full wp-image-221" /></p>
<p>The post <a href="http://www.foscode.com/monitor-phpfpm-nginx-zabbix/">How To Monitor PHP-FPM and Nginx With Zabbix</a> appeared first on <a href="http://www.foscode.com">foscode</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.foscode.com/monitor-phpfpm-nginx-zabbix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSON Array Single MySQL Insert and Update</title>
		<link>http://www.foscode.com/json-array-single-mysql-insert-update/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=json-array-single-mysql-insert-update</link>
		<comments>http://www.foscode.com/json-array-single-mysql-insert-update/#comments</comments>
		<pubDate>Tue, 18 Dec 2012 02:47:52 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.foscode.com/?p=1001</guid>
		<description><![CDATA[<p>This is another quick one. I wanted to insert a JSON array into MySQL with a single insert and, on duplicate key update. This is how you get it done:
Say you have a JSON array like this:

[{&#34;num&#34;:&#34;222&#34;,&#34;desc&#34;:&#34;seconds&#34;,&#34;freq&#34;:11,&#34;type&#34;:&#34;hour&#34;,&#34;active&#34;:false},{&#34;num&#34;:&#34;1234&#34;,&#34;desc&#34;:&#34;forths&#34;,&#34;freq&#34;:22,&#34;type&#34;:&#34;day&#34;,&#34;active&#34;:false},{&#34;num&#34;:&#34;3333&#34;,&#34;desc&#34;:&#34;thirds&#34;,&#34;freq&#34;:33,&#34;type&#34;:&#34;week&#34;,&#34;active&#34;:true}]


And you want to &#8230; <a href="http://www.foscode.com/json-array-single-mysql-insert-update/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://www.foscode.com/json-array-single-mysql-insert-update/">JSON Array Single MySQL Insert and Update</a> appeared first on <a href="http://www.foscode.com">foscode</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>This is another quick one. I wanted to insert a JSON array into MySQL with a single insert and, on duplicate key update. This is how you get it done:</p>
<p>Say you have a JSON array like this:</p>
<pre class="brush: php">
[{&quot;num&quot;:&quot;222&quot;,&quot;desc&quot;:&quot;seconds&quot;,&quot;freq&quot;:11,&quot;type&quot;:&quot;hour&quot;,&quot;active&quot;:false},{&quot;num&quot;:&quot;1234&quot;,&quot;desc&quot;:&quot;forths&quot;,&quot;freq&quot;:22,&quot;type&quot;:&quot;day&quot;,&quot;active&quot;:false},{&quot;num&quot;:&quot;3333&quot;,&quot;desc&quot;:&quot;thirds&quot;,&quot;freq&quot;:33,&quot;type&quot;:&quot;week&quot;,&quot;active&quot;:true}]
</pre>
<p><span id="more-1001"></span></p>
<p>And you want to insert all 3 records into MySQL with only 1 single insert, and at the<br />
same time, you also want to do ON DUPLICATE KEY UPDATE:</p>
<pre class="brush: php">
//First decode the array 
$arr = $_POST[&#039;jsonarr&#039;];
$decarr = json_decode($arr, true);
  
$count = count($decarr);

$values = array(); // This will hold our array values so we do one single insert 
$update_values = array(); // This will hold the values for the ON DUPLICATE KEY UPDATE section

for ($x=0; $x &lt; $count; $x++) 
    {
	
    $newrec = $decarr[$x];  
    $num = $newrec[&#039;num&#039;]; $num = mysql_real_escape_string($num);
    $desc = $newrec[&#039;desc&#039;]; $desc = mysql_real_escape_string($desc);
    $freq = $newrec[&#039;freq&#039;]; $freq = mysql_real_escape_string($freq);
    $type = $newrec[&#039;type&#039;]; $type = mysql_real_escape_string($type);
    $active = $newrec[&#039;active&#039;]; $active = mysql_real_escape_string($active);
	
	
    // Create insert array 
    $values[] = &quot;(&#039;&quot;.$num.&quot;&#039;, &#039;&quot;.$desc.&quot;&#039;, &#039;&quot;.$freq.&quot;&#039;, &#039;&quot;.$type.&quot;&#039;, &#039;&quot;.$active.&quot;&#039;)&quot;;	
	
    // This is used for the on duplicate update
    $update_values[] = &quot;desc=VALUES(desc),freq=VALUES(freq),type=VALUES(type),active=VALUES(active)&quot;;     
		
    }
    
// Insert the records    
    
$sql = &quot;INSERT INTO tbl_tablename (num, desc, freq, type, active)
 VALUES &quot;.implode(&#039;,&#039;, $values).&quot; ON DUPLICATE KEY UPDATE &quot;.implode(&#039;, &#039;, $update_values);

$result = mysql_query($sql, $conn);  
</pre>
<p>And that&#8217;s it, there you have it. Thanks for stopping by once again and remember, share with others, after all, code should be free.<img src="http://www.foscode.com/wp-content/uploads/2010/04/foscode_logo_sm.png" alt="foscode.com | because code should be free" title="FOSCODE" width="227" height="18" class="alignright size-full wp-image-221" />   </p>
<p>The post <a href="http://www.foscode.com/json-array-single-mysql-insert-update/">JSON Array Single MySQL Insert and Update</a> appeared first on <a href="http://www.foscode.com">foscode</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.foscode.com/json-array-single-mysql-insert-update/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Distributed JMeter Testing Via SSH</title>
		<link>http://www.foscode.com/distributed-jmeter-testing-ssh/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=distributed-jmeter-testing-ssh</link>
		<comments>http://www.foscode.com/distributed-jmeter-testing-ssh/#comments</comments>
		<pubDate>Fri, 14 Dec 2012 03:24:52 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[JMeter]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Load Test]]></category>

		<guid isPermaLink="false">http://www.foscode.com/?p=997</guid>
		<description><![CDATA[<p>

JMeter is an open source application written in Java, developed by the folks from The Apache Software Foundation, which allows one to perform load tests against their webservers.
JMeter allows you to run tests from you workstation against your servers, but &#8230; <a href="http://www.foscode.com/distributed-jmeter-testing-ssh/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://www.foscode.com/distributed-jmeter-testing-ssh/">Distributed JMeter Testing Via SSH</a> appeared first on <a href="http://www.foscode.com">foscode</a>.</p>]]></description>
			<content:encoded><![CDATA[<div align="center">

<a href='http://www.foscode.com/?attachment_id=995' title='JMeter'><img width="150" height="102" src="http://www.foscode.com/wp-content/uploads/2012/12/jmeterlogo-150x102.jpg" class="attachment-thumbnail" alt="JMeter" title="JMeter" /></a>

</div>
<p>JMeter is an open source application written in Java, developed by the folks from The Apache Software Foundation, which allows one to perform load tests against their webservers.<br />
JMeter allows you to run tests from you workstation against your servers, but you can also setup virtual test servers that would allow you to run a heavier load.<br />
If you run JMeter from your machine, you&#8217;ll probably end up consuming tons of cpu and memory, depending on how large your tests are, so, to avoid that, you can seetup your workstation as a JMeter MASTER and any number of virtual machines as JMeter SLAVES, which you will be able to control from your workstation. This setup is called Distributed JMeter Testing and that is what I&#8217;ll walk you through in this tutorial.</p>
<p><span id="more-997"></span></p>
<p>The first step is to go ahead and download the latest JMeter, keep in mind that it has been advised the same version of JMeter must be installed on your workstation (MASTER) and all your virtual machines (SLAVE). Ok, with that out of the way, from your workstation (I&#8217;m assuming Linux here, sorry, I don&#8217;t work with Microsoft products nor am planning on doing it anytime soon in this lifetime). </p>
<p>For the purposes of this tutorial, MASTER is your workstation and SLAVE is your virtual server.</p>
<p>MASTER:</p>
<p>1. Download the app and extract it.</p>
<pre class="brush: bash">
cd /opt/
wget http://www.trieuvan.com/apache/jmeter/binaries/apache-jmeter-2.8.tgz
tar xzvf apache-jmeter-2.8.tgz
</pre>
<p>Now we&#8217;ll edit the configuration file  /opt/apache-jmeter-2.8/bin/jmeter.properties</p>
<p>First comment out the line below:</p>
<pre class="brush: bash">
vim  /opt/apache-jmeter-2.8/bin/jmeter.properties
#remote_hosts=127.0.0.1
</pre>
<p>Continue editing the same file and add your virtual servers (SLAVES) instead (for the purpose of this tutorial, we&#8217;ll be setting up 3 virtual servers, but you can add as many as you&#8217;d like):</p>
<pre class="brush: bash">
remote_hosts=192.168.1.5,192.168.1.6,192.168.1.7
 </pre>
<p>Continue editing the same file and add/change/uncomment the lines below:</p>
<pre class="brush: bash">
client.rmi.localport=33000

mode=Asynch
asynch.batch.queue.size=250
 </pre>
<p>Now we&#8217;ll make some changes to jmeter.sh. Just add the lines below to /opt/apache-jmeter-2.8/bin/jmeter.sh</p>
<pre class="brush: bash">
vim /opt/apache-jmeter-2.8/bin/jmeter.sh

JVM_ARGS=&quot;-Djava.rmi.server.hostname=localhost \ 
-Xms512m -Xmx512m \ 
-XX:NewSize=128m -XX:MaxNewSize=128m \ 
-XX:SurvivorRatio=8 \ 
-XX:MaxTenuringThreshold=2 \ 
-Dsun.rmi.dgc.client.gcInterval=600000 \ 
-XX:PermSize=64m -XX:MaxPermSize=64m \ 
-verbose:gc -XX:+PrintTenuringDistribution&quot;
</pre>
<p>MASTER config is done, all configuration from this point on should be done on your SLAVE servers.</p>
<p>SLAVE</p>
<p>1. Download the app and extract it.</p>
<pre class="brush: bash">
cd /opt/
wget http://www.trieuvan.com/apache/jmeter/binaries/apache-jmeter-2.8.tgz
tar xzvf apache-jmeter-2.8.tgz
</pre>
<p>1. Now we&#8217;ll edit the configuration file  /opt/apache-jmeter-2.8/bin/jmeter.properties</p>
<pre class="brush: bash">
vim /opt/apache-jmeter-2.8/bin/jmeter.properties

server.rmi.localport=30000
</pre>
<p>2. Add the lines below to jmeter-server</p>
<pre class="brush: bash">
vim /opt/apache-jmeter-2.8/bin/jmeter-server

RMI_HOST_DEF=-Djava.rmi.server.hostname=192.168.1.5
</pre>
<p>Follow the steps above for all other SLAVE servers you might have, in this example, we used 3 of them, so follow the steps above 2 more times and remember to change the ip address in step 2 to match that of your virtual server.</p>
<p>Steps below are to be run from your workstation (MASTER)</p>
<p>Now that the JMeter has been installed on all 3 virtual servers, we need to create a ssh tunnel that&#8217;ll allows us to communicate between the MASTER and SLAVES. From your workstation (MASTER) run the following (This needs to be done in separate shells, 1 for each SLAVE and make sure to NOT close the ssh session):</p>
<pre class="brush: bash">
ssh -R 33000:localhost:33000 198.168.1.5
ssh -R 33000:localhost:33000 198.168.1.6
ssh -R 33000:localhost:33000 198.168.1.7
</pre>
<p>Step below to be run from each SLAVE:</p>
<p>Keep all 3 tunnels open and start JMeter on each SLAVE:</p>
<pre class="brush: bash">
/opt/apache-jmeter-2.8/bin/jmeter-server
</pre>
<p>Steps below to be run from your workstation (MASTER):</p>
<p>Now go back to your workstation (MASTER) and start Jmeter:</p>
<pre class="brush: bash">
/opt/apache-jmeter-2.8/bin/jmeter.sh 
</pre>
<p>After JMeter has been started, go to run->Remote Start and you should see your servers listed:</p>
<div align="center">

<a href='http://www.foscode.com/?attachment_id=993' title='JMeter Master'><img width="150" height="150" src="http://www.foscode.com/wp-content/uploads/2012/12/jmeter-150x150.jpg" class="attachment-thumbnail" alt="JMeter Master" title="JMeter Master" /></a>

</div>
<p>That&#8217;s it, you&#8217;ve now setup both Jmeter Master and Slaves so you can start load testing your web servers. Thanks for stopping by once again and remember, share with others, after all, code should be free.<img src="http://www.foscode.com/wp-content/uploads/2010/04/foscode_logo_sm.png" alt="foscode.com | because code should be free" title="FOSCODE" width="227" height="18" class="alignright size-full wp-image-221" /></p>
<p>The post <a href="http://www.foscode.com/distributed-jmeter-testing-ssh/">Distributed JMeter Testing Via SSH</a> appeared first on <a href="http://www.foscode.com">foscode</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.foscode.com/distributed-jmeter-testing-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Setup Linux High Availability</title>
		<link>http://www.foscode.com/setup-linux-high-availability/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=setup-linux-high-availability</link>
		<comments>http://www.foscode.com/setup-linux-high-availability/#comments</comments>
		<pubDate>Tue, 24 Jul 2012 01:22:29 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[failover]]></category>
		<category><![CDATA[highavailability]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[opensource]]></category>

		<guid isPermaLink="false">http://www.foscode.com/?p=985</guid>
		<description><![CDATA[<p>Setup heartbeat to monitor both load balancers, thus allowing for high availability/failover on a linux cluster. <a href="http://www.foscode.com/setup-linux-high-availability/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://www.foscode.com/setup-linux-high-availability/">How To Setup Linux High Availability</a> appeared first on <a href="http://www.foscode.com">foscode</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>To continue from where I&#8217;ve left off on <a href="http://www.foscode.com/howto-setup-load-balancer/" title="Setup Load Balancer" target="_blank">my previous post</a>, this time we&#8217;ll setup heartbeat to monitor both of our load balancers, thus allowing us to have what one may call high availability/ failover, between both our load balancers. This method can be used on any server you wish, you can for example have <a href="http://www.linux-ha.org/wiki/Heartbeat" title="Heartbeat Linux HA" target="_blank">Heartbeat</a> monitor mysql, apache or any other server. In this example, we&#8217;ll set up Heartbeat to monitor our crossroads load balancer. </p>
<div align="center">

<a href='http://www.foscode.com/?attachment_id=983' title='Linux High Availability'><img width="150" height="150" src="http://www.foscode.com/wp-content/uploads/2012/07/lha.png" class="attachment-thumbnail" alt="Linux High Availability" title="Linux High Availability" /></a>

</div>
<p><span id="more-985"></span></p>
<p>Heartbeat is a daemon that provides cluster services to its clients. This allows clients to know about the presence or disappearance of peer processes on other machines and to easily exchange messages and perform other tasks with them.</p>
<p>To setup heartbeat on centOS, just follow these steps (They must be performed on both servers and they are identical, with the exception of the /etc/hosts file), we&#8217;re using a 64bit install, adjust the repository as needed, our 2 servers are shown below along with the virtual ip assigned by Heartbeat (only one server at a time will have the vip assigned):</p>
<p>LoadBalancer01.homenet.com &#8212; 192.168.5.11  vip 192.168.5.10<br />
LoadBalancer02.homenet.com &#8212; 192.168.5.12</p>
<p>1. Add epel repository</p>
<pre class="brush: bash">
bash~# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
</pre>
<p>2. Add pacemaker/clusterlabs repository</p>
<pre class="brush: bash">
bash~# wget -O /etc/yum.repos.d/pacemaker.repo http://clusterlabs.org/rpm/epel-5/clusterlabs.repo
</pre>
<p>3. Install packages</p>
<pre class="brush: bash">
bash~# yum install pacemaker heartbeat resource-agents cluster-glue*
</pre>
<p>** If the install above fails, make sure there aren&#8217;t any i386 packages conflicting. If so, issue the command below and add the line to /etc/yum.conf</p>
<pre class="brush: bash">
bash~# yum erase *.i386 
bash~# vim /etc/yum.conf 

exclude=*.i386 *.i686
</pre>
<p>4. Find out machine hostname</p>
<pre class="brush: bash">
bash~# uname -n
LoadBalancer01.homenet.com
</pre>
<p>*** open udp port 694 on firewall on both machines otherwise this won&#8217;t work*****</p>
<p>5. Create config files in directory below:</p>
<pre class="brush: bash">
bash~# cd /etc/ha.d/
bash~# vim ha.cf

logfacility     local0
deadtime 5
warntime 10
initdead 15
udpport 694
bcast eth0
auto_failback on
node LoadBalancer01.homenet.com
node LoadBalancer02.homenet.com
use_logd yes
</pre>
<pre class="brush: bash">
bash~# vim haresources

LoadBalancer01.homenet.com IPaddr::192.168.5.10
</pre>
<pre class="brush: bash">
bash~# cp /usr/share/doc/heartbeat-3.0.3/authkeys /etc/ha.d/
bash~# vim authkeys

auth 2
#1 crc
2 sha1 somekeyhere

bash~# chmod 600 authkeys
</pre>
<p>6. Create ssh key: use the passphrase used in the authkeys file above when creating the key, in this example it is called &#8220;somekeyhere&#8221; without the quotes. </p>
<pre class="brush: bash">
bash~# ssh-keygen -t dsa

Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):
Enter passphrase (empty for no passphrase): (this should be the passphrase from above --&gt; somekeyhere)
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
40:66:t8:bd:ac:bf:68:38:22:60:d8:9f:18:7d:94:21 
</pre>
<p>7. copy the key to the other server:</p>
<pre class="brush: bash">
bash~# scp .ssh/id_dsa.pub 192.168.5.12:/root/.ssh/authorized_keys
</pre>
<p>8. add entry in /etc/hosts about the other server in case you&#8217;re not using a dns server</p>
<p>9. Start heartbeat:</p>
<pre class="brush: bash">
bash~# service heartbeat start
</pre>
<p>10. Check the virtual ip address has been assigned (eth0:0). Only one of the 2 servers being monitored will have the virtual ip address 192.168.5.10 assigned at a time. This is the whole point, so whenever hertbeat detects one of the servers down, it automatically assigns the virtual ip to the one that&#8217;s available.</p>
<pre class="brush: bash">
bash~# ifconfig

eth0      Link encap:Ethernet  HWaddr 00:24:54:d1:f3:5c  
	  inet addr:192.168.5.11  Bcast:192.168.5.255  Mask:255.255.255.0
          inet6 addr: fe80::224:54ff:fed1:f35c/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:6614 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5133 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6619801 (6.6 MB)  TX bytes:908555 (908.5 KB)
          Interrupt:19 

eth0:0    Link encap:Ethernet  HWaddr 00:1b:b1:4e:2a:44  
          inet addr:192.168.5.10  Bcast:192.168.5.255  Mask:255.255.255.0
          inet6 addr: fe80::21b:b1ff:fe4e:2a44/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:317696 errors:0 dropped:0 overruns:0 frame:788947
          TX packets:123262 errors:18 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:170312782 (170.3 MB)  TX bytes:19448021 (19.4 MB)
          Interrupt:16 
</pre>
<p>11. Make sure heartbeat starts on boot:</p>
<pre class="brush: bash">
bash~# chkconfig --list | grep heartbeat
</pre>
<p>12. If not listed, add it:</p>
<pre class="brush: bash">
bash~# chkconfig heartbeat on
</pre>
<p>*** As I mentioned previously, make sure both Heartbeat machines have the same identical configuration files and also an entry about each other in their respective /etc/hosts in case you&#8217;re not using a dns server.</p>
<p>And that&#8217;s it, you&#8217;ve configured your very own linux high availability &#8220;cluster&#8221;. Thanks for stopping by once again and remember, please share with others, after all, code should be free.<img src="http://www.foscode.com/wp-content/uploads/2010/04/foscode_logo_sm.png" alt="foscode.com | because code should be free" title="FOSCODE" width="227" height="18" class="alignright size-full wp-image-221" /></p>
<p>The post <a href="http://www.foscode.com/setup-linux-high-availability/">How To Setup Linux High Availability</a> appeared first on <a href="http://www.foscode.com">foscode</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.foscode.com/setup-linux-high-availability/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Setup A Load Balancer</title>
		<link>http://www.foscode.com/howto-setup-load-balancer/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=howto-setup-load-balancer</link>
		<comments>http://www.foscode.com/howto-setup-load-balancer/#comments</comments>
		<pubDate>Sun, 08 Jul 2012 20:50:08 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[crossroads]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[load-balancer]]></category>

		<guid isPermaLink="false">http://www.foscode.com/?p=959</guid>
		<description><![CDATA[<p>setup crossroads load balancer running on linux, with CentOS 
A load balancer distributes requests for services accross multiple servers <a href="http://www.foscode.com/howto-setup-load-balancer/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://www.foscode.com/howto-setup-load-balancer/">How To Setup A Load Balancer</a> appeared first on <a href="http://www.foscode.com">foscode</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve finally gotten to writting a new tutorial after a while without posting any new content. Also, in case you haven&#8217;t noticed, I have re-designed the site, so hopefully you&#8217;ll be able to enjoy it even more. In this tutorial, I&#8217;ll show you how to setup a load balancer running on linux, with CentOS as the operating system of choice for this tutorial.<br />
A load balancer distributes requests for services accross multiple servers, and in this tutorial I&#8217;ll be walking you through setting up <a title="crossroads" href="http://crossroads.e-tunity.com/" target="_blank">crossroads</a> load balancer.</p>
<div align="center">

<a href='http://www.foscode.com/?attachment_id=969' title='crossroads'><img width="150" height="150" src="http://www.foscode.com/wp-content/uploads/2012/07/crossroads-150x150.jpg" class="attachment-thumbnail" alt="crossroads" title="crossroads" /></a>

</div>
<p><span id="more-959"></span></p>
<p>Crossroads is an open source load balancer and fail over utility for TCP based services. Crossroads can be downloaded from <a title="download crossroads" href="http://crossroads.e-tunity.com/downloads.xr" target="_blank">here</a></p>
<p>First things first, you&#8217;ll need to install the required dependencies:</p>
<pre class="brush: bash">
yum install gcc make
yum groupinstall &quot;Development Tools&quot;
yum install yum-utils
</pre>
<p>After all dependencies have been installed, reboot.</p>
<p>Now lets create a folder where we&#8217;ll download crossroads sources:</p>
<pre class="brush: bash">
mkdir /opt/crossroads
cd /opt/crossroads
wget http://crossroads.e-tunity.com/downloads/crossroads-stable.tar.gz
</pre>
<p>Unpack the archive and create a symlink in sources directory, e.g., /usr/local/src/</p>
<pre class="brush: bash">
tar xzvf crossroads-stable.tar.gz
ln -s /opt/crossroads/crossroads-2.74 /usr/local/src/crossroads
</pre>
<p>Go to the created directory /usr/local/src/crossroads/</p>
<pre class="brush: bash">
cd /usr/local/src/crossroads/
</pre>
<p>Type make install, this compiles crossroads and installs it into /usr/sbin/</p>
<pre class="brush: bash">
make install
</pre>
<p>Crossroads is now installed. For this tutorial I&#8217;ll setup crossroads to manage traffic for mysql and apache, but you can add as many servers and services you&#8217;d like. Here&#8217;s our sample information:</p>
<p>mysql server 1 &#8212; 192.168.1.10<br />
mysql server 2 &#8212; 192.168.1.20<br />
apache server 1 server 1 (site 1)&#8211; 192.168.1.30<br />
apache server 2 server 1 (site 2)&#8211; 192.168.1.40<br />
apache server 1 (site 2) &#8212; 192.168.2.30<br />
apache server 2 (site 2) &#8212; 192.168.2.40</p>
<p>Create a startup script in /opt/startCrossroads.sh and make it executable:</p>
<pre class="brush: bash">
#!/bin/bash
## Load balance Mysql
/usr/sbin/xr --verbose --server tcp:0:3306 --backend 192.168.1.10:3306 --backend 192.168.1.20:3306 2&gt;&amp;1 &gt;&gt; /var/log/xr-web.log &amp;
## Load balance APACHE
/usr/sbin/xr --verbose -S --server http:0:80 --host-match www.site1.com --backend 192.168.1.30:80 --backend 192.168.1.40:80 \
--host-match www.site2.com --backend 192.168.2.30:80 --backend 192.168.2.40:80 2&gt;&amp;1 &gt;&gt; /var/log/xr-web.log &amp;
</pre>
<p>Alternatively, you can also manage your http traffic using tcp (same way as we did mysql), this is how it would look like:</p>
<pre class="brush: bash">
/usr/sbin/xr --verbose --server tcp:0:80 --backend 192.168.1.30:80 --backend 192.168.1.40:80 --backend 192.168.2.30:80 --backend 192.168.2.40:80 2&gt;&amp;1 &gt;&gt; /var/log/xr-web.log &amp;
</pre>
<p>Now make the script to start crossroads executable</p>
<pre class="brush: bash">
chmod +x /opt/startCrossroads.sh
</pre>
<p>Create symlink in /usr/bin:</p>
<pre class="brush: bash">
ln -s /opt/startCrossroads.sh /usr/bin/startCrossroads.sh
</pre>
<p>Add the line below to /etc/rc.local so it&#8217;ll start at boot time</p>
<pre class="brush: bash">
#Start crossroads load balancer
/usr/bin/startCrossroads.sh
</pre>
<p>Start the load balancer:</p>
<pre class="brush: bash">
/usr/bin/startCrossroads.sh
</pre>
<p>Open port 3306 and 80 on firewall and whichever other services will be forwarded to the load balancer, then forward incoming traffic to port 80 and 3306 (any other services crossroads is handling) to the crossroads ip address.</p>
<p>Congratulations, you have now setup your very own load balancer. Thanks for stopping by once again and remember, please share with others, after all, code should be free.<img class="alignright size-full wp-image-221" title="FOSCODE" src="http://www.foscode.com/wp-content/uploads/2010/04/foscode_logo_sm.png" alt="foscode.com | because code should be free" width="227" height="18" /></p>
<p>The post <a href="http://www.foscode.com/howto-setup-load-balancer/">How To Setup A Load Balancer</a> appeared first on <a href="http://www.foscode.com">foscode</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.foscode.com/howto-setup-load-balancer/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>New Look</title>
		<link>http://www.foscode.com/new-look/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=new-look</link>
		<comments>http://www.foscode.com/new-look/#comments</comments>
		<pubDate>Sun, 08 Jul 2012 14:46:19 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[foscode]]></category>

		<guid isPermaLink="false">http://www.foscode.com/?p=949</guid>
		<description><![CDATA[<p>As you might have noticed, foscode has gone through a make up process.Much like those shows seen on HGTV where people decided to do a home makeover, our changes weren&#8217;t uneventful, but nonetheless, worth it. I hope you guys enjoy &#8230; <a href="http://www.foscode.com/new-look/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://www.foscode.com/new-look/">New Look</a> appeared first on <a href="http://www.foscode.com">foscode</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>As you might have noticed, foscode has gone through a make up process.Much like those shows seen on HGTV where people decided to do a home makeover, our changes weren&#8217;t uneventful, but nonetheless, worth it. I hope you guys enjoy the new look, I like to think it makes it a little easier on the eyes and a better user experience, and while you are at it, don&#8217;t forget to also leave a comment in many of our articles and share our site with your friends. Thanks for stopping by once again and remember, please share with others, after all, code should be free.<img src="http://www.foscode.com/wp-content/uploads/2010/04/foscode_logo_sm.png" alt="foscode.com | because code should be free" title="FOSCODE" width="227" height="18" class="alignright size-full wp-image-221" /></p>
<p>The post <a href="http://www.foscode.com/new-look/">New Look</a> appeared first on <a href="http://www.foscode.com">foscode</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.foscode.com/new-look/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamic DNS with 1&amp;1</title>
		<link>http://www.foscode.com/dynamic-dns-11/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dynamic-dns-11</link>
		<comments>http://www.foscode.com/dynamic-dns-11/#comments</comments>
		<pubDate>Fri, 17 Feb 2012 16:32:15 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://www.foscode.com/?p=883</guid>
		<description><![CDATA[<p>I&#8217;ve been using afraid.org FreeDNS as my dynamic dns servers for my domains registered with 1&#38;1 for the past few years. They offer great service and have a large variety of options when it comes down to configuration and so &#8230; <a href="http://www.foscode.com/dynamic-dns-11/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://www.foscode.com/dynamic-dns-11/">Dynamic DNS with 1&#038;1</a> appeared first on <a href="http://www.foscode.com">foscode</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using afraid.org <a href="http://freedns.afraid.org/" target="_blank">FreeDNS</a> as my dynamic dns servers for my domains registered with <a href="http://1and1.com" target="_blank">1&amp;1</a> for the past few years. They offer great service and have a large variety of options when it comes down to configuration and so forth. With that being said, just recently I started noticing their servers weren&#8217;t responding and my site all of a sudden went down since the dns data wasn&#8217;t getting updated. I&#8217;ve started doing searches on alternatives and found a few, but none as straight forward as FreeDNS from afraid.org &#8230; until last night.</p>

<a href='http://www.foscode.com/dynamic-dns-11/oneandone/' title='oneandone'><img width="150" height="150" src="http://www.foscode.com/wp-content/uploads/2012/02/oneandone-150x150.png" class="attachment-thumbnail" alt="oneandone" title="oneandone" /></a>

</div>
<p><span id="more-883"></span><br />
I&#8217;ve finally come across this <a href="http://www.tsaiberspace.net/blog/2006/04/05/dynamic-dns-with-11" target="_blank">post</a> from Rob who has had the same service from afraid.org and was able to make his dynamic dns work with <a href="http://1and1.com" target="_blank">1&amp;1</a>. So I thought, wait, this is cool, I also have a domain with 1&amp;1, so let me give this a shot and see how it works. To my surprise, it worked indeed (after a few custom changes). So there, if you own a domain with 1&amp;1.com and have a dynamic ip address, you can now too, update your dns information whenever your ip changes! Here&#8217;s how:</p>
<p>1. Login to 1&amp;1 and change the dns settings for your domain. You now need to set it so it uses 1&amp;1 dns servers, and under advanced settings, enter the current ip address of your server.</p>
<p>2. If you would like to serve your own mail, you&#8217;ll also need to create a <a href="http://faq.oneandone.co.uk/domains/domain_admin/dns_settings/3.html" target="_blank">glue record</a> and a <a href="http://faq.1and1.co.uk/domains/domain_admin/dns_settings/9.html" target="_blank">mx record</a> and then update your settings. 1&amp;1 has the instructions for this (just click on the links I just mentioned.)</p>
<p>Now that you have the config part in 1&amp;1 done you can go ahead and setup the scripts that will update the dns information for you. I&#8217;ve downloaded and modified this script from <a href="http://www.tsaiberspace.net/blog/2006/04/05/dynamic-dns-with-11/" target="_blank">tsaiberspace</a>, which is an automated client that masquerades itself as a web browser to automatically update the IP address associated with a 1&amp;1 domain. For it all to work you&#8217;ll need to create a few scripts and install a few dependencies:</p>
<p>1. Install libwww-curl-perl<br />
2. config.cfg (Contains the domain information to be updated)<br />
3. checkdns (checks if the ip address has been changed, if so, runs the update1and1 script)<br />
4. update1and1 (updates 1and1 dns information)</p>
<p>1. config.cfg:</p>
<pre class="brush: bash">
# config file for 1and1 dns update
DOMAIN1=domain.com
LOGIN=www.domain.com
PASS=yourpassword
</pre>
<p>2. checkdns</p>
<pre class="brush: html">
#!/bin/bash

echo &amp;quot;Reading config from /etc/dynamic1and1/config.cfg ....&amp;quot; &amp;gt;&amp;amp;2
source /etc/dynamic1and1/config.cfg
## vars $DOMAIN1 $LOGIN $PASS come from config.cfg above

function update_dns() {
$HOME/dynamic1and1/update1and1 $address $DOMAIN1 $LOGIN $PASS &amp;gt;&amp;amp;2
echo &amp;quot;1AND1 DNS Updated Successfuly&amp;quot; &amp;gt;&amp;amp;2
}

function curr_ip() {
currdev=$(/sbin/ip route| grep default |head -n 1 |awk &amp;#039;{print $5}&amp;#039;)
currip=$(wget http://www.checkip.net/ -o /dev/null -O /dev/stdout | head -n 4 | tail -n 1 | cut -f2 -d:)
echo $currip
}

function check_ip() {
address=$(curr_ip)
tmp_data=&amp;quot;$HOME/.curr_ip&amp;quot;
# see if the address really changed
if [ -f &amp;quot;$tmp_data&amp;quot; ]
then
if [ &amp;quot;$address&amp;quot; = &amp;quot;$(cat $tmp_data)&amp;quot; ]
then
echo &amp;quot;IP Address hasn&amp;#039;t changed, DNS records are uptodate&amp;quot;
else
# update 1&amp;amp;1.com
update_dns
fi
else
# update 1&amp;amp;1.com
update_dns
fi
echo $address &amp;gt; $tmp_data
}

## This function runs now to check the ipaddress.
## If the ip has changed, the script will call the update1and1 script and update the dns data.
check_ip

</pre>
<p>3. update1and1</p>
<pre class="brush: html">
#!/usr/bin/perl -w

###############################################################################

package Update1and1;

use strict;
use WWW::Curl::Easy;
use URI::Escape;

sub __curldebug()
{
my (@args) = @_;

print map { &amp;quot;[$_]\n&amp;quot; } @args;
}

sub new($$)
{
sub curlsink($$)
{
my ($data, $ref) = @_;

push @$ref, $data;
return length($data);
}

my ($class, $args) = @_;

my $this = bless {
curl =&amp;amp;gt; WWW::Curl::Easy-&amp;amp;gt;new(),
root =&amp;amp;gt; &amp;quot;https://admin.1and1.com&amp;quot;,
jsessionid =&amp;amp;gt; &amp;quot;&amp;quot;,
headers =&amp;amp;gt; [],
body =&amp;amp;gt; [],
%{$args},
};

my $curl = $this-&amp;amp;gt;{curl};

$curl-&amp;amp;gt;setopt(CURLOPT_VERBOSE, $args-&amp;amp;gt;{verbose} ? 1 : 0);
$curl-&amp;amp;gt;setopt(CURLOPT_HEADERFUNCTION, \&amp;amp;amp;curlsink);
$curl-&amp;amp;gt;setopt(CURLOPT_WRITEFUNCTION, \&amp;amp;amp;curlsink);

$this;
}

sub httpOK($)
{
my ($allheaders) = @_;

my $finalheaders = &amp;quot;&amp;quot;;
foreach (@$allheaders) {
if (m@^HTTP/\d+\.\d+ \d+ @) {
$finalheaders = &amp;quot;&amp;quot;;
}
$finalheaders .= $_;
}

return $finalheaders =~ m#^HTTP/1\.\d 200 OK#;
}

sub Login($)
{
my ($this, $args) = @_;

my $curl = $this-&amp;amp;gt;{curl};

$curl-&amp;amp;gt;setopt(CURLOPT_URL, &amp;quot;$this-&amp;amp;gt;{root}/&amp;quot;);
$curl-&amp;amp;gt;setopt(CURLOPT_FOLLOWLOCATION, 1);
$curl-&amp;amp;gt;perform() and die &amp;quot;$curl-&amp;amp;gt;errbuf\n&amp;quot;;
$curl-&amp;amp;gt;setopt(CURLOPT_FOLLOWLOCATION, 0);

my $eurl = $curl-&amp;amp;gt;getinfo(CURLINFO_EFFECTIVE_URL);
die &amp;quot;Redirected to [$eurl] - looking for [^$this-&amp;amp;gt;{root}(:\\d+)?/]\n&amp;quot;
if $eurl !~ m#^$this-&amp;amp;gt;{root}(:\d+)?/#;

($this-&amp;amp;gt;{jsessionid}) = $eurl =~ m@.*;jsessionid=(.*?)[&amp;amp;amp;\?].*?$@;

$curl-&amp;amp;gt;setopt(CURLOPT_URL, $this-&amp;amp;gt;{root}
. &amp;quot;/xml/logpixel?jsessionid=$this-&amp;amp;gt;{jsessionid}&amp;quot;);
$curl-&amp;amp;gt;perform() and die &amp;quot;$curl-&amp;amp;gt;errbuf\n&amp;quot;;

$curl-&amp;amp;gt;setopt(CURLOPT_URL, $this-&amp;amp;gt;{root}
. &amp;quot;/xml/config/TaOverview;&amp;quot;
. &amp;quot;jsessionid=$this-&amp;amp;gt;{jsessionid}&amp;quot;);
$curl-&amp;amp;gt;setopt(CURLOPT_FOLLOWLOCATION, 1);
$curl-&amp;amp;gt;setopt(CURLOPT_POST, 1);
$curl-&amp;amp;gt;setopt(CURLOPT_POSTFIELDS, join(&amp;quot;&amp;amp;amp;&amp;quot;, (
&amp;quot;__lf=&amp;quot; . uri_escape(&amp;quot;HomeFlow&amp;quot;),
&amp;quot;__sendingauthdata=&amp;quot; . uri_escape(&amp;quot;1&amp;quot;),
&amp;quot;login.SelectContract=&amp;quot; . uri_escape(&amp;quot;&amp;quot;),
&amp;quot;login.User=&amp;quot; . uri_escape($args-&amp;amp;gt;{auth}-&amp;amp;gt;{customerid}),
&amp;quot;login.Pass=&amp;quot; . uri_escape($args-&amp;amp;gt;{auth}-&amp;amp;gt;{password}),
)));

($this-&amp;amp;gt;{headers}, $this-&amp;amp;gt;{body}) = ([], []);
$curl-&amp;amp;gt;setopt(CURLOPT_WRITEHEADER, \@{$this-&amp;amp;gt;{headers}});
$curl-&amp;amp;gt;setopt(CURLOPT_FILE, \@{$this-&amp;amp;gt;{body}});
$curl-&amp;amp;gt;perform() and die &amp;quot;$curl-&amp;amp;gt;errbuf\n&amp;quot;;
$curl-&amp;amp;gt;setopt(CURLOPT_FOLLOWLOCATION, 0);
$curl-&amp;amp;gt;setopt(CURLOPT_POST, 0);

if ($this-&amp;amp;gt;{verbose}) {
my $headers = join(&amp;quot;&amp;quot;, @{$this-&amp;amp;gt;{headers}});
my $body = join(&amp;quot;&amp;quot;, @{$this-&amp;amp;gt;{body}});
print &amp;quot;[$headers]\n[$body]\n&amp;quot;;
}

die &amp;quot;HTTP failure in Login! [@{$this-&amp;amp;gt;{headers}}]\n&amp;quot;
if !httpOK($this-&amp;amp;gt;{headers});
}

sub GetDomain($$)
{
# Return the index of the desired domain.
my ($this, $args) = @_;

my $curl = $this-&amp;amp;gt;{curl};

$curl-&amp;amp;gt;setopt(CURLOPT_URL, $this-&amp;amp;gt;{root}
. &amp;quot;/xml/config/DomainOverview;&amp;quot;
. &amp;quot;jsessionid=$this-&amp;amp;gt;{jsessionid}&amp;quot;);
$curl-&amp;amp;gt;setopt(CURLOPT_FOLLOWLOCATION, 1);
($this-&amp;amp;gt;{headers}, $this-&amp;amp;gt;{body}) = ([], []);
$curl-&amp;amp;gt;setopt(CURLOPT_WRITEHEADER, \@{$this-&amp;amp;gt;{headers}});
$curl-&amp;amp;gt;setopt(CURLOPT_FILE, \@{$this-&amp;amp;gt;{body}});
$curl-&amp;amp;gt;perform() and die &amp;quot;$curl-&amp;amp;gt;errbuf\n&amp;quot;;
$curl-&amp;amp;gt;setopt(CURLOPT_FOLLOWLOCATION, 0);

my $body = join(&amp;quot;&amp;quot;, @{$this-&amp;amp;gt;{body}});
if ($this-&amp;amp;gt;{verbose}) {
my $headers = join(&amp;quot;&amp;quot;, @{$this-&amp;amp;gt;{headers}});
print &amp;quot;[$headers]\n[$body]\n&amp;quot;;
}

die &amp;quot;HTTP failure in GetDomain! [@{$this-&amp;amp;gt;{headers}}]\n&amp;quot;
if !httpOK($this-&amp;amp;gt;{headers});

$body =~ tr#\n##d;
$body =~ s#^.*?
$body =~ s#^.*?(&amp;lt;a&amp;gt;).*$#$1#;
$body =~ s#&amp;lt;/a&amp;gt;.*?&amp;amp;lt;a#\n&amp;amp;lt;a#g;
my @records = grep(
m#/xml/config/DomainOverview;jsessionid=$this-&amp;amp;gt;{jsessionid}#,
grep(/href\s*=\s*&amp;quot;/, split(/\n/, $body)));

my (%domainmap);
my $ii = 0;
foreach my $record (@records) {
my ($url, $domain) =
$record =~ m#(.*)#;
$url =~ s#&amp;amp;amp;#�
my ($domainIds) = $url =~ m#&amp;amp;amp;domainOverview.DomainIds=(\d+)#;
$domainmap{$domain} = {
index =&amp;amp;gt; $ii,
domain =&amp;amp;gt; $domain,
url =&amp;amp;gt; $url,
domainIds =&amp;amp;gt; $domainIds,
};
$ii++;
}

return undef if !$domainmap{$args-&amp;amp;gt;{domain}};
return $domainmap{$args-&amp;amp;gt;{domain}}-&amp;amp;gt;{domainIds};
}

sub EditDNSSettings($$)
{
# Edit DNS settings for the indexed domain.
my ($this, $args) = @_;

my $curl = $this-&amp;amp;gt;{curl};

$curl-&amp;amp;gt;setopt(CURLOPT_URL, $this-&amp;amp;gt;{root}
. &amp;quot;/xml/config/DomainOverview;&amp;quot;
. &amp;quot;jsessionid=$this-&amp;amp;gt;{jsessionid}&amp;quot;);
$curl-&amp;amp;gt;setopt(CURLOPT_FOLLOWLOCATION, 1);
$curl-&amp;amp;gt;setopt(CURLOPT_POST, 1);
$curl-&amp;amp;gt;setopt(CURLOPT_POSTFIELDS, join(&amp;quot;&amp;amp;amp;&amp;quot;, (
&amp;quot;__lf=&amp;quot; . uri_escape(&amp;quot;MCPrivacyFlow&amp;quot;),
&amp;quot;__sendingdata=&amp;quot; . uri_escape(&amp;quot;1&amp;quot;),
&amp;quot;__currentindex%5BDomainOverview%5D=&amp;quot; . uri_escape(&amp;quot;0&amp;quot;),
&amp;quot;__SYNT%3Ad1e502d0%3AdomainFilter.Set=&amp;quot; . uri_escape(&amp;quot;true&amp;quot;),
&amp;quot;__SYNT%3Ad1e502d0%3AextendedDomainFilter.Set=&amp;quot;
. uri_escape(&amp;quot;true&amp;quot;),
&amp;quot;__SYNT%3Ad1e502d0%3A__CMD%5BDomainOverview%5D%3ASELWRP=&amp;quot;
. uri_escape(&amp;quot;extendedDomainFilter&amp;quot;),
&amp;quot;__SYNT%3Ad1e502d0%3A__CMD%5BDomainOverview%5D%3ASELWRP=&amp;quot;
. uri_escape(&amp;quot;domainFilter&amp;quot;),
&amp;quot;foo=&amp;quot; . uri_escape(&amp;quot;&amp;quot;),
&amp;quot;__SYNT%3Ad1e1030d0%3A__pageflow=&amp;quot;
. uri_escape(&amp;quot;settings_wizard_flow&amp;quot;),
&amp;quot;__SYNT%3Ad1e1039d0%3A__pageflow=&amp;quot;
. uri_escape(&amp;quot;MCFlow&amp;quot;),
&amp;quot;__SYNT%3Ad1e1048d0%3A__pageflow=&amp;quot;
. uri_escape(&amp;quot;dns_wizard_flow&amp;quot;),
&amp;quot;__SYNT%3Ad1e1056d0%3A__pageflow=&amp;quot;
. uri_escape(&amp;quot;lock_unlock_flow&amp;quot;),
&amp;quot;__SYNT%3Ad1e1065d0%3A__pageflow=&amp;quot;
. uri_escape(&amp;quot;subdomain_delete_flow&amp;quot;),
&amp;quot;__SYNT%3Ad1e1073d0%3A__pageflow=&amp;quot;
. uri_escape(&amp;quot;settings_info_flow&amp;quot;),
&amp;quot;domainFilter.DomainnameSubstring=&amp;quot;
. uri_escape(&amp;quot;&amp;quot;),
&amp;quot;__SYNT%3Ad1e1106d0%3AdomainFilter.Set=&amp;quot;
. uri_escape(&amp;quot;true&amp;quot;),
&amp;quot;__SYNT%3Ad1e1106d0%3AextendedDomainFilter.Set=&amp;quot;
. uri_escape(&amp;quot;true&amp;quot;),
&amp;quot;__SYNT%3Ad1e1106d0%3A__CMD%5BDomainOverview%5D%3ASELWRP=&amp;quot;
. uri_escape(&amp;quot;extendedDomainFilter&amp;quot;),
&amp;quot;__SYNT%3Ad1e1106d0%3A__CMD%5BDomainOverview%5D%3ASELWRP=&amp;quot;
. uri_escape(&amp;quot;domainFilter&amp;quot;),
&amp;quot;domainFilter.DomainType=&amp;quot;
. uri_escape(&amp;quot;all&amp;quot;),
&amp;quot;extendedDomainFilter.TargetType=&amp;quot;
. uri_escape(&amp;quot;all&amp;quot;),
&amp;quot;extendedDomainFilter.FrontpageStatus=&amp;quot;
. uri_escape(&amp;quot;all&amp;quot;),
&amp;quot;__SYNT%3Ad1e1214d0%3AdomainFilter.Set=&amp;quot;
. uri_escape(&amp;quot;true&amp;quot;),
&amp;quot;__SYNT%3Ad1e1214d0%3AextendedDomainFilter.Set=&amp;quot;
. uri_escape(&amp;quot;true&amp;quot;),
&amp;quot;__SYNT%3Ad1e1214d0%3A__CMD%5BDomainOverview%5D%3ASELWRP=&amp;quot;
. uri_escape(&amp;quot;extendedDomainFilter&amp;quot;),
&amp;quot;__SYNT%3Ad1e1214d0%3A__CMD%5BDomainOverview%5D%3ASELWRP=&amp;quot;
. uri_escape(&amp;quot;domainFilter&amp;quot;),
&amp;quot;__SYNT%3Ad1e1312d0%3AselectDomain.Action=&amp;quot;
. uri_escape(&amp;quot;reset&amp;quot;),
&amp;quot;__SYNT%3Ad1e1312d0%3AdomainOrder.OrderBy=&amp;quot;
. uri_escape(&amp;quot;domainname&amp;quot;),
&amp;quot;__SYNT%3Ad1e1312d0%3AdomainOrder.OrderAscending=&amp;quot;
. uri_escape(&amp;quot;true&amp;quot;),
&amp;quot;__SYNT%3Ad1e1312d0%3A__CMD%5BDomainOverview%5D%3ASELWRP=&amp;quot;
. uri_escape(&amp;quot;selectDomain&amp;quot;),
&amp;quot;__SYNT%3Ad1e1312d0%3A__CMD%5BDomainOverview%5D%3ASELWRP=&amp;quot;
. uri_escape(&amp;quot;domainOrder&amp;quot;),
&amp;quot;__SYNT%3Ad1e1417d0%3AselectDomain.Action=&amp;quot;
. uri_escape(&amp;quot;reset&amp;quot;),
&amp;quot;__SYNT%3Ad1e1417d0%3AdomainOrder.OrderBy=&amp;quot;
. uri_escape(&amp;quot;domaintype&amp;quot;),
&amp;quot;__SYNT%3Ad1e1417d0%3AdomainOrder.OrderAscending=&amp;quot;
. uri_escape(&amp;quot;false&amp;quot;),
&amp;quot;__SYNT%3Ad1e1417d0%3A__CMD%5BDomainOverview%5D%3ASELWRP=&amp;quot;
. uri_escape(&amp;quot;selectDomain&amp;quot;),
&amp;quot;__SYNT%3Ad1e1417d0%3A__CMD%5BDomainOverview%5D%3ASELWRP=&amp;quot;
. uri_escape(&amp;quot;domainOrder&amp;quot;),
&amp;quot;__SYNT%3Ad1e1611d0%3AselectDomain.Action=&amp;quot;
. uri_escape(&amp;quot;reset&amp;quot;),
&amp;quot;__SYNT%3Ad1e1611d0%3AdomainOrder.OrderBy=&amp;quot;
. uri_escape(&amp;quot;state&amp;quot;),
&amp;quot;__SYNT%3Ad1e1611d0%3AdomainOrder.OrderAscending=&amp;quot;
. uri_escape(&amp;quot;false&amp;quot;),
&amp;quot;__SYNT%3Ad1e1611d0%3A__CMD%5BDomainOverview%5D%3ASELWRP=&amp;quot;
. uri_escape(&amp;quot;selectDomain&amp;quot;),
&amp;quot;__SYNT%3Ad1e1611d0%3A__CMD%5BDomainOverview%5D%3ASELWRP=&amp;quot;
. uri_escape(&amp;quot;domainOrder&amp;quot;),
&amp;quot;domainOverview.DomainIds=&amp;quot; . uri_escape($args-&amp;amp;gt;{domainIds}),
&amp;quot;__pageflow=&amp;quot; . uri_escape(&amp;quot;dns_flow2&amp;quot;),
)));

($this-&amp;amp;gt;{headers}, $this-&amp;amp;gt;{body}) = ([], []);
$curl-&amp;amp;gt;setopt(CURLOPT_WRITEHEADER, \@{$this-&amp;amp;gt;{headers}});
$curl-&amp;amp;gt;setopt(CURLOPT_FILE, \@{$this-&amp;amp;gt;{body}});
$curl-&amp;amp;gt;perform() and die &amp;quot;$curl-&amp;amp;gt;errbuf\n&amp;quot;;
$curl-&amp;amp;gt;setopt(CURLOPT_FOLLOWLOCATION, 0);
$curl-&amp;amp;gt;setopt(CURLOPT_POST, 0);

if ($this-&amp;amp;gt;{verbose}) {
my $headers = join(&amp;quot;&amp;quot;, @{$this-&amp;amp;gt;{headers}});
my $body = join(&amp;quot;&amp;quot;, @{$this-&amp;amp;gt;{body}});
print &amp;quot;[$headers]\n[$body]\n&amp;quot;;
}

die &amp;quot;HTTP failure in EditDNSSettings! [@{$this-&amp;amp;gt;{headers}}]\n&amp;quot;
if !httpOK($this-&amp;amp;gt;{headers});
}

sub DomainNGDnsUpdate($$)
{
my ($this, $args) = @_;

my $curl = $this-&amp;amp;gt;{curl};
my @ipaddr = split(/\./, $args-&amp;amp;gt;{ipaddr});

$curl-&amp;amp;gt;setopt(CURLOPT_URL, $this-&amp;amp;gt;{root}
. &amp;quot;/xml/config/DomainNGDnsUpdate;&amp;quot;
. &amp;quot;jsessionid=$this-&amp;amp;gt;{jsessionid}&amp;quot;);
$curl-&amp;amp;gt;setopt(CURLOPT_FOLLOWLOCATION, 1);
$curl-&amp;amp;gt;setopt(CURLOPT_POST, 1);
$curl-&amp;amp;gt;setopt(CURLOPT_POSTFIELDS, join(&amp;quot;&amp;amp;amp;&amp;quot;, (
&amp;quot;__lf=&amp;quot; . uri_escape(&amp;quot;dns_flow2&amp;quot;),
&amp;quot;__sendingdata=&amp;quot; . uri_escape(&amp;quot;1&amp;quot;),
&amp;quot;__currentindex%5BDomainNGDnsUpdate%5D=&amp;quot; . uri_escape(&amp;quot;0&amp;quot;),
&amp;quot;dnsUpdate.UseCname=&amp;quot; . uri_escape(&amp;quot;0&amp;quot;),
&amp;quot;dnsUpdate.Cname=&amp;quot; . uri_escape(&amp;quot;&amp;quot;),
&amp;quot;dnsUpdate.UseCompanyNameserver=&amp;quot; . uri_escape(&amp;quot;1&amp;quot;),
&amp;quot;dnsUpdate.Nameserver0=&amp;quot; . uri_escape(&amp;quot;&amp;quot;),
&amp;quot;dnsUpdate.UseCompanySecondaryNameserver=&amp;quot; . uri_escape(&amp;quot;0&amp;quot;),
&amp;quot;dnsUpdate.Nameserver1=&amp;quot; . uri_escape(&amp;quot;&amp;quot;),
&amp;quot;dnsUpdate.Nameserver2=&amp;quot; . uri_escape(&amp;quot;&amp;quot;),
&amp;quot;dnsUpdate.Nameserver3=&amp;quot; . uri_escape(&amp;quot;&amp;quot;),
&amp;quot;dnsUpdate.SelectIP=&amp;quot; . uri_escape(&amp;quot;2&amp;quot;),
&amp;quot;dnsUpdate.IP0=&amp;quot; . uri_escape($ipaddr[0]),
&amp;quot;dnsUpdate.IP1=&amp;quot; . uri_escape($ipaddr[1]),
&amp;quot;dnsUpdate.IP2=&amp;quot; . uri_escape($ipaddr[2]),
&amp;quot;dnsUpdate.IP3=&amp;quot; . uri_escape($ipaddr[3]),
&amp;quot;dnsUpdate.UseCompanyMx=&amp;quot; . uri_escape(&amp;quot;1&amp;quot;),
&amp;quot;dnsUpdate.Mx0=&amp;quot; . uri_escape(&amp;quot;&amp;quot;),
&amp;quot;dnsUpdate.Mx0Prio=&amp;quot; . uri_escape(&amp;quot;&amp;quot;),
&amp;quot;dnsUpdate.Mx1=&amp;quot; . uri_escape(&amp;quot;&amp;quot;),
&amp;quot;dnsUpdate.Mx1Prio=&amp;quot; . uri_escape(&amp;quot;&amp;quot;),
&amp;quot;dnsUpdate.UseBackupMx=&amp;quot; . uri_escape(&amp;quot;0&amp;quot;),
&amp;quot;dnsUpdate.Mx2=&amp;quot; . uri_escape(&amp;quot;&amp;quot;),
&amp;quot;dnsUpdate.Mx2Prio=&amp;quot; . uri_escape(&amp;quot;&amp;quot;),
&amp;quot;dnsUpdate.Mx3=&amp;quot; . uri_escape(&amp;quot;&amp;quot;),
&amp;quot;dnsUpdate.Mx3Prio=&amp;quot; . uri_escape(&amp;quot;&amp;quot;),
&amp;quot;__SYNT%3Ad1e1858d0%3AdnsReset.Reset=&amp;quot;
. uri_escape(&amp;quot;true&amp;quot;),
&amp;quot;__SYNT%3Ad1e1858d0%3A__CMD%5BDomainNGDnsUpdate%5D%3ASELWRP=&amp;quot;
. uri_escape(&amp;quot;dnsReset&amp;quot;),
&amp;quot;__SBMT%3Ad1e1874d0%3A=&amp;quot;
. uri_escape(&amp;quot;next&amp;quot;),
)));

($this-&amp;amp;gt;{headers}, $this-&amp;amp;gt;{body}) = ([], []);
$curl-&amp;amp;gt;setopt(CURLOPT_WRITEHEADER, \@{$this-&amp;amp;gt;{headers}});
$curl-&amp;amp;gt;setopt(CURLOPT_FILE, \@{$this-&amp;amp;gt;{body}});
$curl-&amp;amp;gt;perform() and die &amp;quot;$curl-&amp;amp;gt;errbuf\n&amp;quot;;
$curl-&amp;amp;gt;setopt(CURLOPT_FOLLOWLOCATION, 0);
$curl-&amp;amp;gt;setopt(CURLOPT_POST, 0);

if ($this-&amp;amp;gt;{verbose}) {
my $headers = join(&amp;quot;&amp;quot;, @{$this-&amp;amp;gt;{headers}});
my $body = join(&amp;quot;&amp;quot;, @{$this-&amp;amp;gt;{body}});
print &amp;quot;[$headers]\n[$body]\n&amp;quot;;
}

die &amp;quot;HTTP failure in DomainNGDNSUpdate! [@{$this-&amp;amp;gt;{headers}}]\n&amp;quot;
if !httpOK($this-&amp;amp;gt;{headers});
}

###############################################################################

package main;

use strict;
use Getopt::Std;

use vars qw($opt_v);
die if !getopts(&amp;quot;v&amp;quot;);
my $verbose = $opt_v ? 1 : 0;

## Changed the line below. Added new parameters $uname and $upass. Added $ARGV[2] and $ARGV[3]
my ($ip, $domain, $uname, $upass) = ($ARGV[0], $ARGV[1], $ARGV[2], $ARGV[3]);
## Changed line below to also check for !$uname and !$upass
if (!$ip || $ip !~ m#^\d+\.\d+\.\d+\.\d+$# || !$domain || !$uname || !$upass) {
## Changed the usage instructions below to include login and password info
die &amp;amp;lt;&amp;amp;lt;EOM;
Usage: $0 [-v(erbose)] Example: $0 111.222.333.444 domainname.net 1and1loginname somepassword
EOM
}

$| = 1;

my $a1 = Update1and1-&amp;amp;gt;new({
verbose =&amp;amp;gt; $verbose,
});

## Changed auth array to use the vars assigned above ($uname and $upass) instead of hardcoding them in here
$a1-&amp;amp;gt;Login({
auth =&amp;amp;gt; {
# &amp;quot;customerid&amp;quot; =&amp;amp;gt; &amp;quot;someloginname&amp;quot;,
# &amp;quot;password&amp;quot; =&amp;amp;gt; &amp;quot;somepassword&amp;quot;,
&amp;quot;customerid&amp;quot; =&amp;amp;gt; $uname,
&amp;quot;password&amp;quot; =&amp;amp;gt; $upass,
},
});
my $domainIds = $a1-&amp;amp;gt;GetDomain({
domain =&amp;amp;gt; $domain,
});
die &amp;quot;Couldn&amp;#039;t find \&amp;quot;$domain\&amp;quot;!\n&amp;quot; if !defined($domainIds);

$a1-&amp;amp;gt;EditDNSSettings({
domainIds =&amp;amp;gt; $domainIds,
});

$a1-&amp;amp;gt;DomainNGDnsUpdate({
ipaddr =&amp;amp;gt; $ip,
});

</pre>
<p>Now you can just copy and paste these and save them to your home folder in the server where you host your site, or just download the zip below and follow the instrcutions in the readme file.<br />
<a href="http://www.foscode.com/wp-content/uploads/2012/02/dynamic1and1.tar">dynamic1and1</a></p>
<p>**** DON&#8217;T FORGET TO CHANGE THE SETTINGS TO MATCH YOUR SITE,LOGIN AND PASSWORD INFORMATION ******</p>
<p>You&#8217;ll pretty much have to:</p>
<p>1. Unzip the files to your home folder<br />
2. Copy the config.cfg file to /etc/dynamic1and1/config.cfg and edit the settings accordingly<br />
3. (optional) &#8211;&gt; If you unzipped the app into a folder other then your home folder, edit line 8 in checkdns accordingly &#8211;&gt; function update_dns()<br />
4. (optional) &#8211;&gt; If you decided to place the config.cfg someplace else, edit line 4 in checkdns accordingly &#8211;&gt; source /etc/dynamic1and1/config.cfg<br />
4. Create a cron job to execute checkdns as often as you see fit</p>
<p>***** KNOWN ISSUES ******<br />
You should not get any errors when you run the script, however, if you get an error like:</p>
<p>WWW::Curl::Easy=SCALAR(0x7855f0)-&gt;errbuf</p>
<p>It means you either have an outdated version of cacert or do not have it installed. Just go ahead and install it and you should be good to go. If you are running ubuntu, just do:</p>
<p>sudo apt-get install ca-certificates</p>
<p>If you running a different flavor, head over to to your distro repository and search for ca-certificate and install it from there.</p>
<p>That&#8217;s it, you should now have your dynamic address updated on 1&amp;1 DNS servers whenever it changes. Thank you for stopping by and please share with others, after all, code should be free.<a href="http://www.foscode.com/wp-content/uploads/2010/04/foscode_logo_sm.png"><img class="alignright size-full wp-image-221" title="FOSCODE" src="http://www.foscode.com/wp-content/uploads/2010/04/foscode_logo_sm.png" alt="foscode.com | because code should be free" width="227" height="18" /></a></p>
<p>The post <a href="http://www.foscode.com/dynamic-dns-11/">Dynamic DNS with 1&#038;1</a> appeared first on <a href="http://www.foscode.com">foscode</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.foscode.com/dynamic-dns-11/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>ExtJS Treepanel with MySQL data</title>
		<link>http://www.foscode.com/extjs-treepanel-mysql-data/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extjs-treepanel-mysql-data</link>
		<comments>http://www.foscode.com/extjs-treepanel-mysql-data/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 18:04:20 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[extjs]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[treepanel]]></category>

		<guid isPermaLink="false">http://www.foscode.com/?p=876</guid>
		<description><![CDATA[<p>In this tutorial I'll show you how to build an ExtJS treepanel using data coming from MySQL, while using PHP to create the json array sent to the treepanel. <a href="http://www.foscode.com/extjs-treepanel-mysql-data/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://www.foscode.com/extjs-treepanel-mysql-data/">ExtJS Treepanel with MySQL data</a> appeared first on <a href="http://www.foscode.com">foscode</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>In this tutorial I&#8217;ll show you how to build an ExtJS treepanel using data coming from MySQL, while using PHP to create the json array sent to the treepanel. Here&#8217;s how:</p>
<div align="center">

<a href='http://www.foscode.com/?attachment_id=875' title='treepanel'><img width="150" height="150" src="http://www.foscode.com/wp-content/uploads/2011/12/treepanel-150x150.png" class="attachment-thumbnail" alt="treepanel" title="treepanel" /></a>

</div>
<p><span id="more-876"></span></p>
<p>1. Create ourapp.js, this will contain all our js files in steps 2 and 3:</p>
<p>ourapp.js</p>
<pre class="brush: javascript">
Ext.onReady(function(){
        // Items from step 2 and 3 will go in here
});
</pre>
<p>2. Create the treepanel:</p>
<pre class="brush: javascript">
var tpanel = new Ext.tree.TreePanel({

    	id: &#039;tree-panel&#039;,

    	height: 477,

        useArrows: true,                    

	    animate: true,

	    border: false,

	    root: {

	        nodeType: &#039;async&#039;,

	        text: &#039;Items&#039;,

	        draggable: false, 

	        id: &#039;0&#039;                       

	    },        

        loader: new Ext.tree.TreeLoader({

            dataUrl:&#039;itemlist.php&#039;, // This is where our treepanel items come from

            requestMethod: &#039;GET&#039;

        })

    });
</pre>
<p>3. Create the panel that&#8217;ll house the treepanel:</p>
<pre class="brush: javascript">
var homepanel = new Ext.Panel({

			      id: &#039;mainpanel_id&#039;,

			      renderTo: &#039;maindiv&#039;,

			      width : 1218,

			      height: 545,

			      frame: true,

			      layout: &#039;border&#039;,

			      items: [{

				        region:&#039;west&#039;, 

				        margins: &#039;0 0 0 0 &#039;, 

				        id: &#039;westregion_id&#039;,

				        width: 300,

				        autoHeight: true,

				        layout: &#039;fit&#039;,

				        frame: true,

				        items:[tpanel] // treepanel goes here

				    },{

				        region: &#039;east&#039;,     

				        margins: &#039;0 0 0 0&#039;,

				        id: &#039;eastregion_id&#039;,

				        width: 900, 

				        autoHeight: true,

				        layout: &#039;fit&#039;,

				        frame: true,	        

				        items: [] // Add whatever other items you&#039;d like here

				    },{

				        title: &#039;Center Region&#039;,

				        region: &#039;center&#039;,     // center region is required, no width/height specified

				        xtype: &#039;container&#039;,

				        layout: &#039;fit&#039;,

				        margins: &#039;1 1 1 1&#039; // top, right, bottom, left

				    }]

});
</pre>
<p>4. Now create the php file that&#8217;ll load the data from MySQL and create the json array for us:<br />
itemlist.php</p>
<pre class="brush: php">
&lt;?php
include(&#039;../Connections/yourconnectiondata.php&#039;);

//connection String
$_con = mysql_connect($hostname, $username, $password) or die(&#039;Could not connect: &#039; . mysql_error());
//select database
$bool = mysql_select_db($database, $_con);
if ($bool === False){
	print &quot;can&#039;t find $database&quot;;
}


$query = &quot;SELECT item_id as id, item_name as text, &#039;true&#039; as leaf FROM items&quot;;
$res = mysql_query($query, $_con);

if (mysql_num_rows($res) &gt; 0) {
	while($obj = mysql_fetch_object($res)){
		$arr[] = $obj;		
		  		
	    }
				
		$myData = $arr;
			
			
		} else {     
			
		$myData = &#039;&#039;;
			
		}			
			
echo json_encode($myData);
?&gt;
</pre>
<p>5. Create the index file that&#8217;ll put it all together (remember to change the paths to where you have your extjs files):<br />
index.php</p>
<pre class="brush: html">
&lt;html&gt;

	

	&lt;body&gt;

		&lt;table align=&quot;center&quot; class=&quot;contenttable&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;&gt;

    &lt;/br&gt;

        &lt;tr&gt;

            &lt;td id=&quot;maindiv&quot;&gt;&lt;/td&gt;

        &lt;/tr&gt;

	&lt;/table&gt;

		

	&lt;/body&gt;

                &lt;!-- include ext-all.css --&gt;

		&lt;link rel=&quot;stylesheet&quot; href=&quot;ext/resources/css/ext-all.css&quot; /&gt;

		&lt;!-- include ext-base.js --&gt;

		&lt;script type=&quot;text/javascript&quot; src=&quot;ext/adapter/ext/ext-base.js&quot;&gt;&lt;/script&gt;

		&lt;!-- include ext-all.js --&gt;

		&lt;script type=&quot;text/javascript&quot; src=&quot;ext/ext-all.js&quot;&gt;&lt;/script&gt;    

		

		&lt;!-- include our app js files --&gt;

		&lt;script type=&quot;text/javascript&quot; src=&quot;ourapp.js&quot;&gt;&lt;/script&gt;



&lt;/html&gt;  
</pre>
<p>6. Our entire ourapp.js should look like this:<br />
ourapp.js</p>
<pre class="brush: javascript">
Ext.onReady(function(){



var tpanel = new Ext.tree.TreePanel({

    	id: &#039;tree-panel&#039;,

    	height: 477,

        useArrows: true,                    

	    animate: true,

	    border: false,

	    root: {

	        nodeType: &#039;async&#039;,

	        text: &#039;Items&#039;,

	        draggable: false, 

	        id: &#039;0&#039;                       

	    },        

        loader: new Ext.tree.TreeLoader({

            dataUrl:&#039;itemlist.php&#039;, // This is where our treepanel items come from

            requestMethod: &#039;GET&#039;

        })

    });	

    

var homepanel = new Ext.Panel({

			      id: &#039;mainpanel_id&#039;,

			      renderTo: &#039;maindiv&#039;,

			      width : 1218,

			      height: 545,

			      frame: true,

			      layout: &#039;border&#039;,

			      items: [{

				        region:&#039;west&#039;, 

				        margins: &#039;0 0 0 0 &#039;, 

				        id: &#039;westregion_id&#039;,

				        width: 300,

				        autoHeight: true,

				        layout: &#039;fit&#039;,

				        frame: true,

				        items:[tpanel] // treepanel goes here

				    },{

				        region: &#039;east&#039;,     

				        margins: &#039;0 0 0 0&#039;,

				        id: &#039;eastregion_id&#039;,

				        width: 900, 

				        autoHeight: true,

				        layout: &#039;fit&#039;,

				        frame: true,	        

				        items: [] // Add whatever other items you&#039;d like here

				    },{

				        title: &#039;Center Region&#039;,

				        region: &#039;center&#039;,     // center region is required, no width/height specified

				        xtype: &#039;container&#039;,

				        layout: &#039;fit&#039;,

				        margins: &#039;1 1 1 1&#039; // top, right, bottom, left

				    }]

});   



});
</pre>
<p>7. You&#8217;re welcome and enjoy. Thank you for stopping by and please share with others, after all, code should be free.<a href="http://www.foscode.com/wp-content/uploads/2010/04/foscode_logo_sm.png"><img src="http://www.foscode.com/wp-content/uploads/2010/04/foscode_logo_sm.png" alt="foscode.com | because code should be free" title="FOSCODE" width="227" height="18" class="alignright size-full wp-image-221" /></a></p>
<p>The post <a href="http://www.foscode.com/extjs-treepanel-mysql-data/">ExtJS Treepanel with MySQL data</a> appeared first on <a href="http://www.foscode.com">foscode</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.foscode.com/extjs-treepanel-mysql-data/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>How to connect to Microsoft SQL server from Linux via command line</title>
		<link>http://www.foscode.com/connect-microsoftsql-server-from-linux/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=connect-microsoftsql-server-from-linux</link>
		<comments>http://www.foscode.com/connect-microsoftsql-server-from-linux/#comments</comments>
		<pubDate>Fri, 23 Sep 2011 14:40:34 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[freetds]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.foscode.com/?p=850</guid>
		<description><![CDATA[<p>Although 95% of my work is done in Linux and MySQL, there are those unfortunate times I need to manipulate some data on a Microsoft SQL server. I didn&#8217;t want to install any apps on my computer that weren&#8217;t open &#8230; <a href="http://www.foscode.com/connect-microsoftsql-server-from-linux/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://www.foscode.com/connect-microsoftsql-server-from-linux/">How to connect to Microsoft SQL server from Linux via command line</a> appeared first on <a href="http://www.foscode.com">foscode</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>Although 95% of my work is done in Linux and MySQL, there are those unfortunate times I need to manipulate some data on a Microsoft SQL server. I didn&#8217;t want to install any apps on my computer that weren&#8217;t open source and I didn&#8217;t want to use a Micro$uck app through wine either. So after a few searches I came across an open source project called Sqsh.  In this tutorial I&#8217;ll show you how to install sqsh and access a Microsoft SQL server from the Linux command line.</p>
<div align="center">

<a href='http://www.foscode.com/?attachment_id=868' title='sqsh'><img width="150" height="93" src="http://www.foscode.com/wp-content/uploads/2011/09/sqsh-150x93.gif" class="attachment-thumbnail" alt="sqsh" title="sqsh" /></a>

</div>
<p><span id="more-850"></span><br />
Sqsh (pronounced skwish) is short for SQshelL (pronounced s-q-shell), it is intended as a replacement for &#8216;isql&#8217;, supplied by Sybase. Sqsh is intended to provide much of the functionality provided by a good shell, such as variables, redirection, pipes, back-grounding, job control, history, command completion, and dynamic configuration. Sqsh has quite a few features, this is just a short list, for detailed explanation and examples please <a href="http://www.sqsh.org/sqsh_features.html"  target="_blank">visit their site here.</a></p>
<p>. Provides all commands provided by isql<br />
. Variables are provided in sqsh, much in the same way they are used within a standard shell<br />
. Redirection &#038; Pipes<br />
. As of release 1.2, sqsh supports full csh-style command aliasing<br />
. Command substitution<br />
. Backgrounding &#038; Job Control<br />
. SQL Batch History<br />
. Configurable Exit Status<br />
. Ability to transfer the result set from any command batch to another server (or even the same server) via the Sybase bcp protocol<br />
. Remote Procedure Calls<br />
. Simple Scripting</p>
<p>Now that you know what sqsh does, let&#8217;s go ahead and install and start using it. If you are running Ubuntu, it is very easy, just do:</p>
<pre class="brush: bash">
sudo apt-get install freetds
sudo apt-get install sqsh
</pre>
<p>You might also need a couple of other libraries installed depending on your setup, but the 2 apps above should contain everything you need.<br />
If not running Ubuntu, get <a href="http://sourceforge.net/projects/sqsh/files/" target="_blank">sqsh&#8217;s latest source from sourceforge</a> and follow the install steps in the Install document inside the tar file you will be downloading.</p>
<p>Now that both freetds and sqsh have been installed, go ahead and create an entry at the end of the file /etc/freetds/freetds.conf that includes the M$Sql server you&#8217;ll be accessing:</p>
<p>/etc/freetds/freetds.conf</p>
<pre class="brush: bash">
[MSuck]
        host = msuckserver
        port = 1433
        tds version = 8.0
</pre>
<p>Now create the sqsh configuration file containing your credentials and any other setting you&#8217;d like to have predefined. This file must reside in your home directory, otherwise you&#8217;ll have to start sqsh with the -r flag, which specifies the path and file to be used instead:</p>
<p>-r [sqshrc[:sqshrc ...]]</p>
<p>Specifies an alternate .sqshrc file to be processed, rather than the default. If no sqshrc is<br />
supplied following -r, then no initialization files are processed. This flag must be the<br />
first argument supplied on the command line, all other instances will be ignored.</p>
<p>So, let&#8217;s do it, create the new file .sqshrc and add your settings (obviously change each of the settings to match your own):</p>
<p>~/.sqshrc</p>
<pre class="brush: html">
user@laptop:~$ vim ~/.sqshrc

\set username=msqlloginname
\set password=msqlloginpassword
\set database=msqldbname
\set style=vert
</pre>
<p>Now you have both freetds and sqsh installed and configured, just go ahead and run it. For more information, options and in depth usage <a href="http://www.sqsh.org/sqsh_man.html" target="_blank">see the manual</a>, or as one of my bosses used to say RTFM (read the fine manual) <img src='http://www.foscode.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />        </p>
<pre class="brush: html">
user@laptop:~$ sqsh -SMSuck

sqsh-2.1 Copyright (C) 1995-2001 Scott C. Gray
This is free software with ABSOLUTELY NO WARRANTY
For more information type &#039;\warranty&#039;
1&gt; select field1, field2, field3 from table where field1 = &#039;test&#039;;
2&gt; go
field1: test
field2: other data
field3: 

(1 row affected)
1&gt; exit
user@laptop:~$
</pre>
<p>That&#8217;s it, you are now able to connect to a Microsoft SQL server from the command line in Linux and manipulate your data as you wish. Hopefully this tutorial helped you. Thank you for stopping by and please share with others, after all, code should be free.<a href="http://www.foscode.com/wp-content/uploads/2010/04/foscode_logo_sm.png"><img src="http://www.foscode.com/wp-content/uploads/2010/04/foscode_logo_sm.png" alt="foscode.com | because code should be free" title="FOSCODE" width="227" height="18" class="alignright size-full wp-image-221" /></a></p>
<p>The post <a href="http://www.foscode.com/connect-microsoftsql-server-from-linux/">How to connect to Microsoft SQL server from Linux via command line</a> appeared first on <a href="http://www.foscode.com">foscode</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.foscode.com/connect-microsoftsql-server-from-linux/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced

Served from: www.foscode.com @ 2013-05-23 16:33:15 -->