<?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>Bacon and Tech &#187; Network Management</title>
	<atom:link href="http://www.baconandtech.com/category/network-management/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.baconandtech.com</link>
	<description>Because everything's better with bacon</description>
	<lastBuildDate>Wed, 28 Jul 2010 23:08:07 +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>Using rrdgraph&#8217;s &#8211;right-axis options</title>
		<link>http://www.baconandtech.com/2010/06/08/using-rrdgraphs-right-axis-options/</link>
		<comments>http://www.baconandtech.com/2010/06/08/using-rrdgraphs-right-axis-options/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 02:47:24 +0000</pubDate>
		<dc:creator>gabrielle</dc:creator>
				<category><![CDATA[Network Management]]></category>
		<category><![CDATA[nms]]></category>
		<category><![CDATA[rrdtool]]></category>

		<guid isPermaLink="false">http://www.baconandtech.com/?p=119</guid>
		<description><![CDATA[So, say I have an interface that's dropping packets.  Not too many, but the ideal number is zero, so I'd like to see them in the graphs in our NMS (which is based on <a href="http://oss.oetiker.ch/rrdtool/" target="new">rrdtool</a>  as all decent NMSes are).  I can read the average rate of dropped packets in the graph key at the bottom,  and there are tiny little blips in the graph, but I don't have a strong visual cue that something is off.]]></description>
			<content:encoded><![CDATA[<p>(Note:  This is a very simplified (but real-life!) example.  Usually we&#8217;ll include the &#8220;in&#8221; data on the same graph, and Errors and QueueDrops etc, but that clutters up the example.)</p>
<p>So, say we have an interface that&#8217;s dropping packets.  Not too many, but the ideal number is zero, so we&#8217;d like to see them in the graphs in our NMS (which is based on <a href="http://oss.oetiker.ch/rrdtool/" target="new">rrdtool</a>  as all decent NMSes are).  We use rrdgraph to show packets out in black and packets that should have gone out, but were discarded instead in purple:</p>
<p><code>rrdtool graph images/router-errors-unscaled.png \<br />
    --title "unscaled" \<br />
    --vertical-label 'Pkts/Second' \<br />
    --start end-2day \<br />
    --end -1hr \<br />
    --width 800 \<br />
    --height 250 \<br />
    --imgformat PNG \<br />
    --interlace \<br />
    DEF:ifOutUcastPkts=router.rrd:ifOutUcastPkts:AVERAGE \<br />
    DEF:ifOutNUcastPkts=router.rrd:ifOutNUcastPkts:AVERAGE \<br />
    DEF:ifOutDiscards=router.rrd:ifOutDiscards:AVERAGE \<br />
    CDEF:ifOutPkts=ifOutUcastPkts,ifOutNUcastPkts,+ \<br />
    LINE1:ifOutPkts#003300:ifOutPkts/sec \<br />
    LINE1:ifOutDiscards#990099:ifOutDiscards/sec\\n \<br />
    GPRINT:ifOutPkts:AVERAGE:"Avg ifOutPkts %1.2lf\\n" \<br />
    GPRINT:ifOutDiscards:MAX:"Max ifOutDiscards %1.2lf"</code></p>
<p>That produces a graph like this:</p>
<p><a href="http://www.baconandtech.com/wp-content/uploads/2010/06/router-errors-unscaled.png"><img src="http://www.baconandtech.com/wp-content/uploads/2010/06/router-errors-unscaled-150x150.png" alt="unscaled example graph" title="router-errors-unscaled" width="150" height="150" class="alignnone size-thumbnail wp-image-120" /></a></p>
<p>(Click on the thumbnails to get the full graphs.)</p>
<p>We can read the average rate of discarded packets in the graph key at the bottom,  and there are tiny little blips in the purple line that represents discards , but we don&#8217;t have a strong visual cue that something is off.</p>
<p>One possible solution is to scale up the discard values relative to the total packets.  A factor of 100 ought to do it.  Then we&#8217;ll use the <a href="http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html" target="new">&#8211;right-axis options to rrdgraph</a> to label the right-hand y-axis accordingly.</p>
<p>We add this CDEF to provide the scaling (the LINE1 etc commands will need to be altered accordingly;  you&#8217;ll see those in the final snippet):</p>
<p><code>CDEF:scaled_ifOutDiscards=ifOutDiscards,100,*</code></p>
<p>That gives us a graph that looks like this:</p>
<p><a href="http://www.baconandtech.com/wp-content/uploads/2010/06/router-errors-scaled.png"><img src="http://www.baconandtech.com/wp-content/uploads/2010/06/router-errors-scaled-150x150.png" alt="scaled example graph" title="router-errors-scaled" width="150" height="150" class="alignnone size-thumbnail wp-image-121" /></a></p>
<p>Note that it now looks like we&#8217;re dropping up to 70 packets/second &#8211; we still have to read the stats in the key at the bottom of the graph.  So let&#8217;s get the secondary y-axis correctly labeled &#038; scaled, with the following commands:</p>
<p><code>--right-axis-label 'Discards/Second'<br />
--right-axis 0.01:0</code></p>
<p>&#8211;right-axis-label prints the specified text along the right-hand axis.<br />
&#8211;right-axis [scale:shift] scales and/or shifts the tickmarks on the right axis <em>relative to the left axis</em>.  In this case, the new values we&#8217;re displaying are 100X the original values, so we need to scale our axis accordingly:  0.01.  More simply:  left/right = 1/100.  We don&#8217;t need to start at a value other than 0, so we set the shift value to 0.</p>
<p><a href="http://www.baconandtech.com/wp-content/uploads/2010/06/router-right-axis.png"><img src="http://www.baconandtech.com/wp-content/uploads/2010/06/router-right-axis-150x150.png" alt="example graph with second y-axis" title="router-right-axis" width="150" height="150" class="alignnone size-thumbnail wp-image-122" /></a></p>
<p>Hmmm&#8230;rrdtool has automatically converted our values to milli-units.  (Note the lower-case m in the labels.)  Let&#8217;s fix that with the &#8211;right-axis-format command:</p>
<p><code>--right-axis-format %1.1lf</code></p>
<p><a href="http://www.baconandtech.com/wp-content/uploads/2010/06/router-right-axis-format.png"><img src="http://www.baconandtech.com/wp-content/uploads/2010/06/router-right-axis-format-150x150.png" alt="example graph with second y-axis, formatted" title="router-right-axis-format" width="150" height="150" class="alignnone size-thumbnail wp-image-123" /></a></p>
<p>And that&#8217;s all there is to it!</p>
<p>The final rrdgraph command looks like this:<br />
<code>rrdtool graph images/router-right-axis-format.png \<br />
    --title "right-axis-format" \<br />
    --vertical-label 'Pkts/Second' \<br />
    --right-axis-label 'Discards/Second' \<br />
    --right-axis 0.01:0 \<br />
    --right-axis-format %1.1lf \<br />
    --start end-2day \<br />
    --end -1hr \<br />
    --width 800 \<br />
    --height 250 \<br />
    --imgformat PNG \<br />
    --interlace \<br />
    DEF:ifOutUcastPkts=router.rrd:ifOutUcastPkts:AVERAGE \<br />
    DEF:ifOutNUcastPkts=router.rrd:ifOutNUcastPkts:AVERAGE \<br />
    DEF:ifOutDiscards=router.rrd:ifOutDiscards:AVERAGE \<br />
    CDEF:scaled_ifOutDiscards=ifOutDiscards,100,* \<br />
    CDEF:ifOutPkts=ifOutUcastPkts,ifOutNUcastPkts,+ \<br />
    LINE1:ifOutPkts#003300:ifOutPkts/sec \<br />
    LINE1:scaled_ifOutDiscards#990099:ifOutDiscards/sec\\n \<br />
    GPRINT:ifOutPkts:AVERAGE:"Avg ifOutPkts %1.2lf\\n" \<br />
    GPRINT:ifOutDiscards:MAX:"Max ifOutDiscards %1.2lf"</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.baconandtech.com/2010/06/08/using-rrdgraphs-right-axis-options/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Guide: Ubuntu box as syslog server</title>
		<link>http://www.baconandtech.com/2008/11/10/quick-guide-ubuntu-box-as-syslog-server/</link>
		<comments>http://www.baconandtech.com/2008/11/10/quick-guide-ubuntu-box-as-syslog-server/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 20:16:42 +0000</pubDate>
		<dc:creator>gabrielle</dc:creator>
				<category><![CDATA[Network Management]]></category>
		<category><![CDATA[cisco]]></category>
		<category><![CDATA[syslog]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.baconandtech.com/?p=33</guid>
		<description><![CDATA[You need:
root/sudo access to a statically-addressed Ubuntu machine.  (It will need to be on whenever your router is on in order to get anything good out of this.)  This is your log host.
Enable access to your Cisco router.
Part 1: Set up your log host.
Step 1: before editing any of the files discussed below, be [...]]]></description>
			<content:encoded><![CDATA[<p>You need:<br />
root/sudo access to a statically-addressed Ubuntu machine.  (It will need to be on whenever your router is on in order to get anything good out of this.)  This is your log host.<br />
Enable access to your Cisco router.</p>
<p><strong>Part 1:</strong> Set up your log host.</p>
<p>Step 1: before editing any of the files discussed below, be sure to back them up, e.g.:<br />
<code>cp /etc/syslog.conf /etc/syslog.conf.dontmessthisup</code></p>
<p>Step 2: edit /etc/syslog.conf to include this:<br />
<code>#router logging<br />
local6.debug                    /var/log/cisco.log</code></p>
<p>This means &#8220;send all messages from facility local6, with a priority of debug or greater, to /var/log/cisco.log&#8221;.</p>
<p>(Note that the default facility for Cisco is local7; if you want/need to use the Cisco default, change the above accordingly.)</p>
<p>Step 3: create the log file I specified above:<br />
<code>sudo touch /var/log/cisco.log</code><br />
<span id="more-33"></span><br />
Step 4: make syslog listen to messages from remote machines:<br />
edit /etc/default/syslogd to include the -r option:<br />
<code>SYSLOGD="-r"</code></p>
<p>Step 5: restart the syslog daemon:<br />
<code>sudo /etc/rc2.d/S10sysklogd restart</code><br />
(or look up the process id using ps -ef, and kill -HUP it; or pkill -1 syslogd&#8230;  your choice.)</p>
<p>Step 6: test it:<br />
<code>logger -p local6.debug "is this working?"</code></p>
<p>cat /var/log/cisco.log, you should see the line above.</p>
<p>Now, we have a problem: we also see the message in some of the other log files in /etc/syslog.conf (such as /var/log/syslog, /var/log/messages, and /var/log/debug).<br />
We don&#8217;t want the messages from the router mixed in with the system messages (pet peeve alert)!  Edit /etc/syslog.conf to include exceptions for local6 anywhere we have an *.[whatever], like so:<br />
<code><br />
*.*;local6.none;\<br />
auth,authpriv.none        -/var/log/syslog</code></p>
<p>Restart the syslog daemon again.</p>
<p>Test it:<br />
<code>for each in debug info notice warn err crit alert emerg panic<br />
do<br />
logger -p local6.${each} "this should only go to cisco.log - ${each}"<br />
echo done with ${each}<br />
done</code></p>
<p>Check /var/log/cisco.log, /var/log/syslog, /var/log/debug, and /var/log/messages &#8211; messages should only be in cisco.log.</p>
<p>&#8212;<br />
<strong>Part 2: </strong>Configure your router to send messages to the log host.<br />
<code>config t<br />
logging [ip address of your ubuntu box]<br />
logging facility local6<br />
logging history [severity]<br />
logging on</code></p>
<p>Your version of IOS may require different commands.  Have fun with that.</p>
<p><code>&lt;0-7&gt;          Logging severity level<br />
emergencies    System is unusable                (severity=0)<br />
alerts         Immediate action needed           (severity=1)<br />
critical       Critical conditions               (severity=2)<br />
errors         Error conditions                  (severity=3)<br />
warnings       Warning conditions                (severity=4)<br />
notifications  Normal but significant conditions (severity=5)<br />
informational  Informational messages            (severity=6)   &lt;--<br />
debugging      Debugging messages                (severity=7)</code></p>
<p>Normally I stick with informational (sev=6); debugging may spew a huge amount of info.</p>
<p>Compare the logging buffer on your router (&#8220;sh logging&#8221;) with the file on your log server;  messages since you made the change should also be going to the server.  If not, make sure you can reach the log server from the router, and that port 514 isn&#8217;t blocked anywhere.</p>
<p>&#8212;<br />
<strong>Part 3:</strong> Rotation<br />
Once that&#8217;s working, set up the log rotation on your log host.<br />
Add this to /etc/logrotate.conf, below the &#8220;system-specific logs may be configured here&#8221;<br />
<code>/var/log/cisco.log {<br />
    missingok<br />
    compress<br />
    notifempty<br />
    daily<br />
    rotate 7<br />
    size 500k<br />
}</code></p>
<p>You may need to tinker around with these settings depending on how many messages you&#8217;re getting a day.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.baconandtech.com/2008/11/10/quick-guide-ubuntu-box-as-syslog-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
