Posts tonen met het label open source. Alle posts tonen
Posts tonen met het label open source. Alle posts tonen

vrijdag 24 juni 2011

restoring the firmware to a nslu2 from a linux PC

ok i bought a new nslu2 from ebay, and it had either a corrupt firmware, or i corrupted it trying to reset it to factory default (cause i could not figure out what ip adress it was set to, all i know is, it was not in the common ranges, and was not using dhcp)
sollution.... reflash the firmware
problem: all step by step in one document i could find online assume either windows OR Mac... i wanted to use my desktop (a debian machine) so i wrote it up.


preparation
1. get the original firmware from linksys, or an alternative firmware from where-ever. (with "might be broken" hardware i always prefer to first flash the original firmware, just to check)

2. install upslug2
apt-get install upslug2
3. set your fixed ip to something in the 192.168.0.0/24 range, but NOT 192.168.0.1 (make sure that that's free)


redboot the machine

when the nslu2 boots, for a few seconds you can telnet into it on port 9000
so boot the nslu2, and start executing the following command on your pc
telnet 192.168.0.1 9000

once you'r in you have maybe 2 seconds to press ctrl-c and interrupt the normal boot .. so be prepared

once in redboot, erase the existing bootloader ...
redboot> fis erase -f 0x50040000 -l 0x20000
and put the nslu2 in upgrade mode
redboot> upgrade
you'll see the satus led start flashing orange-green-orange-green



upslug2
run upslug2 without any switch to find your nslu2 you'll get back some info one of witch is the mac-adress (note: upslug has to be rone as root)

next use upslug2 to flash the firmware

upslug2 --target="00:00:00:00" --image="someimage.bin"

go have a coffee or thee or chocolate milk, or whatever .. it'll take 5-10 min

woensdag 30 maart 2011

checking remote server with nrpe

assuming you know the comamnd you want to use on the remote server.
Usually something like:
//usr/lib/nagios/plugins/check_log-F logfile -O oldlog -q query


on the machine you want to monitor :
edit the /etc/nagios/nrpe.cfg file to include the command you want to execute (there should be a number of examples)

in my example:
command[check_login]=/usr/lib/nagios/plugins/check_log -F /var/log/messages -O /home/nagiosuser/logs/check_log.badlogins.old -q "LOGIN FAILURE"


restart the nrpe daemon:
/etc/init.d/nagios-nrpe-server restart




on the nagios server:
edit your commands.cg file to include the nrpe command

for example
define command{
command_name check_login
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c check_login

}

edit the config file for the remote host you're monitoring to add this command

in my example:
define service{
use generic-service
host_name remotehost
service_description Failed login check
check_command check_login
}