I wanted to have an SNMP dæmon running on my NAS. This way all the boxes on my network can be queried using SNMP. This is quite simple, assuming you have ipkg installed.
- Install net-snmp:
ipkg install net-snmp
- Edit the configuration file in
/opt/etc/snmpd.conf, you can just use vi or call the
snmpconf program. There a three fields you should edit:
- Comment ou the entry that defines write access
# rwcommunity SNMPv1_RW you probably don’t need this feature and this is a security risk
- Edit the
syslocation to add the physical location of the NAS.
- Edit the
syscontact line to add the contact person for the device, probably yourself.
- Add a line define the types of services provided by the box, something like
sysservices 76, this corresponds to the following service levels: Internet, End-to-end, Application.
- Restart the snmp dæmon:
I also updated the hostinfo script, I cleaned up the formatting and some of the code (I would still not call it pretty), and added code to extract storage information. This information is provided by the NAS, but also my printer.
This week-end, I finally took the time to upgrade the firmware of my Synology DS-207 NAS to version DSM 2.0-0722. The upgrade was a little bit complicated: you first have to download the patch to Mac, prevent the Mac from expanding it, then upload the patch to the NAS by the way of a web-interface which does not work with Safari. The advantage when you don’t upgrade often is that you feel the difference: the whole web interface is way more polished and responsive thanks to some AJAX code, many services that kind of work are now stable (typically the iTunes music sharing service), and things that had to be hacked in are now installed by default (SSH access, NFS server). The Linux kernel is now
Linux 2.6.15 #722 Fri Sep 19 20:30:34 CST 2008 ppc unknown. Finally the web interface is now better structured, and many components have their own interface. For instance the “Audio Station” can be used to see the various songs stored on the NAS, they can also be listened to using a flash player. Clearly Synology realized they can capitalize on their open-source foundation to build up the feature set of their product. They also seem to have shifted their focus from small businesses to private owners. The only thing I was missing was a SNMP interface, but I suspect I should be able to install NetSNMP one way or another.
Now that the cluster update is done, I was able to start experiments again. It appears that my strange numbers are still here. I installed some more precise monitoring tools like sar, and tried to figure out what is going on. Here is the CPU usage graph for my application that simples receives UDP/SNMP heartbeat traps sent at a 1ms time interval.
As you can see, the period signal is still there. Trying to figure out what is going on, I did some profiling on my java code to figure out what is going. Here is the result of the profiling.
So my code is statistically doing nothing, just waiting for the next UDP packet to arrive, at the same time, I get CPU usage that goes up and down, including in supervisor mode. You can also see that the system and user level CPU usages are correlated, so it is clearly UDP packet reception that triggers this stuff. The only good thing is that the problem clearly does not lie in my code.
Growl is an interesting open-source project. The idea is to have one central service to handle bezel like notifications. The system has evolved and can now display notifications using different GUIs. There are now quite a few applications relying on Growl for notification, first Adium, but also Skype. There are also plugins so that newly delivered e-mails in Mail trigger such a notification.
One drawback of Growl, is that it does not really integrate with existing notification services like syslog, or SNMP traps. To remedy this, I have written a small java programs that takes incoming SNMP traps and translates them into growl notifications. The program is rather primitive, but it works. People who are interested can download a first version of the program. The tar file basically contains a jar file, a graphic file and a launch script. To use it, open a terminal and type
sudo ./snmpgrowl.bash (the program needs to run as root to be able to link to a privileged port, that is 162. Once the password has been typed it, the program can be put into the background. You can test the installation by typing
snmptrap -v 2c 127.0.0.1 0 18.104.22.168 1.1 s "Hello World"
If people are interested by the source code, they should send me an e-mail (the program is build using the snmp4j open source project. The program is at the moment very primitive and does little beyond transmitting the data.