<?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>Dirty Motherfucking Blog &#187; linux</title>
	<atom:link href="http://dirty-motherfucker.org/blog/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://dirty-motherfucker.org/blog</link>
	<description>All kinds of shit</description>
	<lastBuildDate>Wed, 04 Jan 2012 15:38:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-alpha-19620</generator>
		<item>
		<title>Integrate Progress Indicator in Console Output</title>
		<link>http://dirty-motherfucker.org/blog/2012/01/04/integrate-progress-indicator-in-console-output/</link>
		<comments>http://dirty-motherfucker.org/blog/2012/01/04/integrate-progress-indicator-in-console-output/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 15:38:39 +0000</pubDate>
		<dc:creator>gencha</dc:creator>
				<category><![CDATA[administration]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://dirty-motherfucker.org/blog/?p=355</guid>
		<description><![CDATA[I recently tried to use pv in a bash script so that it wouldn&#8217;t interfere with my concept of communicating overall progress to the user. When I usually like to do is to echo -n a description of the current task and then later echo either &#8220;Done.&#8221; or &#8220;Failed!&#8221; (or something similar). Obviously, that somewhat [...]]]></description>
			<content:encoded><![CDATA[<p>I recently tried to use <code>pv</code> in a bash script so that it wouldn&#8217;t interfere with my concept of communicating overall progress to the user.</p>
<p>When I usually like to do is to <code>echo -n</code> a description of the current task and then later <code>echo</code> either &#8220;Done.&#8221; or &#8220;Failed!&#8221; (or something similar).<br />
Obviously, that somewhat conflicts with <code>pv</code>. So here is the solution:</p>
<pre class="brush: bash; highlight: [11,12]; title: ; notranslate">
# Create backup archive
_statusMessage=&quot;Compressing installation...&quot;
echo -n $_statusMessage
if hash pv 2&gt;&amp;- &amp;&amp; hash gzip 2&gt;&amp;- &amp;&amp; hash du 2&gt;&amp;-; then
  echo
  _folderSize=`du --summarize --bytes $BASE | cut --fields 1`
  if ! tar --create --file - $BASE | pv --progress --rate --bytes --size $_folderSize | gzip --best &gt; $FILE; then
    echo &quot;Failed!&quot;
    exit 1
  fi
  # Clear pv output and position cursor after status message
  tput cuu 2 &amp;&amp; tput cuf ${#_statusMessage} &amp;&amp; tput ed
else
  if ! tar --create --gzip --file $FILE $BASE; then
    echo &quot;Failed!&quot;
    exit 1
  fi
fi

echo &quot;Done.&quot;
</pre>
<p>The snippet also shows how to conditionally use pv if it is available, which I really like.</p>
]]></content:encoded>
			<wfw:commentRss>http://dirty-motherfucker.org/blog/2012/01/04/integrate-progress-indicator-in-console-output/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Self-updating Bash Script</title>
		<link>http://dirty-motherfucker.org/blog/2011/12/22/self-updating-bash-script/</link>
		<comments>http://dirty-motherfucker.org/blog/2011/12/22/self-updating-bash-script/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 11:59:58 +0000</pubDate>
		<dc:creator>gencha</dc:creator>
				<category><![CDATA[administration]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://dirty-motherfucker.org/blog/?p=338</guid>
		<description><![CDATA[While working on the typo3scripts project, I wanted to implement a self-updating feature into each of the scripts as that seemed most convenient for where these scripts would be used. My initial approach was OK but left me wondering. So, here is the revised approach for a bash script that has the ability to update [...]]]></description>
			<content:encoded><![CDATA[<p>While working on the <a href="http://code.google.com/p/typo3scripts/" title="typo3scripts">typo3scripts</a> project, I wanted to implement a self-updating feature into each of the scripts as that seemed most convenient for where these scripts would be used. My <a href="http://stackoverflow.com/questions/8595751/is-this-a-valid-self-update-approach-for-a-bash-script" title="Self-updating bash script at StackOverflow">initial approach</a> was OK but left me wondering.</p>
<p>So, here is the revised approach for a bash script that has the ability to update itself:</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash

set -o nounset
set -o errexit

SELF=$(basename $0)

# The base location from where to retrieve new versions of this script
UPDATE_BASE=http://typo3scripts.googlecode.com/svn/trunk

# Self-update
runSelfUpdate() {
  echo &quot;Performing self-update...&quot;

  # Download new version
  echo -n &quot;Downloading latest version...&quot;
  if ! wget --quiet --output-document=&quot;$0.tmp&quot; $UPDATE_BASE/$SELF ; then
    echo &quot;Failed: Error while trying to wget new version!&quot;
    echo &quot;File requested: $UPDATE_BASE/$SELF&quot;
    exit 1
  fi
  echo &quot;Done.&quot;

  # Copy over modes from old version
  OCTAL_MODE=$(stat -c '%a' $SELF)
  if ! chmod $OCTAL_MODE &quot;$0.tmp&quot; ; then
    echo &quot;Failed: Error while trying to set mode on $0.tmp.&quot;
    exit 1
  fi

  # Spawn update script
  cat &gt; updateScript.sh &lt;&lt; EOF
#!/bin/bash
# Overwrite old file with new
if mv &quot;$0.tmp&quot; &quot;$0&quot;; then
  echo &quot;Done. Update complete.&quot;
  rm \$0
else
  echo &quot;Failed!&quot;
fi
EOF

  echo -n &quot;Inserting update process...&quot;
  exec /bin/bash updateScript.sh
}

# Update check
SUM_LATEST=$(curl $UPDATE_BASE/versions 2&gt;&amp;1 | grep $SELF | awk '{print $1}')
SUM_SELF=$(md5sum $0 | awk '{print $1}')
if [[ &quot;$SUM_LATEST&quot; != &quot;$SUM_SELF&quot; ]]; then
  echo &quot;NOTE: New version available!&quot;
fi
</pre>
<p>It also includes the update check which wasn&#8217;t discussed over at StackOverflow. In case I revise the approach yet again, you&#8217;ll find the latest version over at the <a href="http://code.google.com/p/typo3scripts/" title="Typo3Scripts Project Page">typo3scripts project page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://dirty-motherfucker.org/blog/2011/12/22/self-updating-bash-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running a Source dedicated server (for Left 4 Dead)</title>
		<link>http://dirty-motherfucker.org/blog/2008/12/26/running-a-source-dedicated-server-for-left-4-dead/</link>
		<comments>http://dirty-motherfucker.org/blog/2008/12/26/running-a-source-dedicated-server-for-left-4-dead/#comments</comments>
		<pubDate>Fri, 26 Dec 2008 21:18:31 +0000</pubDate>
		<dc:creator>gencha</dc:creator>
				<category><![CDATA[administration]]></category>
		<category><![CDATA[left4dead]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[steam]]></category>

		<guid isPermaLink="false">http://www.dirty-motherfucker.org/blog/?p=212</guid>
		<description><![CDATA[For a while now I have been running some dedicated servers for Source games. Primarily Team Fortress 2. I lately switched those off in favor of Left 4 Dead servers. I was always looking for a way to improve my setup. At some point during my initial googleing I came across this article. I based [...]]]></description>
			<content:encoded><![CDATA[<p>For a while now I have been running some dedicated servers for Source games. Primarily <a href="http://orange.half-life2.com/tf2.html">Team Fortress 2</a>. I lately switched those off in favor of <a href="http://www.l4d.com/">Left 4 Dead</a> servers. I was always looking for a way to improve my setup. At some point during my initial googleing I came across <a href="http://www.m0interactive.com/archives/2008/09/13/steam_linux_server_init_script_in_chrooted_environment.html">this article</a>.<br />
I based my startup script on the one in that article. But we&#8217;ll come back to that later. Let&#8217;s start with installation.<br />
The initial steps are laid out perfectly on <a href="http://www.srcds.com/">srcds.com</a>. But I&#8217;ll list everything important in here as well.</p>
<p>As all of my administration articles (so far) this one is for Ubuntu Server 8.04.1. </p>
<p>Let&#8217;s start by adding a new user that will run our servers.</p>
<pre class="brush: plain; title: ; notranslate">sudo adduser --disabled-login steam</pre>
<p>
Now to log in with the newly created user to install the servers. We need to switch the user as root as a normal user can not log into this account.</p>
<pre class="brush: plain; title: ; notranslate">sudo su - steam</pre>
<p>
No we can install the HLDSUpdateTool.</p>
<pre class="brush: plain; title: ; notranslate">wget http://www.steampowered.com/download/hldsupdatetool.bin
chmod +x hldsupdatetool.bin
./hldsupdatetool.bin
./steam</pre>
</p>
<p>In case it will hang at &#8220;Checking bootstrapper version&#8230;&#8221; you can try to set a set of preferred content servers. You do that by creating a file called &#8220;steam.cfg&#8221; and adding the following line to it:
<pre class="brush: plain; title: ; notranslate">PreferredContentServerIDs = &quot;id id id&quot;</pre>
<p>You can find the ids on <a href="http://store.steampowered.com/stats/content/">http://store.steampowered.com/stats/content/</a> under &#8220;Individual Server Statisistics&#8221;. Look for Valve #NN servers and place the number of the servers you want to use inside the quotes. Then retry running steam.</p>
<p>Now we&#8217;ll install a game. Let&#8217;s start out with Left 4 Dead. If you want to see what games are available, run:</p>
<pre class="brush: plain; title: ; notranslate">./steam -command list</pre>
<p>This will also show you the correct game identifier for Left 4 Dead, which is l4d_full (left4dead was for the demo).</p>
<pre class="brush: plain; title: ; notranslate">./steam -command update -game l4d_full -dir /home/steam</pre>
</p>
<p>In case the installation process hangs you can also try setting the preferred content servers as mentioned above. Now, theoretically you&#8217;re good to go and you can start your server. But we&#8217;re gonna go a step further. I use a start script based on the article mentioned at the start of this article. Now let&#8217;s grab it.<br />
But wait, in case you realize that you really don&#8217;t want to use any of my shitty scripts and that you just want to get a clean server running, in that case it can stilll be helpful to get the script. You see when you use my script and you start a profile it will print out the command line it used. That way you can build up your desired configuration according to this guide, then run the script and get the correct command line to run your server. Thus I still highly recommend getting the script.</p>
<pre class="brush: plain; title: ; notranslate">wget http://www.dirty-motherfucker.org/blog/wp-content/uploads/2008/12/steamLauncher.sh
chmod +x steamLauncher.sh
</pre>
</p>
<p>The script allows to easily start and stop Source servers in the background. It also allows for several profiles for several games. So you can start all games through the same interface. I like it, if you don&#8217;t then maybe have a look at the original script.</p>
<p>So let&#8217;s create a profile for Left 4 Dead.</p>
<pre class="brush: plain; title: ; notranslate">mkdir profiles
editor profiles/l4d.conf
</pre>
<p>
Now, this is how a profile should look like:</p>
<pre class="brush: plain; title: ; notranslate">longName                = Left 4 Dead - 1 instance      ; The name of this profile/game
gameName                = left4dead                     ; The name given by steam to the game (equals the foldername ex. cstrike|tf2|left4dead)
daemon                  = /home/steam/l4d/srcds_run     ; Usually srcds_run
updater                 = /home/steam/steam             ; Where is the updater located? (steam binary)
basePath                = /home/steam/l4d               ; The base path of the steam installation (this folder contains tf2/cstrike/left4dead folders)
userName                = steam                         ; What user the server should run as

serverName              = My L4D Server                 ; The name that will appear in the server browser
serverIp                = 11.222.33.111                 ; The IP address to bind the server socket to
serverPort              = 27010                         ; The first port to use for listening (will be treated as base port with forked l4d servers)
serverMap               = l4d_hospital01_apartment      ; The first map to load
serverMaxPlayers        = 4                             ; Maximum number of players allowed on the server
serverPriority          = 0                             ; Renice to set for the server process (-20 is high, 0 is normal, +19 is low)
forkCount               = 0                             ; How many instances to fork
additionalParams        = -nohltv -steamport 27960+## +clientport 25030+## +exec server##.cfg +sv_lan 0 ; Additional params to run the server with
</pre>
<p>
Obviously in that profile you need to adjust at least the serverIp parameter. Now you can run that profile by typing.</p>
<pre class="brush: plain; title: ; notranslate">./steamLauncher start l4d</pre>
<p>
Keep in mind though, this is not a state that we want to be comfortable with just yet. Nevertheless start it up and check if there is any trouble. If it comes up, attach to the screen session as the script tells you to.<br />
In case you get an error saying &#8220;Cannot open terminal &#8216;/dev/pts/0&#8242;&#8221;, you can run &#8220;script /dev/null&#8221; and then attach to the session. There are other ways to resolve it. If you wanna find out about those they&#8217;re easy to find in Google ;)</p>
<p>Now, in the profile of Left 4 Dead in the additionParameters we also tell the server to execute a certain config file. Let&#8217;s create that one now.</p>
<pre class="brush: plain; title: ; notranslate">editor l4d/left4dead/cfg/server01.cfg</pre>
<p>In here we can now override the default map, difficulty and whatnot. For example:
<pre class="brush: plain; title: ; notranslate">hostname        My L4D Server - No Mercy - Normal Difficulty
map             l4d_hospital01_apartment
m_difficulty    normal
</pre>
<p>Setting the difficulty and map is almost pointless though as they can be changed by vote anyway. But I&#8217;m sure you can think of some other server variables that you might want to set. And this is the place to do it.</p>
<p>Now might be a good time to talk about forking with Left 4 Dead servers. Given that there are only 4 or 8 players on a Left 4 Dead server it&#8217;s almost a waste only running a single instance. That&#8217;s why you can fork multiple instances of servers. Let&#8217;s have a look at a Left 4 Dead profile modified to run 4 servers.</p>
<pre class="brush: plain; title: ; notranslate">longName                = Left 4 Dead - 4 instances     ; The name of this profile/game
gameName                = left4dead                     ; The name given by steam to the game (equals the foldername ex. cstrike|tf2|left4dead)
daemon                  = /home/steam/l4d/srcds_run     ; Usually srcds_run
updater                 = /home/steam/steam             ; Where is the updater located? (steam binary)
basePath                = /home/steam/l4d               ; The base path of the steam installation (this folder contains tf2/cstrike/left4dead folders)
userName                = steam                         ; What user the server should run as

serverName              = My L4D Server                 ; The name that will appear in the server browser
serverIp                = 11.222.33.111                 ; The IP address to bind the server socket to
serverPort              = 27010                         ; The first port to use for listening (will be treated as base port with forked l4d servers)
serverMap               = l4d_hospital01_apartment      ; The first map to load
serverMaxPlayers        = 4                             ; Maximum number of players allowed on the server
serverPriority          = 0                             ; Renice to set for the server process (-20 is high, 0 is normal, +19 is low)
forkCount               = 4                             ; How many instances to fork
additionalParams        = -nohltv -steamport 27960+## +clientport 25030+## +exec server##.cfg +sv_lan 0 ; Additional params to run the server with
</pre>
<p>
You can now also create server02.cfg, server03.cfg and server04.cfg in the l4d folder. This way you can start up each instance with a different map, difficulty, key, &#8230;<br />
It remains a mystery to me how to properly send commands to the console with forked instances though. Although from what I read there are ways, but I just never had any luck with those. I also never had any luck with rcon. So basically when I play on my own servers I can&#8217;t do shit when someone is getting on my nerves. And we sure don&#8217;t want that!<br />
So what do we do? We install SourceMod. It gives us a nice and easy way to kick players when they get on our balls. And we can be happy little server admins. During the installation of SourceMod it may be helpful to run only a single instance profile of Left 4 Dead so you can easily attach to the screen session and send of some commands to test your installation.<br />
So let&#8217;s get to it!</p>
<p>First of all we require MetaMod. A very straight-forward guide can be found on the <a href="http://wiki.alliedmods.net/Installing_Metamod:Source">MetaMod Wiki</a>. For completeness sake I&#8217;ll replicate the required information here though.</p>
<ol>
<li>Download MetaMod at <a href="http://www.metamodsource.net/">http://www.metamodsource.net/</a></li>
<li>Put it into the left4dead folder. (cd l4d/left4dead)</li>
<li>tar xvzf mmsource-1.7.0.tar.gz (Filename might differ)</li>
<li>In l4d/left4dead/addons create a file metamod.vdf and put the following into it:
<pre class="brush: plain; title: ; notranslate">&quot;Plugin&quot;
{
        &quot;file&quot;  &quot;../left4dead/addons/metamod/bin/server_i486.so&quot;
}
</pre>
</li>
<li>Go back into your home directory and restart your server (./steamLauncher restart l4d)</li>
<li>Attach to the screen session and type &#8220;meta version&#8221;. Everything other than &#8220;Unknown command&#8221; is a good sign.</li>
</ol>
<p>If the installation of MetaMod fails, refer to the MetaMod Wiki or bug me about it.</p>
<p>Now we&#8217;re gonna install SourceMod. Again a proper guide can be found at <a href="http://wiki.alliedmods.net/Installing_SourceMod">http://wiki.alliedmods.net/Installing_SourceMod</a>.</p>
<ol>
<li>Grab one of the latest snapshots of SourceMod from <a href="http://www.sourcemod.net/snapshots-1.2.php">http://www.sourcemod.net/snapshots-1.2.php</a></li>
<li>Just like we did with MetaMod, put it into the l4d/left4dead folder.</li>
<li>Extract it via tar xvzf sourcemod-1.2.0-hg2469.tar.gz (Filename may differ again)</li>
<li>Go back into your home directory and restart your server (./steamLauncher restart l4d)</li>
<li>Attach to the screen session and type &#8220;meta list&#8221;. You should see that SourceMod is loaded.</li>
</ol>
<p>Now last but not least we need to set ourself up as an admin in SourceMod. We do that by editing
<pre class="brush: plain; title: ; notranslate">l4d/left4dead/addons/sourcemod/configs/admins_simple.ini</pre>
<p>
Right at the bottom we will now put the following line:
<pre class="brush: plain; title: ; notranslate">&quot;STEAM_YOURID&quot; &quot;99:z&quot;</pre>
<p>
If you&#8217;re like me then you&#8217;ll have no clue what your Steam ID is. So open up steam and connect to any server in any game. Then open up the console and type &#8220;status&#8221;. In the list that appears there should be your nick somewhere. And close to it, you&#8217;ll find your Steam ID.</p>
<p>Now you should be an admin on your Left 4 Dead servers. You can join your own servers easily by invoking &#8220;openserverbrowser&#8221; in the Left 4 Dead console. To enjoy being an admin it helps to bind &#8220;sm_admin&#8221; to some key. Then you can open the admin menu and kick those pesky players who just can&#8217;t stop running ahead to get themselves killed.</p>
<p>In case this isn&#8217;t clear. You&#8217;ll have to forward some ports for your servers to work. Which can easily be accomplished by adding two lines to your /etc/ufw/after.rules file. Similar to these two:</p>
<pre class="brush: plain; title: ; notranslate"># Steam TF2 Server
-A ufw-after-input -d 11.222.33.111 -m udp -p udp --dport 26900:27040 -m conntrack --ctstate NEW,RELATED,ESTABLISHED -j ACCEPT
-A ufw-after-input -d 11.222.33.111 -m tcp -p tcp --dport 27000:27020 -m conntrack --ctstate NEW,RELATED,ESTABLISHED -j ACCEPT
</pre>
</p>
<p>I hope I haven&#8217;t left any open questions. In case I did, please let me know ;)</p>
]]></content:encoded>
			<wfw:commentRss>http://dirty-motherfucker.org/blog/2008/12/26/running-a-source-dedicated-server-for-left-4-dead/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Setting up Cacti</title>
		<link>http://dirty-motherfucker.org/blog/2008/10/05/setting-up-cacti/</link>
		<comments>http://dirty-motherfucker.org/blog/2008/10/05/setting-up-cacti/#comments</comments>
		<pubDate>Sun, 05 Oct 2008 15:15:09 +0000</pubDate>
		<dc:creator>gencha</dc:creator>
				<category><![CDATA[administration]]></category>
		<category><![CDATA[cacti]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://dirty-motherfucker.org/blog/?p=141</guid>
		<description><![CDATA[So in the process of migrating our company network architecture over the paths months, I had the chance to set up Cacti for server monitoring. I followed some documentation and articles on the net but ended up making some stupid mistakes. So, let&#8217;s start with this. The host system Cacti will be running on, is [...]]]></description>
			<content:encoded><![CDATA[<p>So in the process of migrating our company network architecture over the paths months, I had the chance to set up <a href="http://www.cacti.net/">Cacti</a> for server monitoring. I followed some documentation and articles on the net but ended up making some stupid mistakes. So, let&#8217;s start with this.</p>
<p>The host system Cacti will be running on, is Ubuntu Server 8.04.1 with no prior modifications. I just installed all pending updates as of today of course. To reproduce this I&#8217;m running it in a VMWare virtual machine (just to make sure I&#8217;m not missing something important). The configuration of the systems that are being monitored is really not that important. As long as you can run an SNMP deamon on them.</p>
<p>Which brings me to the first thing I didn&#8217;t understand from the start. Cacti itself is the tool that is monitoring other servers. Of course you can monitor the machine that Cacti is running on as well, but the main point is, you don&#8217;t have to install it on every machine that you want to monitor.</p>
<p>We start off by installing MySQL-Server, as the configure process for Cacti can&#8217;t do that on it&#8217;s own.</p>
<pre class="brush: plain; title: ; notranslate">sudo apt-get install mysql-server -y</pre>
<p>We input a root password and that&#8217;s that with the MySQL-Server.</p>
<p>Now let&#8217;s install Cacti itself.</p>
<pre class="brush: plain; title: ; notranslate">sudo apt-get install cacti -y</pre>
<p>I configure it to use Apache2. And I use dbconfig-common for database configuration. Give it the MySQL-Server root password and then a password for the Cacti user. And then Cacti is installed.</p>
<p>Now we configure Cacti via the web interface. For the initial setup process you could just use w3m:</p>
<pre class="brush: plain; title: ; notranslate">w3m http://localhost/cacti</pre>
<p>But sooner or later you better get something with a GUI ;)</p>
<p>When you get to the login screen, give it the default login admin/admin. After that you have to give the admin account a new password. Congratulations, now Cacti is set up and ready to go.</p>
<p>So, when you click the Graphs tab now, you&#8217;ll most likely see nothing, or if you already waited for the poller to run for the first time, you see 4 (almost) empty graphs for localhost. These graphs are created by running scripts on the local host. I usually use SNMP to gather the data. So now we create a new device for the local host which is SNMP enabled. But for that, we first need to install the SNMP deamon.</p>
<pre class="brush: plain; title: ; notranslate">sudo apt-get install snmpd -y;
sudo vi /etc/default/snmpd</pre>
<p>What we want to change in /etc/default/snmpd is mainly the logging options. SNMDOPTS includes &#8220;-Lsd&#8221;, more suitable would be &#8220;-LS 0-5 d&#8221;. The original setting will log at a debug level and pollute the logfiles. The new one will only log important messages.<br />
At the end of SNMPDOPTS there is also a 127.0.0.1, this is the listening address. To monitor our host system this would be fine. But for additional machines, make sure to either remove it or adjust it to the correct listening address.</p>
<pre class="brush: plain; title: ; notranslate">sudo vi /etc/snmp/snmpd.conf</pre>
<p>In this file look for lines starting with com2sec. What you&#8217;re gonna want to do is, comment out the first line (the one for paranoid settings) and enable the second line, which allows read-only access.<br />
Now restart snmpd:</p>
<pre class="brush: plain; title: ; notranslate">sudo invoke-rc.d snmpd restart</pre>
<p>We&#8217;re not ready to create our new device.<br />
In Cacti, go to the console tab. Select &#8220;create Devices&#8221; from the list in the middle. Click Add in the upper right corner.<br />
Give the new device a proper name and supply the ip address. If you didn&#8217;t adjust the ip address in /etc/default/snmpd, then make sure to use 127.0.0.1 here.<br />
As the host template select &#8220;<strong>Generic SNMP-enabled Host</strong>&#8221; and at the bottom of the form, select &#8220;Version 1&#8243; as the SNMP Version.<br />
Now you can select SNMP as the Downed Device Detection as well. And that&#8217;s it.</p>
<p>Now, let&#8217;s first add a few more data sources. In the &#8220;Add data query&#8221; dropdown in the lower right, select &#8220;SNMP &#8211; Get mounted partitions&#8221; then click &#8220;Add&#8221; on the right. Repeat the process for &#8220;SNMP &#8211; Get Processor Information&#8221;.<br />
Now we&#8217;re ready to create some graphs.</p>
<p>Make sure that all the data queries have already returned successful results. The status will say &#8220;Success&#8221; and it will signal that some items have been returned. Especially the Processor information can take a while until valid data is returned. You can click the green circle to refresh the data. When you have proper data, click &#8220;<strong>Create Graphs for this Host</strong>&#8221; at the top of the page. Add all data queries for &#8220;<strong>SNMP &#8211; Get Mounted Partitions</strong>&#8221; and &#8220;<strong>SNMP &#8211; Get Processor Information</strong>&#8220;. For &#8220;<strong>SNMP &#8211; Interface Statistics</strong>&#8220;, select the eth interfaces you wanna monitor, then select the graph from the dropdown on the lower right. For example &#8220;<strong>Traffic (bytes/sec, Total Bandwidth)</strong>&#8220;. You can come back later to this screen to create more interface related graphs. Confirm the next screen with the &#8220;Create&#8221; button.</p>
<p>Now select the Devices from the menu on the left. Select your newly created device from the list, select &#8220;Place on a Tree (default Tree)&#8221; from the dropdown on the bottom right and click &#8220;Add&#8221;. Confirm by clicking &#8220;yes&#8221;.</p>
<p>Now go to the &#8220;graphs&#8221; tab again. As before, you&#8217;ll most likely see nothing when looking at your new device, just wait for it ;)</p>
<p>That should be sufficient to get you started. Have fun.</p>
]]></content:encoded>
			<wfw:commentRss>http://dirty-motherfucker.org/blog/2008/10/05/setting-up-cacti/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

