<?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>MoNoNoKe blogs</title>
	<atom:link href="http://blog.mononoke.nl/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mononoke.nl</link>
	<description>A few words from the MoNoNoKe folks</description>
	<lastBuildDate>Thu, 26 Aug 2010 16:47:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Things that make me feel girly</title>
		<link>http://blog.spiderwebz.nl/?p=373</link>
		<comments>http://blog.spiderwebz.nl/?p=373#comments</comments>
		<pubDate>Thu, 26 Aug 2010 16:38:03 +0000</pubDate>
		<dc:creator>spider</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.spiderwebz.nl/?p=373</guid>
		<description><![CDATA[It&#8217;s my day off today and my boyfriend is out working and visiting his brothers. Time for a girls night in!
It was raining cats and dogs this afternoon, but I didn&#8217;t care, I even liked it. Twirling my umbrella around, watching people who tr...]]></description>
			<content:encoded><![CDATA[It&#8217;s my day off today and my boyfriend is out working and visiting his brothers. Time for a girls night in!
It was raining cats and dogs this afternoon, but I didn&#8217;t care, I even liked it. Twirling my umbrella around, watching people who tried to stay as dry as possible, I searched the local bookstores [...]]]></content:encoded>
			<wfw:commentRss>http://blog.spiderwebz.nl/?feed=atom&amp;p=373</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Canonical implementing userbase tracking</title>
		<link>http://r3blog.nl/index.php/archives/2010/08/10/canonical-implementing-userbase-tracking/</link>
		<comments>http://r3blog.nl/index.php/archives/2010/08/10/canonical-implementing-userbase-tracking/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 11:40:32 +0000</pubDate>
		<dc:creator>r3boot</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://r3blog.nl/?p=226</guid>
		<description><![CDATA[A quote from a Phoronix page found here: When the canonical-census package is installed, the program is to be added to the daily Cron jobs to be executed so that each day it will report to Canonical over HTTP the number of times this system previously ...]]></description>
			<content:encoded><![CDATA[A quote from a Phoronix page found here: When the canonical-census package is installed, the program is to be added to the daily Cron jobs to be executed so that each day it will report to Canonical over HTTP the number of times this system previously sent to Canonical (this counter is stored locally and [...]]]></content:encoded>
			<wfw:commentRss>http://r3blog.nl/index.php/archives/2010/08/10/canonical-implementing-userbase-tracking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Singleton pattern in Python</title>
		<link>http://text.maze.io/2010/07/23/singleton-pattern-in-python</link>
		<comments>http://text.maze.io/2010/07/23/singleton-pattern-in-python#comments</comments>
		<pubDate>Fri, 23 Jul 2010 19:45:34 +0000</pubDate>
		<dc:creator>maze</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://text.maze.io/2010/07/23/singleton-pattern-in-python</guid>
		<description><![CDATA[
Just came up with a simple pattern for singletons in Python using a class decorator:

def singleton(cls):
    instances = {}
    def instance():
        if cls not in instances:
            instances[cls] = cls()
        return instances[cls]
    retu...]]></description>
			<content:encoded><![CDATA[
<p>Just came up with a simple pattern for <a class="reference external" href="http://en.wikipedia.org/wiki/Singleton_pattern">singletons</a> in Python using a <a class="reference external" href="http://www.python.org/dev/peps/pep-0318/">class decorator</a>:</p>
<pre class="literal-block">
def singleton(cls):
    instances = {}
    def instance():
        if cls not in instances:
            instances[cls] = cls()
        return instances[cls]
    return instance
</pre>
<p>Little demo:</p>
<pre class="literal-block">
&gt;&gt;&gt; &#64;singleton
... class Foo(object):
...     pass
...
&gt;&gt;&gt; f1 = Foo()
&gt;&gt;&gt; print id(f1)
3077430124
&gt;&gt;&gt; f2 = Foo()
&gt;&gt;&gt; print ...</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.mononoke.nl/2010/07/23/singleton-pattern-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>href.be services ported to GAE</title>
		<link>http://text.maze.io/2010/07/23/href-be-services-ported-to-gae</link>
		<comments>http://text.maze.io/2010/07/23/href-be-services-ported-to-gae#comments</comments>
		<pubDate>Fri, 23 Jul 2010 12:50:01 +0000</pubDate>
		<dc:creator>maze</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://text.maze.io/2010/07/23/href-be-services-ported-to-gae</guid>
		<description><![CDATA[
The short URL service at http://href.be/ now runs on Google App Engine. It uses the latest version of Django and thanks to the App Engine it uses BigTable as its storage backend.
This migration will surely result in a better availability and responsiv...]]></description>
			<content:encoded><![CDATA[
<p>The short URL service at <a class="reference external" href="http://href.be/">http://href.be/</a> now runs on <a class="reference external" href="http://code.google.com/appengine/">Google App Engine</a>. It uses the latest version of Django and thanks to the App Engine it uses <a class="reference external" href="http://labs.google.com/papers/bigtable.html">BigTable</a> as its storage backend.</p>
<p>This migration will surely result in a better availability and responsiveness of the service!</p>
<p>While we ...</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mononoke.nl/2010/07/23/href-be-services-ported-to-gae/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>href.be tools</title>
		<link>http://text.maze.io/2010/07/22/href-be-tools</link>
		<comments>http://text.maze.io/2010/07/22/href-be-tools#comments</comments>
		<pubDate>Thu, 22 Jul 2010 17:22:46 +0000</pubDate>
		<dc:creator>maze</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://text.maze.io/2010/07/22/href-be-tools</guid>
		<description><![CDATA[
Just pushed some tools to the Python Package Index to integrate the http://href.be/ short URL service with your Python and/or Django software:

python-href
django-href

Also, the service API now offers click statistics for your shortened URL&#8217;s, ...]]></description>
			<content:encoded><![CDATA[
<p>Just pushed some tools to the <a class="reference external" href="http://pypi.python.org">Python Package Index</a> to integrate the <a class="reference external" href="http://href.be/">http://href.be/</a> short URL service with your Python and/or Django software:</p>
<ul class="simple">
<li><a class="reference external" href="http://pypi.python.org/pypi/href">python-href</a></li>
<li><a class="reference external" href="http://pypi.python.org/pypi/django-href">django-href</a></li>
</ul>
<p>Also, the service API now offers click statistics for your shortened URL&#8217;s, so you can keep track of your outgoing links.</p>
<p>In ...</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mononoke.nl/2010/07/22/href-be-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python ternary operation</title>
		<link>http://text.maze.io/2010/07/22/python-ternary-operation</link>
		<comments>http://text.maze.io/2010/07/22/python-ternary-operation#comments</comments>
		<pubDate>Thu, 22 Jul 2010 14:26:05 +0000</pubDate>
		<dc:creator>maze</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://text.maze.io/2010/07/22/python-ternary-operation</guid>
		<description><![CDATA[
Python has no ternary operation, or has it? At least not directly, we had a discussion about possible solutions in the #python IRC channel on FreeNode and after some filddling I came up with this hack abusing the Python slicing magic:

class Ternary(o...]]></description>
			<content:encoded><![CDATA[
<p><a class="reference external" href="http://python.org">Python</a> has no <a class="reference external" href="http://en.wikipedia.org/wiki/Ternary_operation">ternary operation</a>, or has it? At least not directly, we had a discussion about possible solutions in the <a class="reference external" href="http://pound-python.org/">#python IRC channel</a> on <a class="reference external" href="http://www.freenode.net/">FreeNode</a> and after some filddling I came up with this hack abusing the Python slicing magic:</p>
<pre class="literal-block">
class Ternary(object):
    '''
    Ternary-ish emulation, it looks like C-style ...</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.mononoke.nl/2010/07/22/python-ternary-operation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>We&#039;re in this together</title>
		<link>http://text.maze.io/2010/07/13/we-re-in-this-together</link>
		<comments>http://text.maze.io/2010/07/13/we-re-in-this-together#comments</comments>
		<pubDate>Tue, 13 Jul 2010 13:24:47 +0000</pubDate>
		<dc:creator>maze</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://text.maze.io/2010/07/13/we-re-in-this-together</guid>
		<description><![CDATA[
A song by Nine Inch Nails, called We&#8217;re In This Together. It reminds me of current times, so this one is for my lovely fiancé:

I've become impossible
Holding on to when
When everything seemed to matter more
The two of us
All used and beaten up...]]></description>
			<content:encoded><![CDATA[
<p>A song by Nine Inch Nails, called <a class="reference external" href="http://www.youtube.com/watch?v=K1Zulx4mjHk">We&#8217;re In This Together</a>. It reminds me of current times, so this one is for my lovely fiancé:</p>
<pre class="literal-block">
I've become impossible
Holding on to when
When everything seemed to matter more
The two of us
All used and beaten up
Watching ...</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.mononoke.nl/2010/07/13/were-in-this-together/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python and net-snmp</title>
		<link>http://blog.ar-ix.net/archives/9</link>
		<comments>http://blog.ar-ix.net/archives/9#comments</comments>
		<pubDate>Thu, 08 Jul 2010 21:26:37 +0000</pubDate>
		<dc:creator>Fugu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.ar-ix.net/?p=9</guid>
		<description><![CDATA[Some of you may know that i have a 19&#8243; rack at home with some interesting hardware in it. Some of this hardware also provides a couple of hundreds of gigabytes of storage. But that system takes about 3 maybe &#8230; <a href="http://blog.ar-ix.net/archives/9">Continue reading <span>&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Some of you may know that i have a 19&#8243; rack at home with some interesting hardware in it. Some of this hardware also provides a couple of hundreds of gigabytes of storage. But that system takes about 3 maybe 4 amps when it&#8217;s idling. Taken into account that 1 amp 24/7 costs me about 20 euros per month. So you can imagine that i don&#8217;t have all my equipment running 24/7.</p>
<p>Once in a while i use this system to put some files onto it and then i turn it off again. To be able to also do this remote i&#8217;ve bought myself an APC PDU (model AP9212) a couple of months ago. Since that time i always had an idea to automate a backup job which would perform the following steps for me:</p>
<ol>
<li>Turn on my storage system</li>
<li>Mount the backup share</li>
<li>Transfer the backup onto the share</li>
<li>Unmount the backup share</li>
<li>Send a shutdown command to my storage system</li>
<li>Turn of my storage system</li>
</ol>
<p>The day before yesterday i finally put my hands on this idea and started looking how i could get and set data to and from my PDU using SNMP. A while ago i already figured out the specific OID&#8217;s needed for this job.<br />
<span id="more-9"></span></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">.1.3.6.1.4.1.318.1.1.4.4.2.1.4.1 for the name of the first outlet (change the last digit to the corresponding port)<br />
<br />
and<br />
<br />
.1.3.6.1.4.1.318.1.1.4.4.2.1.3.1 for the status of the first outlet (change the last digit to the corresponding port)</div></div>
<p>So i started searching and reading and found that the net-snmp package comes with python bindings. The small example for an snmpget looked simple enough so i started programming. Within the hour i had written a small script that reads the names and statuses of all 8 ports. (see example code at the bottom of this post)</p>
<p>Unfortunately my hopes were up and this was all the easy part and i was stupid enough to think that an snmpset wouldn&#8217;t be much harder, ok in the end maybe it wasn&#8217;t but getting there&#8230;..</p>
<p>Documentation for the net-snmp python bindings isn&#8217;t widely available i discovered you pretty much have to rely on the README provided with the net-snmp package. Searching for code examples is a quest without suitable results (it returns a lot of snmpget examples which i didn&#8217;t need).</p>
<p>And while trying different ways to get my code working and actually controlling a port on my PDU did take me several hours. I ran into all sorts of errors for example when i used the following piece of code trying to get it to work:</p>
<div class="codecolorer-container python default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">infovar = netsnmp.<span style="color: black;">Varbind</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;.1.3.6.1.4.1.318.1.1.4.4.2.1.3.5&quot;</span>, <span style="color: #483d8b;">&quot;1&quot;</span><span style="color: black;">&#41;</span><br />
netsnmp.<span style="color: black;">snmpset</span><span style="color: black;">&#40;</span>infovar, Version = <span style="color: #ff4500;">1</span>, DestHost=<span style="color: #483d8b;">'192.168.2.3'</span>, Community=<span style="color: #483d8b;">'writecommunity'</span><span style="color: black;">&#41;</span></div></td></tr></tbody></table></div>
<p>i got this error:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">error: set: no type found for objectNone</div></div>
<p>ok so diving into the README once again i changed the first line to:</p>
<div class="codecolorer-container python default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">infovar = netsnmp.<span style="color: black;">Varbind</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;.1.3.6.1.4.1.318.1.1.4.4.2.1.3.5&quot;</span>, <span style="color: #483d8b;">&quot;0&quot;</span>, <span style="color: #483d8b;">&quot;1&quot;</span>, <span style="color: #483d8b;">&quot;INTEGER&quot;</span><span style="color: black;">&#41;</span></div></td></tr></tbody></table></div>
<p>now my code actually ran but nothing happened on my PDU&#8230; i thought. I started inspecting my network traffic because i was curious what actually was being sent to my PDU.  I made a pcap file with tcpdump and inspected it with wireshark and that showed me the response from the PDU:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">error-status: noSuchName (2)</div></div>
<p>Ok, so it was clear that somehow snmp couldn&#8217;t find this OID and wasn&#8217;t able to write a value to it. But how is that possible? i&#8217;m certain that my OID is right. So a lot of trying, searching, cursing and more cursing later i started digging in the net-snmp package.</p>
<p>In this package i found a unittest for the python snmp bindings so i&#8217;ve decided to enable the snmp daemon on my server and run this unittest and to my big suprise this worked including the snmpset method. And when i dug through the unittest code i found nothing really different from my code.</p>
<p>After careful reading the code over and over again i suddenly realised that they put a value in sysDescription.0 but their varbind looked like this:</p>
<div class="codecolorer-container python default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">netsnmp.<span style="color: black;">Varbind</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;sysDescription&quot;</span>, <span style="color: #483d8b;">&quot;0&quot;</span>, <span style="color: #483d8b;">&quot;a new description&quot;</span><span style="color: black;">&#41;</span></div></td></tr></tbody></table></div>
<p>and i realised that they split up sysDescription.0 in the varbind call so what if i do the same thing? so i started an snmpwalk to look at the values again and i made my varbind look like this:</p>
<div class="codecolorer-container python default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">netsnmp.<span style="color: black;">Varbind</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;enterprises&quot;</span>, <span style="color: #483d8b;">&quot;318.1.1.4.4.2.1.3.5&quot;</span>, <span style="color: #483d8b;">&quot;1&quot;</span>, <span style="color: #483d8b;">&quot;INTEGER&quot;</span><span style="color: black;">&#41;</span></div></td></tr></tbody></table></div>
<p>and when i ran my code again i saw that port 5 which i was testing on suddenly turned on i started cheering because this was the thing i was looking for, my code was working. (i added INTEGER into the call because without it it was still producing an error).</p>
<p>I hope that with this post i save some of you the same trouble i had to undergo. I can now continue writing my backupscript, i can now perform the first and last task now the ones that lie in between <img src='http://blog.ar-ix.net/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>The SNMP Get example (reading the names and statuses of port 1 through <img src='http://blog.ar-ix.net/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> </p>
<div class="codecolorer-container python default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br /></div></td><td><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff7700;font-weight:bold;">import</span> netsnmp<br />
<br />
HEADER = <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\0</span>33[95m'</span><br />
OKBLUE = <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\0</span>33[94m'</span><br />
OKGREEN = <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\0</span>33[92m'</span><br />
WARNING = <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\0</span>33[93m'</span><br />
FAIL = <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\0</span>33[91m'</span><br />
ENDC = <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\0</span>33[0m'</span><br />
<br />
<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">9</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; info = <span style="color: #483d8b;">&quot;.1.3.6.1.4.1.318.1.1.4.4.2.1.4.%i&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; control = <span style="color: #483d8b;">&quot;.1.3.6.1.4.1.318.1.1.4.4.2.1.3.%i&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; infovar = netsnmp.<span style="color: black;">Varbind</span><span style="color: black;">&#40;</span>info<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; infores = netsnmp.<span style="color: black;">snmpget</span><span style="color: black;">&#40;</span>infovar, Version = <span style="color: #ff4500;">1</span>, DestHost = <span style="color: #483d8b;">'192.168.2.3'</span>, Community=<span style="color: #483d8b;">'readcommunity'</span><span style="color: black;">&#41;</span><br />
<br />
&nbsp; &nbsp; controlvar = netsnmp.<span style="color: black;">Varbind</span><span style="color: black;">&#40;</span>control<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; controlres = netsnmp.<span style="color: black;">snmpget</span><span style="color: black;">&#40;</span>controlvar, Version = <span style="color: #ff4500;">1</span>, DestHost = <span style="color: #483d8b;">'192.168.2.3'</span>, Community=<span style="color: #483d8b;">'readcommunity'</span><span style="color: black;">&#41;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> controlres<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> == <span style="color: #483d8b;">'1'</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> HEADER + infores<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> + <span style="color: #483d8b;">' ... '</span> + OKGREEN + <span style="color: #483d8b;">'On'</span> + ENDC<br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">elif</span> controlres<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> == <span style="color: #483d8b;">'2'</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> HEADER + infores<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> + <span style="color: #483d8b;">' ... '</span> + OKBLUE + <span style="color: #483d8b;">'Off'</span> + ENDC<br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">elif</span> controlres<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> == <span style="color: #483d8b;">'3'</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> HEADER + infores<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> + <span style="color: #483d8b;">' ... '</span> + WARNING + <span style="color: #483d8b;">'Rebooting'</span> + ENDC<br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">else</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> HEADER + infores<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> + <span style="color: #483d8b;">' ... '</span> + FAIL + <span style="color: #483d8b;">'Error'</span> + ENDC</div></td></tr></tbody></table></div>
<p>The SNMP set example (setting port 5 to status On)</p>
<div class="codecolorer-container python default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff7700;font-weight:bold;">import</span> netsnmp<br />
<br />
HEADER = <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\0</span>33[95m'</span><br />
OKBLUE = <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\0</span>33[94m'</span><br />
OKGREEN = <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\0</span>33[92m'</span><br />
WARNING = <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\0</span>33[93m'</span><br />
FAIL = <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\0</span>33[91m'</span><br />
ENDC = <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\0</span>33[0m'</span><br />
<br />
var = netsnmp.<span style="color: black;">Varbind</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'enterprises'</span>, <span style="color: #483d8b;">'318.1.1.4.4.2.1.3.5'</span>, <span style="color: #483d8b;">'1'</span>, <span style="color: #483d8b;">'INTEGER'</span><span style="color: black;">&#41;</span><br />
res = netsnmp.<span style="color: black;">snmpset</span><span style="color: black;">&#40;</span>var, Version = <span style="color: #ff4500;">1</span>, DestHost=<span style="color: #483d8b;">'192.168.2.3'</span>, Community=<span style="color: #483d8b;">'writecommunity'</span><span style="color: black;">&#41;</span></div></td></tr></tbody></table></div>
<p>Use code at your own risk, i only posted it to provide an example of how it can be done. Also the ip address of my PDU and community string have been changed, change to your needs if you want to try it. If you have any questions, comments or compliments please leave a comment below.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ar-ix.net/archives/9/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blog Live</title>
		<link>http://blog.ar-ix.net/archives/1</link>
		<comments>http://blog.ar-ix.net/archives/1#comments</comments>
		<pubDate>Wed, 07 Jul 2010 22:00:18 +0000</pubDate>
		<dc:creator>Fugu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.ar-ix.net/?p=1</guid>
		<description><![CDATA[Hi,
I&#8217;ve just installed my new blog, soon i will add some posts with things that i come across and/or keep me busy during my daily life  
]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>I&#8217;ve just installed my new blog, soon i will add some posts with things that i come across and/or keep me busy during my daily life <img src='http://blog.ar-ix.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ar-ix.net/archives/1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Men and housekeeping</title>
		<link>http://blog.spiderwebz.nl/?p=367</link>
		<comments>http://blog.spiderwebz.nl/?p=367#comments</comments>
		<pubDate>Thu, 17 Jun 2010 07:49:47 +0000</pubDate>
		<dc:creator>spider</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.spiderwebz.nl/?p=367</guid>
		<description><![CDATA[I always hear a lot of women complaining about their husbands or boyfriends because they don&#8217;t help out keeping the house neat and tidy. They are frustrated, complain a lot, hold grudges and sometimes can&#8217;t enjoy being together anymore. Wel...]]></description>
			<content:encoded><![CDATA[I always hear a lot of women complaining about their husbands or boyfriends because they don&#8217;t help out keeping the house neat and tidy. They are frustrated, complain a lot, hold grudges and sometimes can&#8217;t enjoy being together anymore. Well, there is a solution!
First of all, don&#8217;t expect your partner to have a magic touch. [...]]]></content:encoded>
			<wfw:commentRss>http://blog.spiderwebz.nl/?feed=atom&amp;p=367</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
