Archive

Archive for the ‘Informàtica’ Category

Eina per fer un Whois desde Ubuntu

febrer 20th, 2012 No comments

A vegades volem saber de qui es un domini i totes les seves dades del registrador, normalment busquem a una web, pero també tenim una eina molt bona… el “jwhois”

No sol venir instalat per defecte, pero el podei instal.lar… sudo apt-get install jwhois

per fer-lo servir, tansols cal fer per exemple: jwhois 3cat24.cat

Salut !!!

Share
Categories: Informàtica Tags:

Redimensionar imatge amb el terminal Ubuntu

febrer 19th, 2012 No comments

A vegades ens cal baixar de resolució una imatge per penjar-la a internet, avui en dia les càmares les fan amb una qualitat que cada foto pot ocupar més de 5 megues… imagineu si la penjeu a la web, cada cop que algu la vulgui visualitzar, li pot trigar moltíssim a obrir. Per això es recomanable baixarles de resolució a 640×480 o 320×200.

Ho podem fer amb la comanda mogrify

mogrify -resize 640×480 imatge.jpg

Salut !!

Share
Categories: Informàtica Tags:

Icinga el germanet del Nagios completament Open Source

febrer 19th, 2012 No comments

Estic provant un soft per monitorar xarxes que pinta molt i molt bé, demoment us passo un script d’instal.lació per ubuntu….

#!/bin/bash

# Icinga Ubuntu Server Post-install Script
# Ezra Bowden
# blog.kyodium.net
# Sept 5, 2011
# Updated: Jan 04, 2012

# Starts with a base server installation, no packages/groups added during OS installation.

# Running this script as root (sudo sh <scriptname>) against a base server install should
# have you up and running without any additional fiddling around. Let me know if you see a better way
# to do this, or any glaring errors.

# Tested versions:
# Ubuntu Server: 10.10/11.04/11.10
# Icinga: 1.5.0/1.5.1/1.6.0/1.6.1

# VARIABLES
PARAMETERS=”[-d|--debug] [--help] [-v|--version <version>] [--plugin-version <version>] [--enable-ssl] [--email <email address>] [--db-address <database ip address>]”
DEBUG=0
SSL=0
DB_ADDRESS=127.0.0.1  # Default is localhost, change this if database is hosted on a separate machine.
APTCMD=”apt-get install -y”
ICINGA_VER=”1.5.0″
PLUGIN_VER=”1.4.15″

# NOTE: If installing ssl then verify the additional ssl packages (under INSTALLING PACKAGES heading).
PACKAGES=”apache2 build-essential libgd2-xpm-dev libjpeg62 libjpeg62-dev libpng12-0 libpng12-dev”

# PARAMETER CHECK
while [ $# -gt 0 ]; do    # Until you run out of parameters …
case “$1″ in
-d|–debug)
# “-d” or “–debug” parameter?
DEBUG=1
APTCMD=`echo “$APTCMD” | sed ‘/.*/ s/[ ]-y//’`
;;
–enable-ssl)
SSL=1
;;
–email)
shift
EMAIL=”$1″
;;
–db-address)
shift
DB_ADDRESS=”$1″
;;
-v|–version)
shift
ICINGA_VER=”$1″
;;
–plugin-version)
shift
PLUGIN_VER=”$1″
;;
*)
echo “\n”
echo “Usage: `basename $0` $PARAMETERS”
echo “\n”
echo “Running this script as root \(sudo sh `basename $0`\) against a base 10.10 server install should”
echo “have you up and running without any additional fiddling around. Let me know if you see a better way”
echo “to do this, or any glaring errors.”
echo “\n”
exit 0
;;
esac
shift       # Check next set of parameters.
done

# VARIABLES
# Set variables that might be changed by calling parameters
# Tarball download URLs
ICINGA_URL=”https://downloads.sourceforge.net/project/icinga/icinga/$ICINGA_VER/icinga-$ICINGA_VER.tar.gz”
PLUGINS_URL=”https://downloads.sourceforge.net/project/nagiosplug/nagiosplug/$PLUGIN_VER/nagios-plugins-$PLUGIN_VER.tar.gz”

# Icinga directory name
ICINGA_DIR=`echo “$ICINGA_URL” | sed ‘s/^\(.*\)\/\(.*\)\(\.tar\.gz\)/\2/’`

# VERIFY DOWNLOAD URLS
if [ "$DEBUG" = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo “\n\n”
echo “——— VERIFYING DOWNLOAD URLS ———”

verifyURL ()
{
# Verify URLs
wget –spider -S $1

if [ $? -ne 0 ]; then
echo “URL verification failed:”
echo “$1″
echo “”
echo “There was a problem verifying the file download URL.”
echo “Please check that the URL above is correct in the script and try again.”
echo “”
echo “Installation Aborted.”
exit
else
echo “URL verification succeeded:”
echo “$1″
fi
echo “\n\n”
}

verifyURL $ICINGA_URL
verifyURL $PLUGINS_URL

if [ "$DEBUG" = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo “\n\n”
echo “——— INSTALLING PACKAGES ———”

# Install ssl if specified.
if [ $SSL = 1 ]; then
PACKAGES=”$PACKAGES openssl libssl-dev”
fi

$APTCMD $PACKAGES

if [ "$DEBUG" = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo “\n\n”
echo “——— INSTALLING MYSQL ———”
RELEASE=`lsb_release -rs`
if [ "$RELEASE" \< "11.10" ]; then
# pre 11.10 packages
PACKAGES=”mysql-server mysql-client libdbi0 libdbi0-dev libdbd-mysql”
else
# post 11.10 packages
PACKAGES=”mysql-server mysql-client libdbi1 libdbi-dev libdbd-mysql”
fi
$APTCMD $PACKAGES

if [ "$DEBUG" = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo “\n\n”
echo “——— ADDING USER/GROUPS ———”
useradd -m icinga
echo “\a\a”
echo “!!!!!!!!!!     The next password prompt is for the system icinga user.     !!!!!!!!!!”
echo “\n”
passwd icinga
groupadd icinga-cmd
usermod -a -G icinga-cmd icinga
usermod -a -G icinga-cmd www-data

if [ "$DEBUG" = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo  “\n\n”
echo “——— DOWNLOADING ICINGA ———”
cd /usr/src
FILE=`echo “$ICINGA_URL” | sed ‘s/^\(.*\)\/\(.*\)\(\.tar\.gz\)/\2\3/’`
if [ -e $FILE ]; then
echo “Local copy of $FILE exists, Skipping download.”
else
wget “$ICINGA_URL”
fi

echo “Extracting $FILE…”
tar -xzvf $FILE
#cd `echo “$FILE” | sed ‘s/^\(.*\)\(\.tar\.gz\)/\1/’`
cd $ICINGA_DIR

if [ "$DEBUG" = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo  “\n\n”
echo “——— INSTALLING ICINGA ———”

CONF=”./configure –with-command-group=icinga-cmd –enable-idoutils”
if [ $SSL = 1 ]; then
CONF=”$CONF –enable-ssl”
fi

$CONF
make all
make fullinstall
make install-config

if [ "$DEBUG" = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo “\n\n”
echo “——— CONFIGURING ICINGA ———”
#Change email to the address you’d like to receive alerts.

while [ -z "$EMAIL" ]; do
echo “\n\n”
echo “\a\a”
read -p “Enter the email address you want to receive icinga alerts: ” EMAIL
done

sed -i ‘s/\(.*\)icinga@localhost\(.*;\).*/\1′$EMAIL’\2/’ /usr/local/icinga/etc/objects/contacts.cfg # replace email address with $EMAIL

cd /usr/local/icinga/etc/
mv idomod.cfg-sample idomod.cfg
mv ido2db.cfg-sample ido2db.cfg
mv modules/idoutils.cfg-sample modules/idoutils.cfg

if [ $SSL = 1 ]; then
# Make changes to idoutils config files:

#   idomod.cfg
#    use_ssl=1
#    output_type=tcpsocket
#    output=127.0.0.1 (your database address if not on localhost)

sed -i ‘/^use_ssl=0/ s/0/1/’ idomod.cfg   # set use_ssl=1
sed -i ‘/output_type=tcpsocket/ s/^#//’ idomod.cfg # uncomment output_type=tcpsocket
sed -i ‘/^output_type=unixsocket/ s//#&/’ idomod.cfg # comment output_type=unixsocket
sed -i ‘/^output=.*ido.sock/ s//#&/’ idomod.cfg  # comment output=/usr/local/icinga/var/ido.sock
sed -i ‘/output=127.0.0.1/ s/^#//’ idomod.cfg  # uncomment this line
sed -i ‘s/\(^output\=\).*/\1′$DB_ADDRESS’/’ idomod.cfg # replace localhost address with $DB_ADDRESS

#   ido2db.cfg
#    use_ssl=1
#    socket_type=tcp

sed -i ‘/^use_ssl=0/ s/0/1/’ ido2db.cfg   # set use_ssl=1
sed -i ‘/socket_type=tcp/ s/^#//’ ido2db.cfg  # uncomment socket_type=tcp
sed -i ‘/^socket_type=unix/ s//#&/’ ido2db.cfg  # comment socket_type=unix
sed -i ‘s/\(^db_host\=\).*/\1′$DB_ADDRESS’/’ idomod.cfg # replace localhost address with $DB_ADDRESS
fi

if [ "$DEBUG" = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo “\n\n”
echo “——— CONFIGURING MYSQL ———”
# MySQL icinga DB and user. Create idoutils tables.
echo “\a\a”
echo “!!!!!!!!!!     The next two password prompts are for the MySQL root password you set previously.     !!!!!!!!!!”
echo “\n”
start mysql
mysql -u root -p <<HERE
CREATE DATABASE icinga;
GRANT USAGE ON *.* TO ‘icinga’@'localhost’ IDENTIFIED BY ‘icinga’ WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0;
GRANT SELECT , INSERT , UPDATE , DELETE ON icinga.* TO ‘icinga’@'localhost’;
FLUSH PRIVILEGES;
quit
HERE
#mysql -u root -p icinga < /usr/src/icinga-1.5.0/module/idoutils/db/mysql/mysql.sql
mysql -u root -p icinga < /usr/src/$ICINGA_DIR/module/idoutils/db/mysql/mysql.sql

if [ "$DEBUG" = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo “\n\n”
echo “——— INSTALLING CLASSIC INTERFACE ———”
cd /usr/src/$ICINGA_DIR
make cgis
make install-cgis
make install-html

# Install classic web config in apache conf.d directory:
make install-webconf

# Create icingaadmin account for logging into the classic web interface.
echo “\a\a”
echo “!!!!!!!!!!     The password prompt below is to set the web UI icingaadmin password.     !!!!!!!!!!”
echo “\n”
htpasswd -c /usr/local/icinga/etc/htpasswd.users icingaadmin

# Restart apache to apply new settings:
sudo service apache2 restart

if [ "$DEBUG" = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo “\n\n”
echo “——— INSTALLING NAGIOS PLUGINS ———”
cd /usr/src
FILE=`echo “$PLUGINS_URL” | sed ‘s/^\(.*\)\/\(.*\)\(\.tar\.gz\)/\2\3/’`
if [ -e $FILE ]; then
echo “Local copy of $FILE exists, Skipping download.”
else
wget “$PLUGINS_URL”
fi
echo “Extracting…”
tar -xzvf “$FILE”
cd `echo “$FILE” | sed ‘s/^\(.*\)\(\.tar\.gz\)/\1/’`

./configure –prefix=/usr/local/icinga –with-cgiurl=/icinga/cgi-bin –with-htmurl=/icinga –with-nagios-user=icinga –with-nagios-group=icinga
make
make install

if [ "$DEBUG" = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo “\n\n”
echo “——— STARTING SERVICES ———”
# Verify config file:
/usr/local/icinga/bin/icinga -v /usr/local/icinga/etc/icinga.cfg
service ido2db start
service icinga start

if [ "$DEBUG" = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo “\n\n”
echo “——— CONFIGURING SERVICE STARTUP ———”
update-rc.d ido2db defaults
update-rc.d icinga defaults

echo “\n\n”
echo “——— INSTALLATION COMPLETE ———”
echo “\a\a”
echo “go to http://`ifconfig  | grep ‘inet addr:’| grep -v ’127.0.0.1′ | cut -d: -f2 | awk ‘{ print $1}’`/icinga”
echo “and verify that Icinga is working. Use the login details below.”
echo “login: icingaadmin”
echo “password: <the password you set during installation>”
echo “\n”
read -p “[Press Enter to continue]” null
echo “\n\n”

Share
Categories: Guifi.net, Informàtica Tags:

Torna la moda dels P2P

febrer 18th, 2012 No comments

Doncs sembla que després del tancament de Megaupload i d’altres webs de descàrrega, els P2P tornen a estar de moda, hi han molts, però dels que he probat, us recomano per ubuntu el Frostwire…

http://www.frostwire.com/download/?os=ubuntu&

Salut !!!

Share
Categories: Informàtica Tags:

Incrementar limit de 128 mb de disc al windows 2000

febrer 6th, 2012 No comments

Aquesta setmana passada he estat canviant els discs de 80 Gb als Dell D620 per uns Sata2 de 750 Gb.

La cosa tenía que ser molt senzilla, agafar els discs nous, crear 3 particions primàries i una extesa amb unes quantes particions més, anteriorment ho havia fet a un Dell E6400 sense problemes (no tenia cap partició amb windows 2000).

Al fer-ho als Dell D620 amb dues particions de windows 2000, al arrancar hem sortia pantalla blava amb un error STOP 0x0000007B “INACCESSIBLE_BOOT_DEVICE” i no hi habia maneres d’arrencar cap de les particions amb windows 2000, en canvi Xp i Ubuntu, arrancaben sense problemes…

Després de fer moltíssimes proves, vaig donar amb el problema. El windows 2000 no reconeix discs més grans de 128 Gb, perque ho faci, cal modificar el registre el seguent paràmetre BigLba de la seguent manera:

  • Anar a Inici – Ejecutar
  • Escriure Regedit i pitjar return
  • Navegar per el registre fins anar a: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\atapi\Parameters.
  • Fer click a la clau “EnableBigLba” i modificar el valor per defecte a “1″ en cas de no existir aquesta clau, la podem crear manualment com registre DWORD i posar per defecte el valor a “1″
  • Reiniciem equip

Salut !!!

 

 

Share
Categories: Feina, Informàtica Tags:

Dell D620 no detecta wifi al Ubuntu 11.10 – Sol.lucionat

febrer 3rd, 2012 No comments

Ja tenim la manera de que el Ubuntu 11.10 detecti el wifi dels dell d620

A la consola (ctrl+alt+T)

sudo apt-get install b43-fwcutter firmware-b43-installer

Salut !!

Share
Categories: Informàtica Tags:

Nou Ubuntu 11.10 amb entorn Unity amb 2 monitors

gener 29th, 2012 No comments

Ha costat una mica configurar-ho, la questió es que tinc una tarja gràfica Nvidia 8500 amb dues sortides per 2 monitors i al final he aconsseguit configurar-ho igual com ho tenia abans amb l’entorn Gnome…. us deixo el fitxer /etc/X11/xorg.conf amb la configuració que m’ha funcionat tal com volia

Section “Monitor”
Identifier     “Monitor0″
VendorName     “Unknown”
ModelName      “Acer V223HQ”
HorizSync       31.0 – 84.0
VertRefresh     56.0 – 75.0
Option         “DPMS”
# HorizSync source: edid, VertRefresh source: edid
EndSection

Section “Screen”
Identifier     “Screen0″
Device         “Device0″
Monitor        “Monitor0″
Option         “TwinView” “1″
Option         “TwinViewXineramaInfoOrder” “CRT-0″
Option         “metamodes” “CRT-0: nvidia-auto-select +1920+0, CRT-1: nvidia-auto-select +0+0″
DefaultDepth    24
SubSection “Display”
Depth       24
EndSubSection
EndSection

Section “Module”
Load           “dbe”
Load           “extmod”
Load           “type1″
Load           “freetype”
Load           “glx”
EndSection

Section “InputDevice”
Identifier     “Mouse0″
Driver         “mouse”
Option         “Protocol” “auto”
Option         “Device” “/dev/psaux”
Option         “Emulate3Buttons” “no”
Option         “ZAxisMapping” “4 5″
EndSection

Section “InputDevice”
Identifier     “Keyboard0″
Driver         “kbd”
# generated from default
EndSection

Section “ServerLayout”
Identifier     “Layout0″
Screen      0  “Screen0″ 0 0
InputDevice    “Keyboard0″ “CoreKeyboard”
InputDevice    “Mouse0″ “CorePointer”
EndSection

Section “Device”
Identifier     “Device0″
Driver    ”nvidia”
Option    ”NoLogo”    ”True”
#    Driver         “nvidia”
#    VendorName     “NVIDIA Corporation”
#    BoardName      “GeForce 8400 GS”
EndSection

Section “ServerFlags”
Option         “Xinerama” “0″
EndSection

Share
Categories: Informàtica Tags:

Seguim amb Ubiquiti… ara les Aircam

gener 2nd, 2012 2 comments

No fa gaire aquesta coneguda marca americana ha tret al mercat unes càmeres ip megapixel a un preu revolucionari per les prestacions que donen… el software es gratuït i compatible amb Linux.

Hi ha el software que es diu Airvision i el Airvision-nvr, aquest ultim transforma el pc amb un gravador. Per instal·lar-ho es senzill gràcies als repositoris d’ubiquiti.

Afegim el repositori:

nano /etc/apt/sources.list

deb http://www.ubnt.com/downloads/airvision/apt natty ubiquiti

Ens baixem la key

wget -O – http://www.ubnt.com/downloads/airvision/apt/airvision.gpg.key | sudo apt-key add -

sudo apt-get update

sudo apt-get upgrade

sudo apt-get install airvision  (soft cams)

sudo apt-get install airvision-nvr (soft grabacio)

Ja hi podem accedir amb la ip del server:7443

 

Salut   !!!!

Share
Categories: Guifi.net, Informàtica Tags:

Ubiquiti AirControl al server Linux debian/ubuntu

gener 1st, 2012 No comments

Tenim disponible gratuitament el software de control dels nostres dispositius Ubiquiti, us deixo les passes a seguir per la seva instal.lació en un Linux debian/ubuntu

apt-get update
aptitude update
aptitude install java6-runtime-headless
aptitude install jsvc
cd /tmp
descarreguem el software: wget (wget http://www.ubnt.com/downloads/aircon…3-beta_all.deb) l’adressa fiquem l’actual, es pot mirar al seguent post per quina versió van http://forum.ubnt.com/showpost.php?p=177840&postcount=1
instalem amb dpkg (dpkg -i aircontrol_1.3.3-beta_all.deb)

Ja el tenim muntat i a punt per fer-lo anar amb la ip del server:9080

Salut !

Share
Categories: Guifi.net, Informàtica Tags:

Convertinc màquines virtuals de Virtualbox (.vdi) a VMWare (.vmdk)

gener 1st, 2012 No comments

Bon any 2012 a tots !!

He començat l’any jugant amb màquines virtuals i en tenia alguna amb el VirtualBox i m’interessa passar-la al meu nou server amb VMWare, aquí tenius les passes que he seguit:

Anem a convertir una imatge de Vmware a VirtualBox

$qemu-img convert SistemaOperativo.vmdk /tmp/SistemaOperativo.bin

Ara fem servir VirtualBox Manage per convertir la imatge de .bin a .vdi

$VBoxManage convertdd /tmp/debian.bin debian.vdi

Si volguessim fer-ho al revés o sigui convertir de Virtualbox a Vmware primer convertim l’arxiu de .vdi a .raw

$vboxmanage internalcommands converttoraw debian.vdi debian.raw

I després fem servir Qemu per passar a .vmdk

$qemu-img convert -O vmdk debian.raw debian.vmdk

Salut !! i recordeu que si us falta algún paquet, cal fer un apt-get install xxxx

 

Share
Categories: Informàtica Tags: