Installing spotweb nzb indexer on synology NAS Sunday, Jan 6 2013 

Introduction

This guide will describe the different steps you have to take to install spotweb on a Synology NAS.

This indexer can then be used as an indexer with sickbeard and couchpotato.

The device I’m using is a DS112+ with DSM 4.1.2636

I basically followed this guide here , adding my comments to it as we go along.

I also assume you have already activated ipkg which will allow you to install additional packages and known how te connect to the synology nas using ssh. If not there are plenty of guides out there, look for some links in previous posts.

Step 1 : installing additional packages

First make sure you are going to download the most recent packages by updating ipkg

ipkg update
ipkg upgrade
 

Install git, this is a version control client that will allow you to checkout and update the spotweb code. Also install textutils a package used by git.

ipkg install git
ipkg install textutils
 

Step 2 : Activate a web server and database on your synology

 

Use a browser to connect to the DSM web interface. Go to Control Panel -> Webservices.

 
DSMWebServices
 

Step 3 : Checkout the spotweb code using git

Go back to the command line console (ssh). Checkout the spotweb code in the path used by the webserver (/volume1/web)

cd /volume1/web
git clone git://github.com/spotweb/spotweb.git /volume1/web/spotweb
Cloning into '/volume1/web/spotweb'...
remote: Counting objects: 26557, done.
remote: Compressing objects: 100% (5971/5971), done.
remote: Total 26557 (delta 20542), reused 26148 (delta 20193)
Receiving objects: 100% (26557/26557), 5.59 MiB | 1.57 MiB/s, done.
Resolving deltas: 100% (20542/20542), done.

Step 4 : Setting up the database

These instruction will setup the database using commandline instructions, alternatively you could also use phpMyAdmin if you like.

If you never created a initial password for the mysql database (or forgot about it), do this:

/usr/syno/mysql/bin/mysqladmin -u root password NEWPASSWORD
 

Start the mysql commandline interface

/usr/syno/mysql/bin/mysql -p
 

Create the spotweb table, user and priviledges

mysql> create database spotweb;
Query OK, 1 row affected (0.00 sec)
mysql> create user ‘spotweb’@’localhost’ identiefied by ‘password’;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on spotweb.* to spotweb @’localhost’ identified by ‘password’;
Query OK, 1 row affected (0.00 sec)
mysql> quit;
Bye

 Step 5 : configure spotweb

Connect to the new spotweb installation using your favored browser.

http://<synology-ip>/spotweb/install.php

The first page will check if php is installed correctly, if so proceed to the next page.

Here you have to enter the database, user and credentials

Screen Shot 2013-01-06 at 10.06.00

Next page enter your usenet server credentials

Screen Shot 2013-01-06 at 10.10.28

 Next create a admin user with credentials that will allow you to logon to the spotweb web interface

Screen Shot 2013-01-06 at 10.13.54

The information that is displayed next is needed for some additional configuration. Copy the information and save it somewhere.

<?php
$dbsettings['engine'] = 'mysql';
$dbsettings['host'] = 'localhost';
$dbsettings['dbname'] = 'spotweb';
$dbsettings['user'] = 'spotweb';
$dbsettings['pass'] = 'password';

From the command console, create a new directory

mkdir -p /volume1/web/.spotweb
 

create a new file in this directory with nano or vi called dbsettings.inc.php

 
nano /volume1/web/.spotweb/dbsettings.inc.php
 

create a symbolic link of this file to the spotweb installation

 
cd /volume1/web/spotweb
ln -s ../.spotweb/dbsettings.inc.php dbsettings.inc.php
 

Logon in the spotweb user interface and goto Config -> Settings (right top screen)

Screen Shot 2013-01-06 at 10.48.13

 

Goto the Retrieve tab and configure the retention you would like. (Default is everything)

Screen Shot 2013-01-06 at 10.47.29

There is a retrieve button on the main page to start the retrieval process, or you can run this command from the command line.

cd /volume1/web/spotweb
/usr/bin/php retrieve.php

First time retrieval will take a long time depending on the settings you chose and the retention of the newsserver in question.

Step 6 : Configure Newznab

In order to use spotweb as a newznab source, we need to make some changes to the apache configuration.

Edit httpd.conf-user

nano /usr/syno/apache/conf/httpd.conf-user
 

After <Directory “/var/services/web”> …… </Directory> add these two lines

# Include external config
Include /volume1/@appstore/.apache_conf/apache.conf

Create the .apache_conf directory

mkdir /volume1/@appstore/.apache_conf

Download some files from dropbox

wget -O /volume1/@appstore/.apache_conf/apache.conf http://dl.dropbox.com/u/5653370/syn_files/apache_conf/apache.conf
wget -O /volume1/@appstore/.apache_conf/spotweb.conf http://dl.dropbox.com/u/5653370/syn_files/apache_conf/spotweb.conf

The spotweb.conf file contains some ip authorizations to subnet 192.168.2.0. It could be that you need to change this if you are on a different subnet.

E.g.

Allow from 10.0.0.0/24
 

or if you want to add access from a single pc

Allow from 192.168.1.17
 

After creating or modifying the apache config you need to restart the Apache webserver to activate the new configuration.

/usr/syno/etc.defaults/rc.d/S97apache-user.sh restart  
 

Add an access file to allow connection using the newznab API

 
wget -O /volume1/web/spotweb/.htaccess http://dl.dropbox.com/u/5653370/syn_files/spotweb/htaccess.txt

 

Test the configuration with this URL, it should return an xml file.

http://<synology-ip>/spotweb/api?t=c
 

Step 7 : Automatic retrieval of spots and updates

Setup the necessary scripts for the automatic updates

mkdir /volume1/@appstore/scripts
wget -O /volume1/@appstore/scripts/spotweb_upd.sh https://dl.dropbox.com/u/5653370/syn_files/spotweb/spotweb_upd.sh –no-check-certificate
chmod a+x /volume1/@appstore/scripts/spotweb_upd.sh
wget -O /volume1/@appstore/scripts/spotweb_retr.sh https://dl.dropbox.com/u/5653370/syn_files/spotweb/spotweb_retr.sh –no-check-certificate
chmod a+x /volume1/@appstore/scripts/spotweb_retr.shwget -O /volume1/@appstore/scripts/spotweb_cron_upd.sh https://dl.dropbox.com/u/5653370/syn_files/spotweb/spotweb_cron_upd.sh –no-check-certificate
chmod a+x /volume1/@appstore/scripts/spotweb_cron_upd.sh
wget -O /volume1/@appstore/scripts/spotweb_cron_retr.sh https://dl.dropbox.com/u/5653370/syn_files/spotweb/spotweb_cron_retr.sh –no-check-certificate
chmod a+x /volume1/@appstore/scripts/spotweb_cron_retr.sh

Add two jobs to the cron configuration

Editing the cron configuration can be tricky, between all parameters there has to be a TAB (no spaces). The command itself however is a considered a single parameter and contains spaces. Basically use tabs before ‘/bin/sh’ and spaces after ‘/bin/sh’.

Add these two lines (if there are other lines in the cron configuration file already, leave them intact)

#minute hour    mday    month   wday    who     command
15      */6     *       *       *       root    /bin/sh /volume1/@appstore/scripts/spotweb_cron_upd.sh > /dev/null
0       */2     *       *       *       root    /bin/sh /volume1/@appstore/scripts/spotweb_cron_retr.sh > /dev/null

Restart the Cron daemon afterwards.

/usr/syno/etc/rc.d/S04crond.sh stop
/usr/syno/etc/rc.d/S04crond.sh start

Each two hours spotweb will be updated, you can check this in the webinterface. Last update timer is show above the Retrieve button on the main page.

Step 8 : Setup Couchpotato

First determine an apikey, you can use the one of the admin user or create a new user for this.

Click the user on the top right in the webinterface and open the ‘change user’ panel. You will find the apikey on the bottom.

Go to Couchpotato configuration panel -> Nzb Providers and add a new newznab provider. Don’t forget to add your apikey.

Screen Shot 2013-01-06 at 13.00.46

Test it by turning off all other Nzb Providers.

2012 in review Tuesday, Jan 1 2013 

The WordPress.com stats helper monkeys prepared a 2012 annual report for this blog.

Here’s an excerpt:

4,329 films were submitted to the 2012 Cannes Film Festival. This blog had 21,000 views in 2012. If each view were a film, this blog would power 5 Film Festivals

Click here to see the complete report.

2011 in review Sunday, Jan 1 2012 

The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog.

Here’s an excerpt:

The concert hall at the Syndey Opera House holds 2,700 people. This blog was viewed about 13,000 times in 2011. If it were a concert at Sydney Opera House, it would take about 5 sold-out performances for that many people to see it.

Click here to see the complete report.

SickBeard, couch potato and sabNZB on synology Monday, Aug 15 2011 

Update  on this  blog entry:

Currently the syno community packages are a better option to install sickbeard, sabnzb, couchpotato and python.

Add the syno community repository in the package manager as a source:

Screen Shot 2013-01-13 at 08.33.08

Proceed to install from the package manager.

  • Python
  • Sabnzb
  • Sickbeard
  • CouchPotato

0. Introduction

I’ve been experimenting with installing these third party softwares on synology.

It all seems to work quite wel, a bit slow on my Synology DS107+, and some issues with sabNZB core dumping once in a while.

1. Installing the packages.

See above instructions to install from syno community packages as the zebulon packages are dated.

I started out from the synology packages created by zebulon which you can find on SynoBlog.

These packages are well build and they are regularly updated with new versions.

Using these will save you a lot of time.

Logon to the synology DSM, start Package Management and install these spk:

Check the privileges of the download folder of sabNZB

Add read/write to the users:

  • sabNZBd
  • sickbeard
  • couchpotato
  • and any other users you want to have acces.

This will simplify things if you want to add some post processing.

Trouble with sabnzb

In my setup sabNZB keeps on exiting once in a while when retrieving files. This will result in a core dump in /volume1/ directory.

I have been unable to find the source of these crashes, I assume it has to do with the limited resources available on ds107+.

I created a workaround for this problem by just restarting sabNZB when this happens, sabNZB will pickup where it left off.

  • create this script in /usr/local/etc/checkSABnzb.sh
date
/usr/local/etc/rc.d/SABnzbd.sh status
if [ $? -eq 1 ]
then
  /usr/local/etc/rc.d/SABnzbd.sh start
else
  echo "SABnzb Running"
fi
  • chmod 755 /usr/local/etc/checkSABnzb.sh
  • add a line in /etc/crontab to automatically start this script every 10 minutes (this is one line):
*/10    *    *    *    *    root    /bin/ash /usr/local/etc/checkSABnzb.sh
>> /usr/local/etc/checkSABnzb.log 2>&1

Make sure this line is typed correctly with tabs as seperators between the values, not with spaces. Cron is a bit picky about that.

  • Restart cron:
/usr/syno/etc/rc.d/S04crond.sh stop
/usr/syno/etc/rc.d/S04crond.sh start
  • To clean up the core dump files you can also add these extra lines to the script:
ls /volume1/*.core.*
rm /volume1/*.core.*
  • You can monitor the actions of this script in:
/usr/local/etc/checkSABnzb.log

That’s it.

Enjoy.

Addendum:

Couch potato has some issues with moving files (files tend to disappear after download). This is due to the lack of large file support in python version 2.6.6-2.

Upgrade the python package to Version 2.6.6-4 if you are experiencing problems with this.

Update Asrock XBMC 330 HT to Natty 11.04 with Dharma XBMC release Wednesday, Jul 27 2011 

This blog describes how you can install the latest natty release from xbmcfreak on an Asrock 330 device.

I won’t go into the details again on how you set root passwords, setup samba,

you can find most of that stuff in my previous blogs.

1. Installing the live CD

Download the livecd from xbmcfreak:

http://xbmcfreak.binkey.nl/xbmcfreaklive-natty-dharma-v2.zip

Create a CD or USB to install from and go through the usual menu’s te setup your system.

After this is done the system should boot up nicely into XBMC.

Off course as usual the remote will not work…

2. Fixing the remote

Things are a little bit different than before in lucid.

There is actually a device driver included in the kernel that works called nuvotron_cir.

Only it does not play nice with the version of Lirc currently installed. (0.8.7)

It should be loaded already, you can check it like this from the command line.

# dmesg | grep nuvo
[    8.000068] nuvoton_cir: driver has been successfully loaded
[   14.896761] rc rc0: lirc_dev: driver ir-lirc-codec (nuvoton-cir) registered at minor = 0

So no need to download any drivers from asrock anymore.

We do need to update the installed version of Lirc to a new version 0.9.0 in order for it to work correctly.

After searching the web I found a .deb file to upgrade to this version.

lirc_0.9.0-0ubuntu1_i386.deb

Transfer it to the asrock using samba or sftp and install with this command:

dpkg -i lirc_0.9.0-0ubuntu1_i386.deb

This should show a new configuration menu. Select as remote configuration :

Windows Media Center Transceivers/Remotes (all)

Select as IR Transmitter:

None

A new remote configuration will become active ( you can verify this in the kernel log if you like)

#dmesg

….

[ 1396.866022] usbcore: registered new interface driver mceusb

Most of the keys will still not register in XBMC, this is because they do not correspond with the keys in Lircmap.xml

You can see the key names by starting irw, end pressing keys on the remote:

root@XBMCLive:/tmp# irw
000000037ff07be0 00 KEY_DOWN mceusb
000000037ff07bd8 00 Aspect mceusb
000000037ff07bd8 01 Aspect mceusb
000000037ff07bd9 00 Guide mceusb
000000037ff07bfa 00 KEY_5 mceusb
000000037ff07bfd 00 KEY_2 mceusb
000000037ff07bee 00 KEY_VOLUMEDOWN mceusb
000000037ff07bee 01 KEY_VOLUMEDOWN mceusb
000000037ff07bef 00 KEY_VOLUMEUP mceusb
000000037ff07bed 00 KEY_CHANNELUP mceusb
000000037ff07bed 01 KEY_CHANNELUP mceusb
000000037ff07bec 00 KEY_CHANNELDOWN mceusb

Replace the keys in the file /usr/share/xbmc/system/Lircmap.xml with these keys.

Here is what it should look like when you’re done:

<lircmap>
    <remote device="mceusb">
        <play>KEY_PLAY</play>
        <pause>KEY_PAUSE</pause>
        <stop>KEY_STOP</stop>
        <forward>KEY_FORWARD</forward>
        <reverse>KEY_REWIND</reverse>
        <left>KEY_LEFT</left>
        <right>KEY_RIGHT</right>
        <up>KEY_UP</up>
        <down>KEY_DOWN</down>
        <select>KEY_OK</select>
        <pageplus>KEY_CHANNELUP</pageplus>
        <pageminus>KEY_CHANNELDOWN</pageminus>
        <back>KEY_BACK</back>
        <menu>KEY_DVD</menu>
        <title>Guide</title>
        <info>More</info>
        <skipplus>KEY_NEXT</skipplus>
        <skipminus>KEY_AGAIN</skipminus>
        <display>Aspect</display>
        <start>KEY_HOME</start>
        <record>KEY_RECORD</record>
        <volumeplus>KEY_VOLUMEUP</volumeplus>
        <volumeminus>KEY_VOLUMEDOWN</volumeminus>
        <mute>KEY_MUTE</mute>
        <power>KEY_POWER</power>
        <myvideo>KEY_VIDEO</myvideo>
        <mymusic>KEY_AUDIO</mymusic>
        <mypictures>Pictures</mypictures>
        <mytv>liveTV</mytv>
        <one>KEY_1</one>
        <two>KEY_2</two>
        <three>KEY_3</three>
        <four>KEY_4</four>
        <five>KEY_5</five>
        <six>KEY_6</six>
        <seven>KEY_7</seven>
        <eight>KEY_8</eight>
        <nine>KEY_9</nine>
        <zero>KEY_0</zero>
        <star>Star</star>
        <hash>Hash</hash>
        <clear>KEY_CLEAR</clear>
        <enter>KEY_ENTER</enter>
        <red>KEY_RED</red>
        <green>KEY_GREEN</green>
        <yellow>KEY_YELLOW</yellow>
        <blue>KEY_BLUE</blue>
        <teletext>Teletext</teletext>
    </remote>
...

Reboot and the remote should start working in XBMC too.

3. Set shutdown/reboot credentials

Currently with this setup XBMC is unable to shutdown the device. Time to fix that.

  • Create  new file  /var/lib/polkit-1/localauthority/50-local.d/custom-actions.pkla to set credentials for xbmc user to shutdown the device with this content:
[Actions for xbmc user]
Identity=unix-user:xbmc
Action=org.freedesktop.upower.*;org.freedesktop.consolekit.system.*;org.freedesktop.udisks.*
ResultAny=yes
ResultInactive=no
ResultActive=yes

Replace xbmc with whatever user you are running the xbmc software with.

  • Next, edit this file /var/lib/polkit-1/localauthority/50-local.d/20-xbmclive.pkla and comment everything out like this:
#[XBMC-Live user permissions]
#Identity=unix-user:xbmc
#Action=*
#ResultAny=no
#ResultInactive=no
#ResultActive=yes
  • In the XBMC menu System->system->power saving you can set the shutdown function to  shutdown to turn of the box completely (instead of hibernating)
  • Reboot and you should be able to reboot/shutdown the device using the xbmc GUI or the remote power button.

That’s it,

Happy upgrading!

XBMC on Apple TV Saturday, Jun 11 2011 

0. Introduction

I recently bought an Apple TV 2 for the purpose of installing XBMC on this piece of hardware.

Here are the steps it took to accomplish this, and the problems that arose.

Step 1. Unboxing the ATV2

The box contains amongs other:

  • the ATV2 itself
  • a minimalistic remote controle
  • powercable

It does not contain a micro-USB data cable. You’ll need that, if you don’t have one, go get one. These kinds of cables are commonly used to connect mobile phones to computers. It should not be hard to find.


2. Installing XBMC

In order to install XBMC, the device needs to be opened up for homebrew. For this I used a hack called GreenPoison. This will allow you to install secure shell, aptitude and other useful unix programs to make the ATV device accessible. This hack is permanent, it will remain active even after powering down the device.

Download Software here: http://greenpois0n.com/

Warning: Doing this hack will probably void the warranty of the apple tv. You should be aware of that.

The software is available for both mac and windows. This is where you’ll be needing the micro USB. Follow the instructions until the firmware is updated and the software reports it is done.

Connect the atv2 to a tv set and there should be an extra menu called greenPoison with an option ‘Inject Software’ to install Cydia .That allows you to install SSH and will also install nitoTv, a graphical package management system.

You can use nito tv to install xbmc, or you can do it commandline style. Since I did the second I will be describing that procedure.

  • Find out what the Ip-address is for the apple tv.You’ll find it in Settings->General>Network->Ip address
  • Use putty or another ssh to login to  the apple tv. UserName: root password: alpine
  • Next install XBMC using these commands
$ echo “deb http://mirrors.xbmc.org/apt/atv2 ./” > /etc/apt/sources.list.d/xbmc.list
$ apt-get update
$ apt-get install org.xbmc.xbmc-atv2
  • An XBMC menu will be added to the apple tv.

3. Configuring XBMC

Configure XBMC as usual.

You can use the remote to do so, or if you have wireless, a iphone/ipad you can use an app like rowmote pro. Which will allow you to use a keyboard to enter the paths necessary.

If you already have an existing sources.xml file you can SFTP it to this path:

/private/var/mobile/Library/Preferences/XBMC/userdata/sources.xml

restart xbmc afterwards.

4. Problem: XBMC keeps exiting

I experienced a problem where xbmc kept existing to the appl tv main menu after a while.This had to do with the fact the device wanted to update to the latest software.

This was solved after installing an extra package.

  • Goto the nitoTv menu and select ‘Install Software’.
  • There is a package called ‘updateBeGone’
  • I also turned off the AppleTV updates in the settings menu of nitoTV
  • Doing this resolved the problem

5. Remote

The remote for the atv2 has a limited set of buttons. However most have two functions allowing just enough functionality to operate the device.

You can press the button short or longer for different functions. Here are the ones you’ll be looking for:

  • Menu (short) –> back
  • Menu (long) –> menu
  • Center Button (short) –> select
  • Center Button (long) –> activate OSD

6. Wrap up

The device performs nicely:

  • Playback of HD works OK, but may occasionally miss a frame in 1080p
  • downloading subtitles works
  • scraping works
  • it is very small
  • low power consumption
  • very silent

Drawbacks:

  • Menu interactions is somewhat slow.
  • RSS Feed is jerky and annoying, I turned it off in the settings menu.

It will not be replacing my current AsRock netOp pc as XBMC device because of these drawbacks, but it will be used in the study as a secondary unit to watch  tv.

2010 in review Sunday, Jan 2 2011 

The stats helper monkeys at WordPress.com mulled over how this blog did in 2010, and here’s a high level summary of its overall blog health:

Healthy blog!

The Blog-Health-o-Meter™ reads Fresher than ever.

Crunchy numbers

Featured image

A Boeing 747-400 passenger jet can hold 416 passengers. This blog was viewed about 6,500 times in 2010. That’s about 16 full 747s.

In 2010, there were 8 new posts, not bad for the first year! There were 31 pictures uploaded, taking up a total of 14mb. That’s about 3 pictures per month.

The busiest day of the year was October 16th with 97 views. The most popular post that day was Installing XBMC 10.08 Dharma on Asrock 330HT.

Where did they come from?

The top referring sites in 2010 were redherring2.wordpress.com, forum.xbmc.org, minhembio.com, tweakers.net, and avmagazine.it.

Some visitors came searching, mostly for xbmc 330ht, upgrade xbmc live to dharma beta1, download ir(10.04)kernel2.6.32-23.zip, lirc-nct677x-1.0.4-buntu10.04_kernel2.6.32-23, and synology cacti.

Attractions in 2010

These are the posts and pages that got the most views in 2010.

1

Installing XBMC 10.08 Dharma on Asrock 330HT August 2010
5 comments

2

XBMC 9.11 Camelot on Asrock Ion 330HT nettop pc – part 4 – Fixing remote powertoggle February 2010

3

XBMC 9.11 Camelot on Asrock Ion 330HT nettop pc – part 2 January 2010
2 comments

4

XBMC 9.11 Camelot on Asrock Ion 330HT nettop pc January 2010
1 comment

5

Cacti as SNMP monitor on synology September 2010
2 comments

XBMC 10.00 Subtitle addon – remote shortcut Monday, Dec 27 2010 

1. Introduction

Activating the subtitle addon directly on a remote key is a real time saver.

It takes a few keystrokes to activate the plugin for downloading subtitles. This can be quite a hassle if you want to retrieve a whole bunch of subtitles for a complete series.

I investigated this when it was suggested by Dem on my previous post of the subtitle addon.

It turns out it is actually quite easy to configure.

This post describes how you can configure the remote button to activate the subtitle addon directly.

2. Configuring the remote button

  1. Connect to the ion box using your favorite secure shell.
  2. cd /usr/share/xbmc/system/keymaps
  3. edit remote.xml
  4. add or change a key mapping in keymap->global->remote. In this example I mapped the green key of the remote to open the subtitle addon window.  (see example below)
  5. After editing saving the file, restart xbmc or reboot the ion box.

<keymap>
<global>
<remote>
<play>Play</play>
<pause>Pause</pause>

<green>RunScript(script.xbmc.subtitles)</green>

</remote>
</global>

</keymap>

3. How does it work?

  1. Start looking at the video you want to retrieve subtitles for
  2. Press the button on the remote you mapped (green button in the example)
  3. Select the correct subtitle.
  4. The subtitles should appear immediately

P.S

I benchmarked it too. After hearing the comment ‘Doesn’t this episode have subtitles?!?’ it took about seven  seconds to get them, including picking up the remote.

Needles to say everybody was very impressed, … also for about seven seconds.🙂

Enjoy.

XBMC 10.00 Subtitle addon (Dharma Beta2) Friday, Oct 1 2010 

1. Introduction

The subtitle addon works great.

In order to use it you will have to activate the addon first. I will get to that later, but first let’s focus on the usage.

2. Usage

Just select the subtitle button from the OSD. (If it’s grey you haven’t configured it yet, keep on reading…)

Based on your configuration and the mediatitle you are playing different subtitle sources will be consulted. Matching search results will presented for you to choose from.

Select the subtile you want and continue viewing. If the subtitles are out of sync probably you selected the wrong set.

3. Configuration

In order to use the subtitle addon you have to configure it first.

a) Goto addon section in the setting menu

b) Download the subtitle addon from the addon menu

c) Enable subtitle Addon

d) Activate addon in the skin menu

e) Set Path to addon by selecting it

f) go to the addon system menu

g) configure

h) set desired subtitle language(s)

i) Select subtitle sources

j) advanced options

 

Extra: Configure a shortcut button to skip the OSD and go directly to the subtitle selection.

Documented in this blog post

 

Done.

Enjoy.

Cacti as SNMP monitor on synology Thursday, Sep 2 2010 

Introduction

Recently I’ve been examining possibilities on how to monitor my local network using SNMP. (SNMP = Simple Network Management Protocol)

Most devices I own support this protocol. I’m particullary interested in monitoring network traffic, diskspace and uptime of devices.

  • Network – Since my ISP (telenet) decided not to share bandwidth information with me anymore I’m going to measure it myself.
  • Diskspace – always a pain if you run out unexpectedly.
  • Uptime – gotta love those statistics

I decided to use a synology DS107+ since it is the only device which is active all of the time and has the capability to run a monitoring application.

This blog will describe how I installed it on this device. This information is provided as is, mostly so I don’t forget how to redo it myself.

Some of the collected graphs:

1. Setup the synology

  • Update the synology to version 2.3 right away. This makes it alot easier because in this firmware the php executable is available.
  • Install phpMyAdmin using Synology diskstation manager

  • Next enable ssh in the terminal menu in section Network Services

2. Download and install cacti

2. Start PhpMyAdmin

  • Create database called cacti
  • Select the newly created cacti database
  • In the second tab called ‘SQL’ past the content of cacti.sql you find in \\mysynology\web\cacti
  • This prepares the database that will be used to store SNMP recorded data
  • Create a user for this database called cactiuser
  • Give privileges to this user for this database

3. Install extra packages using ssh

  • ipkg update
  • ipkg install net-snmp (5.2-2)
  • ipkg install rrdtool (1.2.30-1)
  • ipkg list_installed lists all installed packages:

bind – 9.5.0-P2-1 –
bzip2 – 1.0.5-2 – Very high-quality data compression program
coreutils – 6.12-2 –
cyrus-imapd – 2.2.12-15 – The Carnegie Mellon University Cyrus IMAP Server
cyrus-sasl – 2.1.22-2 –
cyrus-sasl-libs – 2.1.22-2 –
dhcp – 3.1.0-1 –
e2fslibs – 1.40.3-5 – Ext2 Filesystem Libraries
e2fsprogs – 1.40.3-5 – Ext2 Filesystem Utilities
eventlog – 0.2.7-1 – library needed by syslog-ng
fetchmail – 6.3.9-1 –
findutils – 4.2.32-1 – File finding utilities
freetype – 2.3.6-1 – Free truetype library
gdbm – 1.8.3-2 – GNU dbm is a set of database routines that use extensible hashing. It works similar to the standard UNIX dbm routines.
glib – 2.20.4-1 – The GLib library of C routines.
libart – 2.3.17-2 – 2-d graphics library.
libdb – 4.2.52-3 – Berkeley DB Libraries
libnsl – 2.3.2-4 – Network Services Library
libpng – 1.2.44-1 – Portable Network Graphics Libraries
libstdc++ – 6.0.3-6 – Standard C++ library, needed for dynamically linked C++ programs
libxml2 – 2.7.7-1 – Libxml2 is the XML C parser and toolkit developed for the Gnome project.
libxslt – 1.1.26-1 – An XML Stylesheet processor based on libxml2
ncurses – 5.7-1 – NCurses libraries
net-snmp – 5.4.2.1-1 – net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c and SNMP v3 using both IPv4 and IPv6
openldap-libs – 2.3.43-1 – Open Lightweight Directory Access Protocol
openssl – 0.9.7m-5 – Openssl provides the ssl implementation in libraries libcrypto and libssl, and is needed by many other applications and librari
pcre – 7.8-1 –
perl – 5.8.8-20 –
postfix – 2.3.6-3 – The Postfix mail system is an alternative to sendmail.
readline – 5.2-2 –
rrdtool – 1.2.30-1 – Round-Robin Database tool. Database collator and plotter
syslog-ng – 2.0.9-2 –
wget – 1.11.4-1 –
zlib – 1.2.5-1 – zlib is a library implementing the ‘deflate’ compression system.

4. php.ini

  • Allow running executable outside of /usr/syno/bin sandbox by modifying this line in php.ini

; When safe_mode is on, only executables located in the safe_mode_exec_dir
; will be allowed to be executed via the exec family of functions.
#safe_mode_exec_dir = /usr/syno/bin
safe_mode_exec_dir =

5. setup cacti

  • connect to the synology using the browser e.g. ‘http://synology/cacti/&#8217;
  • Follow the instructions and set the correct paths
  • use cacti as database name and cactiuser as database user.

6. Enable polling

  • edit /opt/etc/crontab and add this line:

*/5 * * * * root /usr/bin/php /volume1/web/cacti/poller.php

  • Make sure you only use tabs in this line, not spaces. If the lines disappears after reboot, you did it wrong.
  • reboot to synology to activate the polling.

7. Create devices

  • create your devices using the create device link

  • Click Add to add a device

  • Typical Synology configuration
  • Activate SNMP in the synology settings

  • Typical windows machine
  • Activate SNMP agent on the windows machine (provided with windows, not standard enabled)

  • For more information on how to use cacti, see the provided tutorials on the download site

Enjoy,

Update: DSM 3.1

After upgrading to DSM 3.1 the monitoring stopped working. This was due to some new settings being introduced with this new version of the DSM.

Logon with an administrator user and go to Control Panel -> webservice ->PHP Settings tab

  • Safe_mode_exec_dir needs to be DISABLED
  • Append ‘:/opt/bin:/usr/bin’ to the open_basedir

 

Note, if you are exposing php applications to the internet, you may not want to do this as you are lowering PHP security.

Thanx to Henk for pointing this change out in the configuration.

Next Page »

Follow

Get every new post delivered to your Inbox.

Join 49 other followers