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
}

zondag 30 januari 2011

encoding video for my adroid phone (betouch e130)

hi

i've bought a acer betouch e130 a few days ago and all is well so far
have been looking how to encode video for it thou (using ubuntu)
the ffmpeg line is below ..

greetz

WOuter


ffmpeg -y -i input.avi -vcodec h263 -s 176x144 -r 15 -b 700k -acodec libfaac -ac 2 -ar 32000 -ab 64k -f 3gp output.mp4

dinsdag 6 oktober 2009

Command line fu

Hi
these are a list with more complex commands i regularly use with a description of what it does

execute the last command but with sudo priveliges
sudo !!



download the entire site www.example.com as it is presented to an anonymous user using a mozilla browser

wget --random-wait -r -p -e robots=off -U mozilla http://www.example.com





get stats on the network-speed to a host


mtr hostname





twitter from command line (very usefull to keep track of machines)
this twitters the output of the command "uptime"

curl -u mytwitterusername:mypassword -d status="my uptime:`uptime`" http://twitter.com/statuses/update.json


more info here: http://mark.koli.ch/2009/05/howto-tweet-from-the-command-line-with-curl.html

enable passwordless ssh the easy way

ssh-copy-id user@remote-machine



make shift alarm clock

sleep 8h; cat /dev/urandom > /dev/dsp

maandag 5 oktober 2009

Securing a drupal development enviroment

Sometimes After a sync with production our testing site needs to be re-secured (since it's testing we don't want people using it)



install the securesite module

http://drupal.org/project/securesite
obviously you don't need to do this every time if you also install the module on your production enviroment, but switch it off overthere.



Activate the module
on http://yourURL/admin/build/modules

Change the Settings
: http://yourURL/admin/settings/securesite (Force authenticatoin ‘Always’)

That should do it

Props to my good friend Sven

vrijdag 2 oktober 2009

ssh-fu

Ok this is basicly a post were i keep track of some much used ssh commands,
there will probably be things added to this post as time goes by.

use x2x to share keyboard and mouse between 2 computers


Both PC's have to be running X and be logged in
from a shell within X on the PC that has the keyboard and mouse do
 ssh -XC remoteuser@remoteip  x2x -east -to :0.0 




Use SSH tunnel to secure your webtraffic


on the local machine configure firefox to use localhost & port 7070 as a proxy
then log into a shell and execute
ssh -D 7070 username@remote-host




connect over SSH to a computer behind a NAT firewall using a reverse SSH tunnel


on the remote machine (the one behind the firewall) do
ssh -R 19999:localhost:22 sourceuser@138.47.99.99 


Where 19999 can be anny random unused port
138.47.99.99 is the IP of the machine from where you want to access the "remote machine"

now on your server (theone at 138.47.99.99) do

 ssh localhost -p 19999 

and you should log into the machine behind the nat

dinsdag 15 september 2009

automating a drupal backup

automating a drupal backup



hi

I use following script to run a daily backup of several drupal sites




DOW = 'date +%a'
SITE = /var/www
BACKUPLOC = /home/backups/
MYSQLPASS = *******
DBNAME = drupaldb



rm $BACKUPLOC/$DOW.*
tar cf $BACKUPLOC/$DOM.tar $SITE
cd $BACKUPLOC
mysqldump -u root -p $MYSQLPASS $DBNAME > $DOW.dump

woensdag 9 september 2009

ftp backup script

Hi

i've created a ftp backup script a while ago, thought i should start posting stuff here again... seems like a good thingto start with


this scrip will take all the files from the remote site and dump them in a local dir (/home/wouter/temp in this case)


you'll need to remove the space between << and EOF in the first actual line of the script (code tags are not working to well on blogger apperantly)


#!/bin/bash

remote=ftp-site-to-backup
username=your-username
passwd=Password
localdir=/home/wouter/temp
remotedir=/home/wouter/

ftp -ipn << EOF
open $remote
user $username $passwd
lcd $localdir
cd $remotedir
binary
mget gale*
bye
EOF


please take into account that this means the data goes over clear-text and is visible to annyone on the network.



thank you joren from http://www.0110.be for the assistence