My quick video guide to de-boning quail… It’s a bit of a fiddly process, but the end result is worth it – these suckers have a lot to give!
How to Remove Data ‘Spikes’ from RRDs
If you are recording data into RRDs (for use with, e.g. Nagios, Nagiosgraph etc.) Sometimes you will notice that unreasonable data anomalies creep into the dataset due to the way that data is recorded during a non-standard event (e.g. the restart of a server etc.)
In my case, I found a situation where the Input and Output bandwidth of a Server NIC was incorrectly defined at -600Mb/s when there was a server restart — this is obviously an incorrect value, and I needed to clean this detail from my RRD in order to obtain a more realistic graph for the entire period.
There are one or two tools available for use in this case:
RemoveSpikes.pl – is an application written specifically for this purpose in mind, and apparently works OK. But I found that this script did not resolve my issue
RRD Editor – is a free cross-platform GUI application which is also designed for this purpose, but I found I had problems running this application (and did not persevere)
rrdtune - is a tool which is bundled with the ‘rrdtools’ toolset. I found that this application was able to normalise the results in my dataset and perform the task admirably
How to use rrdtune to eradicate spikes in RRD data:
The author’s instructions for using rrdtune are found here: http://oss.oetiker.ch/rrdtool/doc/rrdtune.en.html
I also found the following instructions on using rrdtune on the following (helpful) blog: http://kudithipudi.org/2004/03/18/rrdtool-how-to-remove-spikes/
cp filename.rrd filename.rrd.backup
Any good admin knows that before you mess with a file, you make a backup .
rrdtool info filename.rrd | more
This gives us the chance to get the ds (data sources) names
rrdtool tune filename.rrd –maximum (OR –minimum) ds_name:MAX/MIN_VALUE
Set the maximum of the ds to the required
rrdtool dump filename.rrd > filename.xml
Export all data in the rrd to a xml file
mv filename.rrd filename.rrd.old
Rename the rrd to make way for the new one.
rrdtool restore filename.xml filename.rrd -r
Restore the rrd from the xml file with the -r (range check) option. So any values that are higher than the new maximum value are ignored.
So the process is basically to:
The problem I experienced, was that I did not know what the correct ‘ds_name’ referred to… However, a little experimentation with the commands perfected the process for me.
The location of my ‘Nagiosgraph’ RRDs was: /var/spool/nagiosgraph/rrd/
The commands which I ran to successfuly change the MIN level for my RRD file are as follows:
Using the above mentioned command – it is possible to show the metrics which are available in the RRD file. See the screenshot above, where the ‘data’ metric refers to the ‘ds_name’ which I needed to use – currently it is not set to any specific threshold
This command successfully adjusted the minimum threshold for the ‘data’ metric to -500

Repeating the previous 'rrdtool info' command shows that adjustment of the minimum threshold for 'data' has been set to -500
This series of commands successfully eliminated the anomalous entry in the RRD file
How to Migrate MSSQL Database from Simple to Full Recovery Model
This blog posting is a follow up to my previous blog post (http://www.parksharp.net/?p=359) ‘Create MSSQL Maintenance Tasks’ and build upon the previous example by addressing the creation and management of Database Transaction Logs for the purpose of providing a more robust recovery option than is available with the so-called ‘Simple’ Recovery option.
The object of this post is to describe the process of migrating an MSSQL Database from the ‘SIMPLE’ Recovery Model (which has limited recovery potential) to the ‘FULL’ Recovery Model
There are three Recovery Models supported by the MSSQL Database Server:
Simple Recovery Model – Allows the database to be recovered to the most recent backup.
Full Recovery Model – Allows the database to be recovered to the point of failure.
Bulk Logged Recovery Model -Allows bulk-logged operations (can recover to the end of any backup)
Note: The differences between these recovery models is further and fully explained on the Microsoft MSDN website
Essentially, the Simple Recovery Model (which is the default configuration for SQL Server Personal Edition and SQL Server Desktop Engine (MSDE) products) minimises administrative overhead for the transaction log because the transaction log is not backed up. The Full recovery and Bulk Logged recovery models rely on a backed up transction log, and therefore provide greater protection for the data. The Full recovery model also supports restoration of individual data pages
The information provided on Microsoft’s MSDN website advises that a ‘database can be switched to another recovery model at any time’ and from my practical experience in executing a switch from Simple to Full Recovery model, I did not encounter any abnormal Database behaviour, and was not requested to Restart the Database and/or Server (which was helpful)
To view or change the Recovery Model of a Database (using MSSQL Server Management Studio)
Change the Recovery Model from Simple to Full
Create a Maintenance Plan to Backup the Database Transction Log:
Follow the instructions from my previous blog posting (http://www.parksharp.net/?p=359) to create a Database Transaction Log Backup Maintenance Plan
Manually Execute ‘Backup Database Transction Log’ Maintenance Job:
To ensure that the job is working, manually execute the job (by right-clicking on the item in ‘SQL Management Studio > Management > Maintenance Plans’ and choosing ‘Execute’
And Every 15 minutes, another Transaction Log is generated – the automated backup job is working as expected
Modify the Maintenance Job – Delete .TRN files if the ‘Backup Transaction Logs’ job fails
So now that the automated backup of transaction logs is in place, it is important to consider what happens if the Transaction Logs Backup job fails. In this case we want to delete the .TRN files which are older than one hour (in order to limit any issues which may be causing the problem)
Delete Transaction Logs after 3 days
We can delete the transaction logs after a reasonable period of time – In this example I am assuming that I will not have to roll-back database data using transaction logs for more than 3 days.
In my previous blog post (http://www.parksharp.net/?p=359) I described the configuration of another Daily Maintenance Task which generated a FULL Database Backup of all System Databases. The next step in the management of Transction Logs is to modify this Maintenance task to include another sub-task which deletes all Transaction Logs which are older than 3 days
Create Database Maintenance Tasks with Microsoft SQL Server Management Studio
The object of this blog post is to describe the process for correctly implementing Maintenance Tasks in MSSQL Server 2005
Firstly we should determine what type of Maintenance Tasks should be performed – In my case, I needed the following:
We then need to create a file structure on the server (ideally an independent ‘Backup’ storage location) which will accommodate the backups.
NOTE:For Virtual Machine Servers it is advised that independent system partitions are used for OS, Database Files and Backups to assist with performance
Configure the first Scheduled Maintenance Task – ‘Backup ALL Databases’
As an example, in this exercise we will configure the first maintenance task which is to Backup All System Databases (as the primary Maintenance Task) and to Delete Old Database Backups (as secondary sub-tasks of the Maintenance Job)
Manually Executing the Maintenance Task
Modify the Maintenance Task – Delete Old Database Backups (as sub-tasks)
Now that the directory structure for the ‘Daily’ backups is created – we should MODIFY the same job to add the ‘Cleanup/Maintenance Tasks’ (which will delete .bak files from each sub-directory after 7 days)
Remaining Tasks:
Repeat the above process for all your required Database Maintenance tasks – pay particular attention to the timing of independent maintenance tasks to ensure there are no conflicts (i.e. Your monthly Database Backup Task should not conflict with a Daily or Weekly Database Backup Task)
I was hoping to extend the wireless range of my home network so that I could stream HDTV (from MythTV box) to the furthest extremities of my property. After reviewing a number of internet forums, I realised that an appropriate (and relatively cheap – when considering the many features) device to achieve this in my network (without requiring installation of additional cabling) was the Asus RT-N16 wireless router (a cheaper Asus RT-N12 router was also a good possibility for this use)
I also decided to choose either of the Asus RT-N devices because of the ability to upgrade the default firmware in the device with the free-ware (and open-source) dd-wrt firmware, which provides a number of amazing features – and in my case, provided ‘Repeater-Bridge Mode’
The Website http://www.dd-wrt.com/site/support/router-database advertises that the RT-N16 wireless router is supported for installation of dd-wrt firmware
Instructions for installing this firmware are also provided by a wiki link on the dd-wrt site (mentioned above) http://www.dd-wrt.com/wiki/index.php/Asus_RT-N16, However, the dd-wrt wiki instructions indicated the installation/use of a later firmware option than shown in the screenshot above… I decided to follow the wiki instructions, and download the files:
In following the instructions provided on the dd-wrt wiki, I performed the following changes:
A progress bar is shown, and after approx. 3 minutes the firmware is loaded, and the browser automatically opens to the dd-wrt login screenNow you are done – Enjoy(!)
NOTE: Before reading and implementing the processes listed in this post, I must point out that the original outcome of my installation of nagiosgraph on my Ubuntu 10.04 system (as I had previously blogged) was a complete failure. It took me some weeks and experimentation to find out why I encountered problems, and how to resolve them, ultimately, this turned out to be due to the fact that I had modified my vanilla Nagios installation with the NConf configuration plugin, and there were some consequent configuration file dependencies which were broken. These issues have now been resolved, and the correct installation process is documented below:
The original posting of this blog article was subtitled ‘FAIL’ and I am humbled, but extremely grateful to Mathew Wall (Nagiosgraph developer) for reading and responding to this earlier blog with some information which encouraged me further in diagnosing the problems I encountered. The graphing utilities provided by nagiosgraph are extemely configuable and very useful. Perfect for my purposes!
[instructions taken from nagiosgraph README]
Nagiosgraph will not function without a working Nagios installation, so first ensure that Nagios works. Version 3.2 or later is recommended, but older versions will also work.
Nagiosgraph requires rrdtool. Version 1.4 or later is recommended, but older versions will also work.
Nagiosgraph requires the CGI and RRDs perl modules. The RRDs perl module is part of rrdtool but is often distributed as a separate package. The GD perl module is optional, but recommended. The Nagios::Object perl module is optional, but useful for automatic configuration of showgroup.cgi.
Nagios version 3.2 is installed (using the instructions explained in my earlier blog post)
Install rrdtool: [currently this installs version 1.3.8 on Ubuntu 10.10]
sudo apt-get install rrdtool
Install perl modules and libraries using ‘apt-get’:
sudo apt-get install librrds-perl libgd-gd2-perl libnagios-object-perl
Install Nagios-Object perl, GD and CGI modules using CPAN from a terminal command:
sudo perl -MCPAN -e shell cpan[1]> install Nagios::Object
cpan[2]> install GD cpan[3]> install CGIcpan[3]> exit
The current stable .deb package download (for installation on Debian or Ubuntu systems) is found at: http://sourceforge.net/projects/nagiosgraph/files/nagiosgraph/1.4.4/nagiosgraph-1.4.4-2.deb/download
cd to the directory where the download is saved
sudo dpkg -i nagiosgraph-1.4.4-2.deb
Before nagiosgraph can graph anything it must first collect data. There are two ways to process data – batch and immediate… we will be using batch processing
In batch processing, performance data are appended to a file, then nagios invokes insert.pl at a regular interval to update the RRD files.
Before starting – make a backup of nagios.cfg
sudo cp /etc/nagios3/nagios.cfg /etc/nagios3/nagios.cfg.bkp
(1) Using your favourite editor, set the following changes in the Nagios configuration file (nagios.cfg):
firstly, make the /var/nagios directory:
sudo mkdir /var/nagios
[Then: sudo gedit /etc/nagios3/nagios.cfg]
process_performance_data=1 service_perfdata_file=/var/nagios/perfdata.log service_perfdata_file_template=$LASTSERVICECHECK$||$HOSTNAME$||$SERVICEDESC$||$SERVICEOUTPUT$||$SERVICEPERFDATA$ service_perfdata_file_mode=a service_perfdata_file_processing_interval=30 service_perfdata_file_processing_command=process-service-perfdata
(2) Make sure that service_perfdata_command is either commented out or not defined.
(3) Make sure that location of service_perfdata_file matches that of perflog defined in nagiosgraph.conf
[I Left as default: "perflog=/tmp/perfdata.log]
(4) In the Nagios commands file (commands.cfg) define the process-service-perfdata command:
[Firstly, Take a backup of the original commands.cfg]
sudo cp /etc/nagios3/commands.cfg /etc/nagios3/commands.cfg.bkp sudo gedit /etc/nagios3/commands.cfg
define command {
command_name process-service-perfdata-for-nagiosgraph
command_line /usr/lib/nagiosgraph/insert.pl
}
(5) Restart nagios
sudo /etc/init.d/nagios3 restart
The web server must be configured to run the nagiosgraph CGI scripts.
The following directives are automatically added by the installation process to /etc/apache2/conf.d/nagiosgraph.conf
ScriptAlias /nagiosgraph/cgi-bin /usr/lib/cgi-bin/nagiosgraph
<Directory "/usr/lib/cgi-bin/nagiosgraph">
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Alias /nagiosgraph "/usr/share/nagiosgraph"
<Directory "/usr/share/nagiosgraph">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Restart the web server:
sudo /etc/init.d/apache2 restart
Verify that nagiosgraph is working by running showconfig.cgi
http://<your_server>/nagiosgraph/cgi-bin/showconfig.cgi
Try graphing some data by running show.cgi
http://<your_server>/nagiosgraph/cgi-bin/show.cgi
[from the nagiosgraph README]:
“…This should display a web page with a list of your hosts and services.
Note that it might take a few minutes for data to collect, so at first the
list of hosts and services might be sparse and the graphs might be empty.
There are a few ways to embed graphs into nagios. In the service and
host listings, Nagios will display graph icons that, when clicked, will
open a new web page with graphs. These icons are typically per-host
(linked to the showhost.cgi script) or per-host-service (linked to the
show.cgi script). Nagios will display graph data when the mouse is moved
over the graph icon for each host/service. Finally, graphs can be displayed
directly in the Nagios frames. The following sections explain how to do each
of these…”
Originally, I followed the instructions [as found in the nagiosgraph README] for modification of the default nagios configuration file: /etc/nagios3/nagios.cfg (or in my case, since I have configured my Nagios setup to be easily managed by NConf, my configuration file is /etc/nagios3/global/misccommands.cfg)… this led me into some problems which are documented below.
However, after a few installation retries, and in gaining some further understanding the configuration necessities of Nagiosgraph (and also my non-stanadard, but very helpful, NConf configuration), I found that the resolution to the main problem – I.e. Not being able to display graphing details because of a “No data in rrd directory /var/spool/nagiosgraph/rrd” error when going to the show.cgi webpage – was due to the fact that there was no “process-service-perfdata-for-nagiosgraph” command in the nagiosgraph configuration file(!)
The problem is documented below, and also some diagnostic information which may be helpful in trying to track down some similar issues:
Originally, in checking the ‘show.cgi’ page on my server, I received an error! – “No data in rrd directy /var/spool/nagosgraph/rrd”
I was able to reproduce the same error when I ran insert.pl from the commandline…
…But, if I ran the command as sudo, then it ran correctly… so the problem seemed to be related (at least in part) to some kind of permissions problem(!)
sudo chown -R nagios:nagios /var/spool/nagiosgraph/
sudo chmod -R 777 /var/spool/nagiosgraph/
This allowed me to run the insert.pl command without errors on the commandline… but I was still not seeing any data being written to /var/spool/nagiosgraph/rrd directory(!)
I then ran the command again and received the following error: “Cannot write to /var/log/nagiosgraph/nagiosgraph.log”. This was not a dramatic problem, but needed to be fixed
‘nagiosgraph.log’ existed… but it had incorrect file permissions assigned. I did the following:
sudo chown nagios:nagios /var/log/nagiosgraph/nagiosgraph.log
I checked the perl code in insert.pl incase there was some information on diagnosing problems, or running the script in a ‘debug mode’ etc… I found the following infomation:
CONFIGURATION
The nagiosgraph.conf file controls the behavior of this script
DIAGNOSTICS
Use the debug_insert setting in nagiosgraph.conf to control the amount of logging information that will be emitted by this script. Output will go to the nagiosgraph log file
The configuration file and ngshared.pm must be in this directory
use lib '/etc/nagiosgraph';
(1) I modified the ‘nagiosgraph.conf’ to provide detailed logging information…
Set ‘debug = 5′ (default was ’3′)
Uncomment ‘debug_insert = 5′ (in order to debug running of the ‘insert.pl’ script)
There were a lot more available (specific) debug levels which could be set, but I decided to keep it simple for now
(2) The configuration file ‘nagiosgraph.conf’ and the perl module ‘ngshared.pm’ were correctly installed into my /etc/nagiosgraph directory – but the directory and file permissions were not did not seem correct (Onwer = <unknown user>) and there were restrictive permissions on reading the files
sudo chown -R nagios:nagios /etc/nagiosgraph/
sudo chmod -R 775 /etc/nagiosgraph/
I also checked to see if there was any performance data being reported in the log: /var/nagios/perfdata.log… there was NO log, so I created one, and assigned permissions accordingly:
sudo touch /var/nagios/perfdata.log
sudo chown -R nagios:nagios /var/nagios/
sudo chmod -R 777 /var/nagios/
I then retried running the insert.pl script, with the following results – so it appears to be running OK, but not getting any data from the perfdata.log
I found a brief description online of how this whole process is supposed to work:
“…nagiosgraph gets its data from the “perfdata.log” file that is written by Nagios (to /var/spool/nagios by default). insert.pl is called by nagios, and reads the perfdata.log file to get the performance data and insert it into the RRD databases”
More searching revealed that my issue *could* be ‘Map file’ related – /etc/nagiosgraph/map
I also located a method for testing entries for ‘Map files’ by running: perl /usr/share/nagiosgraph/util/testentry.pl
Another internet post identified that:
“…insert.pl is probably not recognizing the plugin output/perfdata. if this is the case, you’ll see log messages about ‘perfdata not recognized’. to fix this, ensure that you have a map rule that matches the plugin output/perfdata. you can use testentry.pl to help with this. see also the section ‘Adding Service Types’ in INSTALL”
More internet searching exposed a possibility – check the Apache logs(!) /var/log/apache2/error.log – this indeed showed that there was “No data in rrd diretory /var/spool/nagiosgraph/rrd”
However, I found that the ‘commands’ required to populate rrd data were defined in the /etc/nagiosgraph/nagiosgraph-commands.cfg file. The only command defined in this (automatically generated file) was called process-service-perfdata-for-nagiosgraph and the associated command line paramater was defined in order to run insert.pl from the /usr/lib/nagiosgraph/ directory (which is correct)
So… the resolution to my issue was to ensure that this command was also correctly reflected in my nagios configuaration file: /etc/nagios3/global/misccomands.cfg (but in a standard nagios installation on Ubuntu, this would be (and should be added by default during the automated Nagiosgraph installation process) in the /etc/nagios3/commands.cfg file
Using SMTP, and a Nagios plugin called ‘Check_bandwidth3′ it is possible to monitor network traffic from Remote Windows hosts using Nagios3
In my case, the prerequisites were all satisified apart from the Perl SNMP module… install it like this:
sudo perl -MCPA -e shellinstall Net::SNMP
(We will later copy the ‘check_bandwidth3′ program to /usr/lib/nagios/plugins/ directory for usage…)
This is my Windows Client SNMP Configuration:
Set the SNMP to start Automatically, and Start the service
Then configure the ‘Agent’ according to the settings in the ‘Agent’ tab (shown below)…
Select the ‘Agent’ tab – add a ‘Contact’ and ‘Location’, and select the ‘Services’ which are appropriate to your configuration
Goto ‘Traps’ tab, add a ‘community name’ (e.g. SKDSNMP.RO) and click on ‘Add to List’ button…
In ‘Trap Destinations’ section of the same window, click on the ‘Add’ button to add a ‘Trap Destination’, then type the IP address of the Nagios Server, and Save changes…
In the ‘Security’ tab of the SNMP Service configuration, Add the ‘Community Name’ (which we nominated earlier) to the Communities which are able to be tranmitted via the network, and set this community to be READ ONLY…
Then, perhaps it is a good idea to add some security to the SNMP service by at least limiting access to the service by certain hosts (see service configuration change below where I have added the IP address of the Nagios host, and changed access by listed hosts only)
It *MAY* be necessary to modify the Firewall rules on the Windows Host to allow access by the SNMP port (UDP Port 161). This was certainly necessary on one of the Windows machines which I was monitoring before I could connect from the Nagios host using the ‘Check_bandwidth3′ plugin.
Our Windows Host should now be ready to serve SNMP information to our Nagios Server command-line… the output should be identical to the earlier test
sudo cp check_bandwidth3 /usr/lib/nagios/plugins/
We can now test to see if we can obtain the bandwidth information of a network interface on our remote Windows Client using the following command (on our Nagios Server)
sudo /usr/lib/nagios/plugins/check_bandwidth3 --interface v1://192.168.1.16/SKDSNMP.RO:1
The output from this command is shown below:
With a working ‘Nagios’ and ‘NConf’ configuration (see my earlier blog posts) we can now configure the Nagios server to use the ‘Check_bandwidth3′ plugin, along with the command-line attributes that we require (see ‘./check_bandwidth3 –help’) for full details on all available options.
Goto the administration view of NConf in a browser (probably http://yourhost/nconf).
Find in the menu on the left hand side of the screen an item called ‘Checkcommands’ and click on the ‘Add’ link. It will take you to a window (as shown below) where it is possible to configure a new base ‘Checkcommand’ which we will use to check bandwidth settings on our remote hosts
The new ‘Checkcommand’ form has some predefined fields which can be populated by details which we used in our command-line test (above). Here we can provide variables which will be injected into the command when it is being sent by Nagios to a remote host
Create the ‘Checkcommand’ as follows:
Checkcommand Name – [this can be any name you like, but pays to choose a sensible and meaningful name]
check_bandwidth3
Check Command Line – [this is the command which will be generated by Nagios when we are querying a remte host]
$USER1$/check_bandwidth3 --interface $ARG1$://$HOSTADDRESS$/$ARG2$:$ARG3$
Command description - [a description which will be helpful for the administrator to know what the Arguments to the above command refer to]
ARG1=Protocol Version,ARG2=SNMP Community, ARG3=NIC
Amount of Params – [this refers to the Number of Arguments which will be passed into the command when executed by Nagios]
Change this item to '3'
Now save the configuration of this new ‘Checkcommand’ – We will be referring to this in the next section (your configuration should look somthing like this):
Find in the menu on the left hand side of the screen an item called ‘Services’ and click on the ‘Add’ link. It will take you to a window (as shown below) where it is possible to configure a new host-specific ‘Service’ which we will use to administer our Windows Host
Add the following details in this form:
Service Name – Provide a unique name for this Host Specific service
Check Command – Choose from the pulldown menu the ‘Check_bandwidth3′ command (which we configured in the previous section)
Assigned to Host – Choose from the pulldown menu the host which we want to monitor (this host must have been configured to share SNMP details as discussed in the previous section)
Check Period – At this stage, we are keeping it simple, so choose the default ‘Check Period’ = 24×7
The settings should look similar to those shown in the screenshot above. Save these settings then click on ‘Services’ and click on the ‘Show’ link on the left hand side of the screen… choose the newly created ‘Service’ and click the corresponding icon (which looks like a pencil) on the Right-Hand side of the screen – this will allow you to edit the service settings (see below)
The interface will return you to a screen which is very similar to the one which we originally used to create the new ‘service’, however, now there are items at the bottom of the screen which can be edited in order to specify the variables which should be used as ‘Arguments’ when Nagios is sending the command to the specifed host… in this case, we want to:
- Use Version 1 of the SNMP protocol: [so ARG1 = v1]
- Use the Community Name: [so ARG2 = SKDSNMP.RO]
- Obtain details of the 1st NIC on the Windows Server which I am monitoring: [so ARG3 = 1]

Edit the Arguments which should be passed by Nagios to the 'Check_bandwidth3' plugin when monitoring THIS host
Click on the ‘Submit’ button to save your changes
Finally, we need to ‘Regenerate the Nagios Configuration’ in order to load the selected changes into the Nagios config files, and for the Nagios system to start monitoring this Host… Choose the item called ‘Generate Nagios Config’ from the menu on the Left-Hand side of the screen
The changes should take a few seconds to sync, and you should get the following response. Pay attention to the ‘Syntax Check’ at the bottom of the response… if there are any problems, expand this section and find out if there are any syntax issues with your newly created service’
At this point, Nagios should be configured to start monitoring bandwidth of your Windows host. It does take a few minutes for this configuration ch (anges to be displayed in your Nagios web front-end (Goto http://<your_host>/nagios3 – login, and choos the ‘Service Detail’ option on the Left-Hand side of the screen)
If your changes are not evident after a few minutes, it may be necessary to reload Nagios daemon.
sudo /etc/init.d/nagios3 reload
Eventually you should see the newly configured host-specific bandwidth monitoring service appear in the ‘Service Details’ section… it may look something like the following screenshot – but (as you can see) I have a permissions problem with the Nagios user not being able to write to the /tmp/traffic/192.168.1.16/1 directory
I can resolve this problem by performing the following commands (which are (1) a ‘recursive’ request to change ownership of the /tmp/.traffic directory for the ‘nagios’ user, and (2) a ‘recursive’ modification of privileges on the /tmp/.traffic directory to ensure that it is writable by the nagios process user):
sudo chown -R nagios:nagios /tmp/.traffic/
sudo chmod -R 755 /tmp/.traffic/
Checking the ‘Service Detail’ section of Nagios interface after a few minutes, I can see that the modification has allowed Nagios to report on the bandwidth of the remote Windows NIC
Addendum:
check_bandwidth3 checks on 64-bit Hosts
Since writing this blog post, I have been emailed on more than one occasion by users who have not been able to get the ‘check_bandwidth3′ Nagios plugin to work as it was described above.
I have not had the chance till now to test this functionality for myself due to having been using Nagios to monitor a predominantly 32-bit Windows Host environment. Today, I was able to confirm that the plugin indeed DOES work for checking bandwidth on 64-bit hosts, but enabling the functionality was somewhat different from what I expected and was used to from the 32-bit hosts which I had configured previously.
The configuration for a 64-bit host is indeed no different from that which must be considered (and has been documented above). The secret to receiving a reliable response from the 64-bit host is in correctly determining the so-called ‘Interface Number’ for the host which you are targeting.
I have said previously regarding the Windows 32-bit hosts that the (default, primary) NIC ‘Interface Number’ to target when executing a ‘check_bandwidth3′ command is often either ’1′ or ’65539′ (I have no idea why 65539 appears to be commonly used by the Windows environment for the default LAN NIC – it just is). In the case of the Windows Server 2008 R2 (64-bit) host which I configured today, I received (positive) replies from the ‘check_bandwidth3′ program which indicated ZERO network traffic was being transmitted via the (unused) ports – See example below:
Example 'check_bandwidth3' check on WRONG 'interface' of 64-bit Windows Host
In the above screenshot, I am logged in to the remote Nagios Server (using Putty) as the user = ‘nagios’ – this is important, because the user must have read/write access to the default storage location on the server where the data will be written to.
The SNMP Community String I am using = ‘Data’ and the Windows Host is configured to accept and return SNMP to the Nagios Host (as described in post above)
The important thing to notice in the above screenshot is that there is ZERO traffic being transmitted via the targeted ‘Interface’ (in this case, :1).
I do not yet have a foolproof way to identify the correct host ‘interface’ to target so, in my case, trial and error has been the method of choice (perhaps somebody can provide a mechanism which makes this task easier?). The screenshot below shows the ‘check_bandwidth3′ tests which I performed from the commandline on the Nagios server to identify the correct ‘Interface’ number to target. In my case, I was concurrently performing a large file transfer to the target host to be sure that I would notice when I identified the correct ‘Interface’ number.
Identifying the correct NIC 'Interface' number for 'check_bandwidth3' on Windows Host
The above screenshot shows the methodical iteration testing performed with the ‘check_bandwidth3′ on Nagios server command-line in order to identify that the correct ‘Interface’ number to target should be (in my case) #11
NOTE: you will also see that the last test performed (in the above screenshot) was for ‘Interface’ number = 12. This interface number returned a negative response from the ‘check_bandwidth’ program which seems to indicate that the other tested interfaces were apparently still ‘valid’ Windows Host interfaces, but were simply not correct for our purposes.
The last step in correctly configuring your Nagios installation is to correct your Nagios configuration (as described above) to change the ‘Interface’ number accordingly, then save changes
WD 250GB Hard Disk
2 GB RAM
Atheros Communications AR9285 Wireless NIC
JMicron Technology JMC250 PCI Gigabit Ethernet NIC
Intel N10 Family Integrated (VGA Compatible) Graphics Controller
Using (and embellishing upon) instructions for Installing Nagios and Nconf on Ubuntu 10.04 http://digitalcardboard.com/blog/2010/08/24/nagios-and-nconf-on-ubuntu-10-04-lucid-lynx/
Download and install Ubuntu 10.04
Install Ubuntu 10.04 on Asus EeeBox PC
Perform Ubuntu System Updates – (restart system if required)
If you didn’t check the box to configure your box as a LAMP (Linux, Apache, MySQL, PHP) server when you first setup your box, do that first with:
sudo apt-get install apache2 mysql-server mysql-client php5 libapache2-mod-php5
During the installation of these packages – Type a root password for mysql to continue
If you want phpMyAdmin (for web-based MySQL administration):
sudo apt-get install phpmyadmin
During installation:
- Choose ‘apache2′ as the ‘Webserver to reconfigure automatically’ for phpMyAdmin package
- Choose to ‘Configure database for phpmyadmin with dbconfig-common’
- Enter Admin Database user password (in order to make changes for phpmyadmin)
- Provide a phpmyadmin databasae user password
Install Nagios with
sudo apt-get install nagios3
During Installation/Configuration:
- Choose ‘Internet Site’ for mail server configuration
- Provide a ‘System Name’ (I left as ‘Nagios-Server’ <default>)
- Enter a Nagios Web Administrator Password
Test the installation by browsing to http://<yourserver>/nagios3
At this point, I could not log into the webserver at http://Nagios-Server/nagios3, using user = root, and password = <root password, as supplied>… But I was able to log into the mysql backend using the terminal, user = root, and the password = <root password, as supplied>
I thought perhaps this was a typo(?), so I found a mechanism for changing the password: Simply open a terminal and run the following command:
sudo htpasswd -c /etc/nagios3/htpasswd.users nagiosadmin – you are then requested the root password (for sudo privileges) then type a new ‘nagiosadmin’ password. Then it dawned on me… I needed to use the username = ‘nagiosadmin’ to view the administrative localhost nagiosadmin site at http://Nagios-Server/nagios3
I was able to log-in and test the configuration(!)
If you would like to monitor Windows servers using NSClient++ (which I am doing), also install the NRPE plugin with
sudo apt-get install nagios-nrpe-plugin
Backup the config files before you start messing with them, so I backed them up with
sudo cp -r /etc/nagios3 /etc/nagios3.backup
NConf provides a web-based frontend for configuring Nagios. There’s no package in the Ubuntu repositories for it, but you can download it pretty easily. Version 1.2.6 was the latest as of the time of this writing, so make sure you’re getting the latest version. (Note: it looks like the link below gets cut off, so here’s a link to the NConf download page where you can grab the latest source)
wget http://sourceforge.net/projects/nconf/files/nconf/1.2.6-0/nconf-1.2.6-0.tgz
sudo tar xzvf nconf-1.2.6-0.tgz -C /var/www
sudo chown -R www-data:www-data /var/www/nconf
Then browse to http://<yourserver>/nconf and follow the prompts (after clicking the ‘click here’ prompt beside the ‘Setup Required’ prompt on the RHS of the Admin page) to finish initial configuration of NConf.
When you get to the database configuration page – Go through the ‘Setup’ procedure: Fnter nconf for the username and the database name, and use the generated password you should have made a note of earlier. For most everything else, accept the defaults, but change the NAGIOS_BIN variable to /usr/sbin/nagios3 to reference the right location.
Finally, remove the folders and files referenced at the end of the installation process:
sudo rm -r /var/www/nconf/INSTALL sudo rm /var/www/nconf/INSTALL.php sudo rm -r /var/www/nconf/UPDATE sudo rm /var/www/nconf/UPDATE.php
At this point, you should be able to login to NConf, although it won’t be doing anything of importance (as yet)
At this point, Nagios is able to find at display working ‘services’ on ‘localhost’ and even established a ping service to my internet gateway without any user generated configuration – but defining new hosts within the NConf interface itself, and clicking Generate Nagios config, did not sync the changes back to Nagios – so the configration files do not seem to match…
We’ll need to make some changes to one of the Nagios configuration files, so (using sudo) open up /etc/nagios3/nagios.cfg in your favorite editor and delete or comment out all the lines that begin with cfg_dir= or cfg_file= and add the following lines:
cfg_dir=/etc/nagios3/global
cfg_dir=/etc/nagios3/Default_collector
It is then necessary to create the destination folders mentioned above:
sudo mkdir /etc/nagios3/global sudo mkdir /etc/nagios3/Default_collector
Then, back at the terminal, we run the following command to create a folder for NConf to dump the configuration files it generates.
sudo mkdir /etc/nagios3/import
Almost there. Using sudo, open up /var/www/nconf/ADD-ONS/deploy_local.sh and make the following changes to paths:
OUTPUT_DIR="/var/www/nconf/output/" NAGIOS_DIR="/etc/nagios3/"
and modify the command (in the file) to read:
/etc/init.d/nagios3 reload
NOTE: Also make sure this file is executable! (I had to "chmod 755" this file before I stopped getting nagios reload errors)
This script will deploy the generated configuration package and then reload the running instance of Nagios, but it’s easiest to use just installed in the root crontab.
sudo crontab -e
and adding the line
* * * * * /var/www/nconf/ADD-ONS/deploy_local.sh
After saving and closing the root crontab, log back into NConf and take a look around. You’ll see some sample definitions and some predefined services for the localhost computer. You may want to delete the check_local_mrtgtraf and check_local_procs services, as the first one doesn’t work without additional configuration and the second one is a sample definition, but you can make those changes at your leisure.
Once you’re ready, click Generate Nagios config, and if all goes well, you’ll see something like the following:
[ Initializing NConf perl-API (library version 0.2, written by A. Gargiulo) ] [ Copyright (c) 2006-2009 Sunrise Communications AG, Zurich, Switzerland ] [INFO] Starting generate_config script [INFO] Generating global config files [INFO] Generating config for Nagios-collector 'Default Nagios' [INFO] Ended generate_config script Running syntax check: Default_collector: Total Warnings: 0 Total Errors: 0 Changes updated successfully.
Now log back into Nagios and click on Service Detail. Within a minute or two, you should see the hosts and services change to reference the configuration as generated from NConf.
If that works, then huzzah!
Start making your configuration changes in NConf and enjoy not having the manipulate those Nagios conf files by hand anymore!
Acknowledgements:
Many thanks to the author (Jason) of DigitalCardboard.com for his excellent step-by-step guide which is used as the basis for this post
I identified a problem when trying to access Cisco VPN services via the web from a remote location (using the Cisco VPN client on a Windows PC). However, it turned out that these sites/services were accessible from within other networks – this led me to believe that the firewall configuration at the remote location was causing my problem.
A little research revealed that it was necessary to configure some non-standard ports to enable this functionality:
I enabled the following ports on the remote site firewall to successfully provide connectivity:
Port number: 500
Protocol type: UDP
Direction: Send Receive
Port number: 4500
Protocol type: UDP
Direction: Send Receive
The (unnoficial, user-provided) information I had reviewed on the internet to provide this functionality also suggested the following port – however, this was not required in my instance to achieve connectivity.
Port number: 10000
Protocol type: UDP
Direction: Send Recieve
My System Configuration related to this problem:
This is how I successfully installed/configured MythTV on my system:
System: Thermaltake DH101 system
O/S: Linux Mint Debian Edition
DTV Card: Hauppauge WinTV-HVR-2200
Find the available Debian Packages:
Most of these packages were already installed by default… but I did have to install the following (using “apt-get install <package_name>”)
mythweb
nuvexport
libmyth-dev
mythbrowser
mythnetvision
mythnetvision-data
mythplugins
mythtv-perl
To configure MythTV, it is then necesarry to run ‘mythtv-setup’ from a terminal prompt → I then encountered a problem: cannot log into database as ‘mythtv’ with pwd = ‘mythtv’ (found in file: /home/steve/.mythtv/mysql.txt)
There are other ways to fix this problem, but the easiest method available to me was to install Webmin (and prerequisites), along with mysql-admin packages
Surprisingly, I then had to change default locations for mysql binaries within Webmin Configuration… then I could log into mysql database from within Webmin as root, then configure mythtv database access (user: mythtv pwd: mythtv)
I live in Melbourne, Australia and have found from previous experience with MythTV, that the easiest way to configure xmltv and download free-to-air Digital TV program listings for my region is by installing and using the free ‘Shepherd’ application… Install Shepherd using instructions from http://svn.whuffy.com/wiki/Installation
Now run ‘myth-setup’ to configure the mythtv backend
There are 6 sections which must be configured in sequence when configuring MythTV.
The ‘General’ section defaults, are normally OK, but it is necessary to modify the IP Address for the ‘Master Backend’ – Often, if you are using the same machine for Backend and Frontend, then a localhost address (i.e. 127.0.0.1) or the statically assigned local address for your PC on your local LAN (e.g. 192.168.75.1) is sufficient
The ‘Capture Cards’ section must be configured to suit the TV card which is installed in your system. My system was using a ‘Hauppauge WinTV-HVR2200′ PCI card – the following screenshots show the configuration options which were necessary to get my system operational (Note: see my earlier post for installing firmware and configuring Debian system to identify and use this DTV card)
There is only 1x TV card installed in this system, but the screenshots below show that this card supports two recording channels
The ‘Video Sources’ and ‘Input Connections’ configurations are reasonably straightforward. I configure the system for ‘PAL’ TV format, and ‘Australian’ settings. (This is configured by the previously installed ‘Shepherd’ application)
I had to manually start mythbackend (by typing ‘mythbackend’ into a terminal prompt) before I could connect with the mythtv-frontend – otherwise it told me that the service was not running – the automatic starting of the MythTV daemon is something which has yet to be resolved for my setup
Interestingly, a ‘Channel Scan’ rom within the ‘Input Connections’ screen, or ‘Channel Editor’ screen only exposed some out of the possible free-to-air digital TV channels from nearby central Melbourne (when my set-top TV box is able to view all local TV channels perfectly)… I was not able to configure any of the ‘Nine’ channels (e.g. ‘Nine Digital’, ‘Gem’ and ‘Go’). I found out that it was necessary to manually add the Channel Nine information… I found the frequency information using a Google search: (191625000 MHz)and I was able to add this manually via the ‘mythtv-setup’ program and the ‘Edit Transports’ section of the ‘Channels Editor’ menu
But then I found some more information from another Melbourne-based MythTV user who had lost SBS and Channel 9 after a rescan in December 2010 (http://www.mythtv.org/pipermail/mythtv-users/2010-December/304062.html)… It seems that incorrect details for the ‘transport’ for Channel 9 was inserted into the MythTV database!
Ultimately, I needed to manually edit the MYTHCONVERG.dtv_multiplex table as shown below:
(Channel Nine: netid = 4114, tid = 1072) – this is what it should look like:
I then deleted all of the already scanned/configured channels, and rescanned… the system found 23x channels, including 9, 90 and 99
Starting ‘mythbackend’ and then ‘mythfrontend’ I was then able to select and view all channels perfectly!
‘mythweb’
‘nuvexport’
libmyth-dev
mythbrowser
mythnetvision
mythnetvision-data
mythplugins
mythtv-perl