Dienstag, 26. Februar 2013

nmap

nmap -sV -PN -sC -sS –O

-sV: Probe open ports to determine service/version info
-sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon scans
-sC: equivalent to --script=default
-O: Enable OS detection

ICMP Tunnel




Angenommen wir haben einen "RootServer" im Internet
mit der WAN IP: 1.2.3.4
Dort lassen wir das Programm: ptunnel und Squid laufen.

# apt-get install ptunnel

startscript

/etc/init.d/ptunnel

#! /bin/sh
### BEGIN INIT INFO
# Provides:          ptunnel
# Required-Start:    $remote_fs $network $syslog
# Required-Stop:     $remote_fs $network $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: initscript for ptunnel
# Description:       initscript for ptunnel
### END INIT INFO

# Do NOT "set -e"

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="IP over ICMP tunneling server"
NAME=ptunnel
DAEMON=/usr/sbin/$NAME
DEFAULT=ptunnel
DAEMON_ARGS=""
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

# Get config
get_config() {
        [ -r /etc/default/$DEFAULT ] && . /etc/default/$DEFAULT
        if [ "$run_daemon" != "true" ] ; then
                [ "$VERBOSE" != no ] && log_progress_msg "- automatic start disabled" && log_end_msg 0
                exit 0
        fi
}


#
# Function that starts the daemon/service
#
do_start()
{
        # populate $DAEMON_ARGS
        get_config
        #
        # Return
        #   0 if daemon has been started
        #   1 if daemon was already running
        #   2 if daemon could not be started
        start-stop-daemon --start --quiet --exec $DAEMON --test > /dev/null \
                || return 1
        start-stop-daemon --start --quiet --background --exec $DAEMON -- -x "" -m 200\
                || return 2
        # Add code here, if necessary, that waits for the process to be ready
        # to handle requests from services started subsequently which depend
        # on this one.  As a last resort, sleep for some time.
}

#
# Function that stops the daemon/service
#
do_stop()
{
        # Return
        #   0 if daemon has been stopped
        #   1 if daemon was already stopped
        #   2 if daemon could not be stopped
        #   other if a failure occurred
        start-stop-daemon --stop --quiet --retry=TERM/5/KILL/5 --exec $DAEMON
        RETVAL="$?"
        [ "$RETVAL" = 2 ] && return 2
        # Wait for children to finish too if this is a daemon that forks
        # and if the daemon is only ever run from this initscript.
        # If the above conditions are not satisfied then add some other code
        # that waits for the process to drop all resources that could be
       # needed by services started subsequently.  A last resort is to
        # sleep for some time.
        start-stop-daemon --stop --quiet --oknodo --retry=0/5/KILL/5 --exec $DAEMON
        [ "$?" = 2 ] && return 2
        # Many daemons don't delete their pidfiles when they exit.
        rm -f $PIDFILE
        return "$RETVAL"
}

case "$1" in
  start)
        [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
        do_start
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
  stop)
        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
        do_stop
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
  restart|force-reload)
        log_daemon_msg "Restarting $DESC" "$NAME"
        do_stop
        case "$?" in
          0|1)
                do_start
                case "$?" in
                        0) log_end_msg 0 ;;
                        1) log_end_msg 1 ;; # Old process is still running
                        *) log_end_msg 1 ;; # Failed to start
                esac
                ;;
          *)
                # Failed to stop
                log_end_msg 1
                ;;
        esac
        ;;
  *)
        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
        exit 3
        ;;
esac



# update-rc.d ptunnel defaults


# /etc/init.d/ptunnel start


Auf dem Client ptunnel installieren oder kompilieren


# ./ptunnel -m 30 -p 1.2.3.4 -lp 8000 -da localhost -dp 3128 -c eth0 -x



Dann auf dem Client im Browser folgenden Proxy eintragen


Host: localhost Port:8000


So kann man aus einem Netzwerk das einen Ping ins internet zulässt aber
keinen Zugriff per HTTP / HTTPs / FTP über einen ICMP Tunnel über
den Proxy auf dem "RootServer" doch surfen.



Batch copy mit SFTP

es muss der public der der QuellMaschine auf der Zielmaschine
unter /root/.ssh/authorized_keys abgelegt werden

sftp -b ~/commands.sftp user@domain.tld

commands.sftp:

cd /dir1
mput *.123
mput *.456
quit


konvertieren von PDF in JPG

convert -geometry 600  -quality 90 name.pdf  name.jpg

nim erstellen von mksysb

nim -o define -t mksysb -a server=master -a location=/export/images/hostname_mksysb -a mk_image=yes -a source=hostname beschreibung

mehrsprachige QT-Programme mit kDevelop erstellen




main.cpp

#include
#include "helloworld.h"
#include
#include


int main(int argc, char** argv)
{
    QApplication app(argc, argv);

    QString locale = QLocale::system().name();
    QTranslator translator;
    translator.load(QString("helloworld_") +locale);
    app.installTranslator(&translator);
    helloworld foo;
    foo.show();
    return app.exec();
}


helloworld.cpp

#include "helloworld.h"

#include
#include
#include
#include


helloworld::helloworld()
{

    QLabel* l = new QLabel( this );
    l->setText(tr( "Hello World!" ));
    setCentralWidget( l );
    QAction* a = new QAction(this);
    a->setText(tr( "&Quit" ));
    connect(a, SIGNAL(triggered()), SLOT(close()) );
    menuBar()->addMenu(tr( "&File" ))->addAction( a );
}

helloworld::~helloworld()
{}

#include "helloworld.moc"


helloworld.h

#ifndef helloworld_H
#define helloworld_H

#include

class helloworld : public QMainWindow
{
Q_OBJECT
public:
    helloworld();
    virtual ~helloworld();
};

#endif // helloworld_H



helloworld.pro

SOURCES      = main.cpp helloworld.cpp
TRANSLATIONS = helloworld_de.ts



developer@localhost:~/projects/helloworld> lupdate helloworld.pro


linguist öffnen und die Datei: helloworld_de.ts laden

dann die Übersetzung machen.

Datei -> Freigeben

Die datei: helloworld_de.qm nach build im Projektverzeichnis kopieren.

Dann sollte das Helloworld in deutsch starten
wenn die Variable LANG auf de_DE.UTF-8 steht






mounten von ISO an LPAR

$ mkrep -sp rootvg -size 5G

$ mkvopt -name mini-powerpc64.iso -file mini-powerpc64.iso

$ lsrep

$ mkvdev -fbo -vadapter vhost5

$ loadopt -disk mini-powerpc64.iso -vtd vtopt0

Mittwoch, 3. Oktober 2012

HMC Commandline

IBM HMC (Hardware Managment Console)
Wer lieber Commandline statt die WebGUI nutzen will
hier nur ein paar wenige Kommandos

 
ssh hscroot@

> vtmenu          =          für öffnen von Consolenfenstern auf LPAR
                                   hier kann man auch nach den SERVER-SYSTEM-NAMEN schauen

> chsysstate -r lpar -m -o on -f -b sms -n

starten einer LPAR ins SMS MENU


> chsysstate -r lpar -m -o on -f -n

starten einer LPAR

> chsysstate -r lpar -m -o shutdown --immed -n

ausschalten einer LPAR



> lssyscfg -m -r lpar

infos über die LPARs auf dem SERVER-SYSTEM abfragen


> lspartition -ix -dlpar

dlpar Infos abfragen von alle SERVER-SYSTEMEN

> lshwres -r virtualio --rsubtype eth --level lpar -m

MAC Adressen
Status Abfrage LPAR ein oder ausgeschaltet






Dienstag, 14. August 2012

leerzeichen aus dateinamen entfernen

bash: for i in *\ *;do mv "$i" "${i// /_}";done

Mittwoch, 11. Juli 2012

AIX Volume Group vergössern

Sie haben in einer Volume Group eine SAN-Disk diese wurde vergrössert. Dann sollten folgende Kommandos abgesetzt werden. # aktuelle grösse anzeigen lsvg rootvg # vergrössern chvg -g on rootvg # prüfen ob die vergrösserung geklappt hat lsvg rootvg

Samstag, 30. Juni 2012

TeamViewer unter Arch Linux 64bit

Damit Teamviewer läuft muss man folgdes Paket installiern pacman –S lib32-libxtst

Akeeba Extract 64bit unter ArchLinux 64bit

Damit Akeeba Extract unter Arch Linux 64bit läuft muss man folgende Pakete installieren pacman -S lib32-gdk-pixbuf2 lib32-gtk2

OpenVPN Server

OpenVPN Server -------------- http://openvpn.net Diese Konfig wurde unter einem Ubuntu Server 12.04 genutzt. cd /etc/openvpn/easy-rsa/ vi vars Dort an den Werten schrauben: Beispielhaft export KEY_SIZE=2048 export CA_EXPIRE=3650 (das wären 10 Jahre) export KEY_EXPIRE=3650 export KEY_COUNTRY="DE" export KEY_PROVINCE="Bundesland" export KEY_CITY="Stadt" export KEY_ORG="Firmenname" export KEY_EMAIL="info@domain.tld" . ./vars ./clean-all ./build-ca ./build-key-server server cp keys/ca.crt /etc/openvpn cp keys/ta.key /etc/openvpn cp keys/server.crt /etc/openvpn cp keys/server.key /etc/openvpn mkdir /etc/openvpn/ccd ./build-key client1 Die files: ca.crt, ta.key, client1.crt, client1.key zur client1.ovpn in ein verz. kopieren (auf dem Client). ./build-dh Einwahl per OpenVPN, der OpenVPN Server befindet sich im selben Netz wie die anderen Server. An der Firewall muss der UDP Port: 1194 auf die IP des OpenVPN Server weitergeleitet werden. /etc/openvpn/server.conf mode server tls-server local 10.0.42.240 port 1194 proto udp dev tun0 persist-key persist-tun ca ca.crt cert server.crt key server.key dh dh2048.pem tls-auth ta.key 0 cipher BF-CBC comp-lzo ifconfig-pool-persist ipp.txt server 172.16.0.0 255.255.255.0 user nobody group nogroup keepalive 10 120 status openvpn-status.log log openvpn.log verb 3 client-config-dir ccd route 192.168.22.0 255.255.255.0 /etc/openvpn/ccd/client1 ifconfig-push 192.168.22.10 192.168.22.9 iroute 192.168.22.0 255.255.255.0 push route "10.0.42.0 255.255.255.0" /etc/rc.local # MASQ and IP_Forward echo "1" > /proc/sys/net/ipv4/ip_forward iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE Client: client1.ovpn client dev tun remote xxx.xxx.xxx.xxx 1194 (hier muss man die WAN-IP der Firewall angeben) nobind resolv-retry infinite persist-key persist-tun ca ca.crt cert client1.crt key client1.key tls-auth ta.key 1 cipher BF-CBC comp-lzo verb 3 script-security 2 Pürfen von MASQ & IPForward iptables -t nat -L -n cat /proc/sys/net/ipv4/ip_forward

Freitag, 9. Dezember 2011

Icinga: Monitoring von VMWare ESX(i) Servern

Icinga: Monitoring von VMWare ESX(i) Servern / virtuellen Maschinen
--------------------------------------------------------------------


Nach dem Icinga installiert und eingerichtet ist kann man Icinga
dazu nutzen ESX(i) Server zu monitoren.

Es gibt in dem Beispiel gibt es nachher einen Benutzer/User: john
mit der email-addresse: john@domain.tld.
Dieser Benutzer gehört der Gruppe: esx-support.
Diese Gruppe hat Zugriff auf Services/Hosts die: "contactgroups esx-support"
enthalten.

Der User: icingaadmin hat zugriff auf alles also auch auf
den icingaserver (localhost.cfg).

Es gibt 3 Hostgruppen: "ESX Server", "ESXi Server" und "Windows Server"

Die Storage auf den ESX(i) Servern heissen "datastore1".


In der Anleitung gehe ich davon aus das Icinga unter: /usr/local/icinga installiert ist.


Downloaden von Status Map Icons:

http://exchange.nagios.org/directory/Graphics-and-Logos/Images-and-Logos/F*Nagios-Icon-Pack/details

Die Datei: FNagios.tar.gz im Verzeichnis /usr/local/icinga/share/images entpacken.


Das check plugin: check_esx3.pl laden von http://exchange.nagios.org/directory/Plugins/Operating-Systems/*-Virtual-Environments/VMWare/check_esx3/details
dieses nach /usr/local/icinga/libexec kopieren und ausführbar machen.

# chown icinga.icinga /usr/local/icinga/libexec/check_esx3.pl
# chmod 755 /usr/local/icinga/libexec/check_esx3.pl


Das check plugin: check_esxi_hardware.py laden von http://www.claudiokuenzler.com/nagios-plugins/check_esxi_hardware.php

# chown icinga.icinga /usr/local/icinga/libexec/check_esxi_hardware.py
# chmod 755 /usr/local/icinga/libexec/check_esxi_hardware.py



Das check_plugin: check_mem.pl laden von http://exchange.nagios.org/directory/Plugins/System-Metrics/Memory/check_mem-2Epl/details


/usr/local/icinga/etc/cgi.cfg

diese Zeile sollten angepasst werden, sprich "esx-support" hinzu

authorized_for_system_information=icingaadmin,esx-support
authorized_for_all_services=icingaadmin,esx-support
authorized_for_all_hosts=icingaadmin,esx-support
authorized_for_all_service_commands=icingaadmin,esx-support


/usr/local/icinga/etc/resource.cfg

# Sets $USER1$ to be the path to the plugins
$USER1$=/usr/local/icinga/libexec

# Store some usernames and passwords (hidden from the CGIs)
$USER6$=root
$USER7$=password
$USER8$=root
$USER9$=password2



Diese Datei ist dafür gedacht das keine Passwörter im klartext in den Konfigdateien stehen.




# htpasswd -c /usr/local/icinga/etc/htpasswd.users john

Für User: John ein password festlegen.

/usr/local/icinga/etc/objects/contacts.cfg


define contact{
contact_name icingaadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Icinga Admin ; Full name of user

email icinga@localhost ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
}


define contact{
contact_name john; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias John Smith ; Full name of user

contactgroups esx-support
email john@domain.tld ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
}



define contactgroup{
contactgroup_name admins
alias Icinga Administrators
members icingaadmin
}


define contactgroup{
contactgroup_name esx-support
alias ESX Administrators
members icingaadmin, john
}





/usr/local/icinga/etc/objects/hostgroups.cfg

define hostgroup{
hostgroup_name esx-servers; The name of the hostgroup
alias VMWARE ESX; Long name of the group
members esxi01; Comma separated list of hosts that belong to this group
}

define hostgroup{
hostgroup_name esxi-servers; The name of the hostgroup
alias VMWARE ESXi; Long name of the group
members esxi01; Comma separated list of hosts that belong to this group
}

define hostgroup{
hostgroup_name windows-servers; The name of the hostgroup
alias Windows Server; Long name of the group
members vcenter01; Comma separated list of hosts that belong to this group
}



/usr/local/icinga/etc/objects/commands.cfg



# 'check_by_ssh' command definition
define command{
command_name check_by_ssh
command_line $USER1$/check_by_ssh -H $HOSTADDRESS$ -p $ARG1$ -l "$ARG2$" -C "$ARG3$" -t20
}




# 'check_mysql' command definition
define command{
command_name check_mysql
command_line $USER1$/check_mysql -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$
}


# 'check_ntp_time' command definition
define command{
command_name check_ntp_time
command_line $USER1$/check_ntp_time -H $HOSTADDRESS$
}

# 'check_mailq' command definition
define command{
command_name check_mailq
command_line $USER1$/check_mailq -w $ARG1$ -c $ARG2$
}

# 'check_dns' command definition
define command{
command_name check_dns
command_line $USER1$/check_dns -s $ARG1$ -H $ARG2$
}


# 'check_icinga' command definition
define command{
command_name check_icinga
command_line $USER1$/check_nagios -e 5 -F $ARG1$ -C $ARG2$
}


# 'check_mem' command definition
define command{
command_name check_mem
command_line $USER1$/check_mem.pl -w $ARG1$ -c $ARG2$ -f -C
}


# Hardwarecheck

# 'check_esxi_hardware' command definition
define command{
command_name check_esxi_hardware
command_line $USER1$/check_esxi_wbem.py https://$HOSTADDRESS$ $ARG1$ "$ARG2$" $ARG3$
}


# ESX(i) Server

define command{
command_name check_esx3_host_cpu_usage
command_line $USER1$/check_esx3.pl -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -l cpu -s usage -w $ARG3$ -c $ARG4$
}


define command{
command_name check_esx3_host_mem_usage
command_line $USER1$/check_esx3.pl -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -l mem -s usage -w $ARG3$ -c $ARG4$
}

define command{
command_name check_esx3_host_mem_overhead
command_line $USER1$/check_esx3.pl -H $HOSTADDRESS$ -u $ARG1$ -p $USER12$ -l mem -s overhead -w $ARG3$ -c $ARG4$
}


define command{
command_name check_esx3_host_mem_memctl
command_line $USER1$/check_esx3.pl -H $HOSTADDRESS$ -u $ARG1$ -p $USER12$ -l mem -s memctl -w $ARG3$ -c $ARG4$
}


define command{
command_name check_esx3_host_swap_usage
command_line $USER1$/check_esx3.pl -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -l mem -s swap -w $ARG3$ -c $ARG4$
}

define command{
command_name check_esx3_host_net_usage
command_line $USER1$/check_esx3.pl -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -l net -s usage -w $ARG3$ -c $ARG5$
}

define command{
command_name check_esx3_host_vmfs
command_line $USER1$/check_esx3.pl -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -l vmfs -s "$ARG1$" -w "$ARG3$" -c "$ARG4$"
}


define command{
command_name check_esx3_host_vmfs_local
command_line $USER1$/check_esx3.pl -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -l vmfs -s "$ARG3$"
}


define command{
command_name check_esx3_host_runtime_status
command_line $USER1$/check_esx3.pl -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -l runtime -s status
}

define command{
command_name check_esx3_host_runtime_issues
command_line $USER1$/check_esx3.pl -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -l runtime -s issues
}

define command{
command_name check_esx3_host_io_read
command_line $USER1$/check_esx3.pl -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -l io -s read -w $ARG3$ -c $ARG4$
}

define command{
command_name check_esx3_host_io_write
command_line $USER1$/check_esx3.pl -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -l io -s write -w $ARG3$ -c $ARG4$
}




## VM

define command{
command_name check_esx3_vm_cpu_usage
command_line $USER1$/check_esx3.pl -H $ARG1$ -u $ARG4$ -p $ARG5$ -N "$HOSTALIAS$" -l cpu -s usage -w $ARG2$ -c $ARG3$
}

define command{
command_name check_esx3_vm_cpu_mhz
command_line $USER1$/check_esx3.pl -H $ARG1$ -u $ARG4$ -p $ARG5$ -N "$HOSTALIAS$" -l cpu -s usagemhz -w $ARG2$ -c $ARG3$
}


define command{
command_name check_esx3_vm_mem_usage
command_line $USER1$/check_esx3.pl -H $ARG1$ -u $ARG4$ -p $ARG5$ -N "$HOSTALIAS$" -l mem -s usage -w $ARG2$ -c $ARG3$
}


define command{
command_name check_esx3_vm_mem_overhead
command_line $USER1$/check_esx3.pl -H $ARG1$ -u $ARG4$ -p $ARG5$ -N "$HOSTALIAS$" -l mem -s overhead -w $ARG2$ -c $ARG3$
}


define command{
command_name check_esx3_vm_swap_usage
command_line $USER1$/check_esx3.pl -H $ARG1$ -u $ARG4$ -p $ARG5$ -N "$HOSTALIAS$" -l mem -s swap -w $ARG2$ -c $ARG3$
}

define command{
command_name check_esx3_vm_net_usage
command_line $USER1$/check_esx3.pl -H $ARG1$ -u $ARG4$ -p $ARG5$ -N "$HOSTALIAS$" -l net -s usage -w $ARG2$ -c $ARG3$
}

define command{
command_name check_esx3_vm_runtime_cpu
command_line $USER1$/check_esx3.pl -H $ARG1$ -u $ARG4$ -p $ARG5$ -N "$HOSTALIAS$" -l runtime -s cpu -w $ARG2$ -c $ARG3$
}

define command{
command_name check_esx3_vm_runtime_mem
command_line $USER1$/check_esx3.pl -H $ARG1$ -u $ARG5$ -p $ARG5$ -N "$HOSTALIAS$" -l runtime -s mem -w $ARG2$ -c $ARG3$
}

define command{
command_name check_esx3_vm_runtime_status
command_line $USER1$/check_esx3.pl -H $ARG1$ -u $ARG4$ -p $ARG5$ -N "$HOSTALIAS$" -l runtime -s status
}

define command{
command_name check_esx3_vm_runtime_tools
command_line $USER1$/check_esx3.pl -H $ARG1$ -u $ARG2$ -p $ARG3$ -N "$HOSTALIAS$" -l runtime -s tools
}


define command{
command_name check_esx3_vm_runtime_state
command_line $USER1$/check_esx3.pl -H $ARG1$ -u $ARG2$ -p $ARG3$ -N "$HOSTALIAS$" -l runtime -s state
}

define command{
command_name check_esx3_vm_runtime_issues
command_line $USER1$/check_esx3.pl -H $ARG1$ -u $ARG2$ -p $ARG3$ -N "$HOSTALIAS$" -l runtime -s issues
}





# ESX(i) Datacenter / vCenter --> check VMs

define command{
command_name check_esx3_dc_host_cpu_usage
command_line $USER1$/check_esx3 -D $ARG1$ -u $ARG2$ -p $ARG3$ -H "$HOSTALIAS$" -l cpu -s usage -w $ARG2$ -c $ARG4$
}

define command{
command_name check_esx3_dc_host_mem_usage
command_line $USER1$/check_esx3 -D $ARG1$ -u $ARG2$ -p $ARG3$ -H "$HOSTALIAS$" -l mem -s usage -w $ARG2$ -c $ARG4$
}

define command{
command_name check_esx3_dc_host_swap_usage
command_line $USER1$/check_esx3 -D $ARG1$ -u $ARG2$ -p $ARG3$ -H "$HOSTALIAS$" -l swap -s usage -w $ARG2$ -c $ARG4$
}

define command{
command_name check_esx3_dc_host_net_usage
command_line $USER1$/check_esx3 -D $ARG1$ -u $ARG2$ -p $ARG3$ -H "$HOSTALIAS$" -l net -s usage -w $ARG2$ -c $ARG3$
}

define command{
command_name check_esx3_dc_host_runtime_status
command_line $USER1$/check_esx3 -D $ARG1$ -u $ARG2$ -p $ARG3$ -H "$HOSTALIAS$" -l -l runtime -s status
}

define command{
command_name check_esx3_dc_host_runtime_state
command_line $USER1$/check_esx3 -D $ARG1$ -u $ARG2$ -p $ARG3$ -H "$HOSTALIAS$" -l -l runtime -s state
}

define command{
command_name check_esx3_dc_host_runtime_tools
command_line $USER1$/check_esx3 -D $ARG1$ -u $ARG2$ -p $ARG3$ -H "$HOSTALIAS$" -l runtime -s tools
}

define command{
command_name check_esx3_dc_host_runtime_issue
command_line $USER1$/check_esx3 -D $ARG1$ -u $ARG2$ -p $ARG3$ -H "$HOSTALIAS$" -l runtime -s issues
}






/usr/local/icinga/etc/icinga.cfg

cfg_dir=/usr/local/icinga/etc/objects


/usr/local/icinga/etc/objects/esxi01.cfg


# Define a host for the local machine

define host{
use linux-server ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name esxi01
alias esxi01
address esxi01
statusmap_image vendors/vmware.png
contact_groups esx-support
notifications_enabled 1
}




###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################



# Define a service to "ping" the local machine

define service{
use local-service ; Name of service template to use
host_name esxi01
service_description PING
check_command check_ping!100.0,20%!500.0,60%
contact_groups esx-support
notifications_enabled 1
}


define service{
use local-service ; Name of service template to use
host_name esxi01
service_description SSH
check_command check_ssh
contact_groups esx-support
notifications_enabled 1

}


define service{
use generic-service
host_name esx01
service_description HARDWARE
check_command check_esxi_hardware!$USER6$!$USER7$!auto
notifications_enabled 1
}



define service{
use local-service ; Name of service template to use
host_name esxi01
service_description ESXI_HOSTCPUUSAGE
check_command check_esx3_host_cpu_usage!80!90
contact_groups esx-support
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name esxi01
service_description ESXI_HOSTMEM
check_command check_esx3_host_mem_usage!80!90
contact_groups esx-support
notifications_enabled 1
}



define service{
use local-service ; Name of service template to use
host_name esxi01
service_description ESXI_HOSTSWAP
check_command check_esx3_host_swap_usage!80!90
contact_groups esx-support
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name esxi01
service_description ESXI_HOSTNETUSAGE
check_command check_esx3_host_net_usage!102400!204800
contact_groups esx-support
notifications_enabled 1
}


define service{
use local-service ; Name of service template to use
host_name esxi01
service_description ESXI_HOSTVMFS_LOCAL
check_command check_esx3_host_vmfs!datastore1!90%!95%
contact_groups esx-support
notifications_enabled 1
}


define service{
use local-service ; Name of service template to use
host_name esxi01
service_description ESXI_RUNTMIESTATUS
check_command check_esx3_host_runtime_status
contact_groups esx-support
notifications_enabled 1
}


define service{
use local-service ; Name of service template to use
host_name esxi01
service_description ESXI_HOSTIOREAD
check_command check_esx3_host_io_read!40!90
contact_groups esx-support
notifications_enabled 1
}


define service{
use local-service ; Name of service template to use
host_name esxi01
service_description ESXI_HOSTIOWRITE
check_command check_esx3_host_io_write!40!90
contact_groups esx-support
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name esxi01
service_description HTTPS
check_command check_https
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name esxi01
service_description HTTP
check_command check_http
contact_groups esx-support
notifications_enabled 1
}





/usr/local/icinga/etc/objects/esx01.cfg (über vCenter "vcenter01")


# Define a host for the local machine

define host{
use linux-server ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name esx01
alias esx01
address esx01
statusmap_image vendors/vmware2.png
contact_groups esx-support
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name esx01
service_description PING
check_command check_ping!100.0,20%!500.0,60%
contact_groups esx-support
notifications_enabled 1
}


define service{
use local-service ; Name of service template to use
host_name esx01
service_description SSH
check_command check_ssh
contact_groups esx-support
notifications_enabled 1
}


define service{
use local-service ; Name of service template to use
host_name esx01
service_description HTTPS
check_command check_https
contact_groups esx-support
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name esx01
service_description HTTP
check_command check_http
contact_groups esx-support
notifications_enabled 1
}


define service{
use local-service ; Name of service template to use
host_name esx01
service_description ESX_HOSTCPUUSAGE
check_command check_esx3_host_cpu_usage!$USER6$!$USER7$!80!90
contact_groups esx-support
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name esx01
service_description ESX_HOSTMEM
check_command check_esx3_host_mem_usage!$USER6$!$USER7$!80!90
contact_groups esx-support
notifications_enabled 1
}



define service{
use local-service ; Name of service template to use
host_name esx01
service_description ESX_HOSTSWAP
check_command check_esx3_host_swap_usage!$USER6$!$USER7$!80!90
contact_groups esx-support
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name esx01
service_description ESX_HOSTNETUSAGE
check_command check_esx3_host_net_usage!$USER6$!$USER7$!102400!204800
contact_groups esx-support
notifications_enabled 1
}


define service{
use local-service ; Name of service template to use
host_name esx01
service_description ESX_HOSTVMFS_LOCAL
check_command check_esx3_host_vmfs!datastore1!$USER6$!$USER7$!90%!95%
contact_groups esx-support
notifications_enabled 1
}


define service{
use local-service ; Name of service template to use
host_name esx01
service_description ESX_RUNTMIESTATUS
check_command check_esx3_host_runtime_status!$USER6$!$USER7$
contact_groups esx-support
notifications_enabled 1
}


define service{
use local-service ; Name of service template to use
host_name esx01
service_description ESX_HOSTIOREAD
check_command check_esx3_host_io_read!40!90!$USER6$!$USER7$
contact_groups esx-support
notifications_enabled 1
}


define service{
use local-service ; Name of service template to use
host_name esx01
service_description ESXI_HOSTIOWRITE
check_command check_esx3_host_io_write!$USER6$!$USER7$!40!90
contact_groups esx-support
notifications_enabled 1
}







/usr/local/icinga/etc/objects/vcenter01.cfg

WICHTIG ist das der alias = dem Namen auf dem ESX-Server ist (schreibweise beachten)



# Define a host for the local machine

define host{
use linux-server ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name vcenter01
alias vcenter01
address vcenter01
statusmap_image vendors/vista.png
contact_groups esx-support
notifications_enabled 1
}

# Define a service to "ping" the local machine

define service{
use local-service ; Name of service template to use
host_name vcenter01
service_description PING
check_command check_ping!100.0,20%!500.0,60%
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name vcenter01
service_description HTTP
check_command check_http
notifications_enabled 1
}


define service{
use local-service ; Name of service template to use
host_name vcenter01
service_description HTTPS
check_command check_https
notifications_enabled 1
}




define service{
use local-service ; Name of service template to use
host_name vcenter01
service_description VM_CPUUSAGE
check_command check_esx3_dc_host_cpu_usage!vcenter01!$USER8$!$USER9$!!80!90
contact_groups esx-support
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name vcenter01
service_description VM_MEM
check_command check_esx3_dc_host_mem_usage!vcenter01!$USER8$!$USER9$!80!90
contact_groups esx-support
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name vcenter01
service_description VM_SWAP
check_command check_esx3_dc_host_swap_usage!vcenter01!$USER8$!$USER9$!80!90
contact_groups esx-support
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name vcenter01
service_description VM_NETUSAGE
check_command check_esx3_dc_net_usage!vcenter01!$USER8$!$USER9$!102400!204800
contact_groups esx-support
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name vcenter01
service_description VM_RUNTMIESTATUS
check_command check_esx3_dc_runtime_status!$USER8$!$USER9$!vcenter01$USER8$!$USER9$
contact_groups esx-support
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name vcenter01
service_description VM_RUNTMIESTATE
check_command check_esx3_dc_runtime_state!vcenter01$USER8$!$USER9$
contact_groups esx-support
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name vcenter01
service_description VM_VMWARETools
check_command check_esx3_dc_runtime_tools!vcenter01$USER8$!$USER9$
contact_groups esx-support
notifications_enabled 1
}



/usr/local/icinga/etc/objects/localhost.cfg



# Define a host for the local machine

define host{
use linux-server ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name localhost
alias localhost
address 127.0.0.1
statusmap_image vendors/ubuntu.png
}



define service{
use local-service ; Name of service template to use
host_name localhost
service_description PING
check_command check_ping!100.0,20%!500.0,60%
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name localhost
service_description Root Partition
check_command check_local_disk!20%!10%!/
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name localhost
service_description Current Users
check_command check_local_users!20!50
notifications_enabled 1
}


define service{
use local-service ; Name of service template to use
host_name localhost
service_description Total Processes
check_command check_local_procs!250!400!RSZDT
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name localhost
service_description Current Load
check_command check_local_load!5.0,4.0,3.0!10.0,6.0,4.0
notifications_enabled 1
}


define service{
use local-service ; Name of service template to use
host_name localhost
service_description Swap Usage
check_command check_local_swap!20!10
notifications_enabled 1
}



define service{
use local-service ; Name of service template to use
host_name localhost
service_description SSH
check_command check_ssh
notifications_enabled 1
}



define service{
use local-service ; Name of service template to use
host_name localhost
service_description HTTP
check_command check_http
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name localhost
service_description MySQL
check_command check_mysql!icinga!icinga
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name localhost
service_description NTPTime
check_command check_ntp_time
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name localhost
service_description SMTP
check_command check_smtp
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name localhost
service_description MailQ
check_command check_mailq!5!10
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name localhost
service_description DNS
check_command check_dns!192.168.1.1!www.heise.de
notifications_enabled 1
}


define service{
use local-service ; Name of service template to use
host_name localhost
service_description Icinga
check_command check_icinga!/usr/local/icinga/var/status.dat!/usr/local/icinga/bin/icinga
notifications_enabled 1
}


define service{
use local-service ; Name of service template to use
host_name localhost
service_description MySQL-Query
check_command check_mysql_query!icinga_systemcommands!localhost!icinga!icinga!icinga
notifications_enabled 1
}

define service{
use local-service ; Name of service template to use
host_name localhost
service_description Memory
check_command check_mem!10!5
contact_groups admins
notifications_enabled 1
}







Prüfen der Konfiguration:

# /usr/local/icinga/bin/icinga -v /usr/local/icinga/etc/icinga.cfg


Wenn OK, Icinga durchstarten

# /etc/init.d/icinga reload

Icinga auf Ubuntu Server 11.10

Icinga auf Ubuntu Server 11.10 (64bit)
--------------------------------------

0. Installation Ubuntu Server

apt-get update
apt-get upgrade
1. apt-get install -y libdbi-dev libdbd-mysql build-essential libgd2-xpm-dev libjpeg62-dev libpng12-dev mysql-server mysql-client apache2 openssl libssl-dev libmysqlclient16-dev

2. useradd -m icinga
passwd icinga
groupadd icinga-cmd
usermod -a -G icinga-cmd icinga
usermod -a -G icinga-cmd www-data


3. cd /var/tmp
wget http://sourceforge.net/projects/icinga/files/icinga/1.6.1/icinga-1.6.1.tar.gz/download

tar xvfz icinga-1.6.1.tar.gz

cd /var/tmp/icinga-1.6.1
./configure --with-command-group=icinga-cmd --enable-idoutils
make all
sudo make fullinstall

4. cd /var/tmp
wget http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.15/nagios-plugins-1.4.15.tar.gz/download
tar xvfz nagios-plugins-1.4.15.tar.gz

cd /usr/src/nagios-plugins-1.4.15
./configure --prefix=/usr/local/icinga --with-nagios-user=icinga
make
sudo make install


5.

sudo htpasswd -c /usr/local/icinga/etc/htpasswd.users icingaadmin
sudo /etc/init.d/apache2 restart
sudo mysql -u root -p
create database icinga;
GRANT USAGE ON icinga.* 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

cd /var/tmp/icinga-1.0.2/module/idoutils/db/mysql
sudo mysql -u root -p icinga < mysql.sql

sudo mv /usr/local/icinga/etc/ido2db.cfg-sample /usr/local/icinga/etc/ido2db.cfg
sudo mv /usr/local/icinga/etc/idomod.cfg-sample /usr/local/icinga/etc/idomod.cfg

sudo vi /usr/local/icinga/etc/ido2db.cfg

db_user und db_password anpassen wenn nicht "icinga" als password verwendet wurde.

sudo vi /usr/local/icinga/etc/icinga.cfg

broker_module=/usr/local/icinga/bin/idomod.o config_file=/usr/local/icinga/etc/idomod.cfg

sudo /etc/init.d/ido2db start
sudo /etc/init.d/icinga start
sudo update-rc.d ido2db defaults 50
sudo update-rc.d icinga defaults 51



püfen der config

cd /usr/local/icinga/bin
sudo ./icinga -v /usr/local/icinga/etc/icinga.cfg




sudo apt-get install sendmail mailutils

vi /etc/mail/sendmail.mc

add: FEATURE(`mailertable', `hash -o /etc/mail/mailertable.db')dnl

vi /etc/mail/mailertable

example:

.domain.tld esmtp:[mailserver]


sendmailconfig



mail user@domain.tld

check mail recivied

Montag, 21. November 2011

tcp_timestamps abschalten

Abschalten von Info der (nic)uptime


z.B: in der /etc/rc.local
echo 0 > /proc/sys/net/ipv4/tcp_timestamps



Testen mit:



für SSL

hping3 -S --tcp-timestamp -p 443 -c 2


für HTTP

hping3 -S --tcp-timestamp -p 80 -c


für ssh

hping3 -S --tcp-timestamp -p 22 -c

Sonntag, 19. Juni 2011

Icinga auf Ubuntu Server 10.04

Icinga auf Ubuntu Server 10.04 (64bit)
--------------------------------------

0. Installation Ubuntu Server


1. apt-get install -y libdbi0-dev libdbd-mysql build-essential libgd2-xpm-dev libjpeg62-dev libpng12-dev mysql-server mysql-client apache2 openssl libssl-dev libmysqlclient16-dev

2. useradd -m icinga
passwd icinga
groupadd icinga-cmd
usermod -a -G icinga-cmd icinga
usermod -a -G icinga-cmd www-data


3. cd /var/tmp
wget http://sourceforge.net/projects/icinga/files/icinga/1.0.2/icinga-1.0.2.tar.gz/download

tar xvfz icinga-1.0.2.tar.gz

cd /var/tmp/icinga-1.0.2
./configure --with-command-group=icinga-cmd --enable-idoutils
make all
sudo make fullinstall

4. cd /var/tmp
wget http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.15/nagios-plugins-1.4.15.tar.gz/download
tar xvfz nagios-plugins-1.4.15.tar.gz

cd /usr/src/nagios-plugins-1.4.15
./configure --prefix=/usr/local/icinga --with-nagios-user=icinga
make
sudo make install


5.

sudo htpasswd -c /usr/local/icinga/etc/htpasswd.users icingaadmin
sudo /etc/init.d/apache2 restart
sudo mysql -u root -p
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

cd /var/tmp/icinga-1.0.2/module/idoutils/db/mysql
sudo mysql -u root -p icinga < mysql.sql

sudo mv /usr/local/icinga/etc/ido2db.cfg-sample /usr/local/icinga/etc/ido2db.cfg
sudo mv /usr/local/icinga/etc/idomod.cfg-sample /usr/local/icinga/etc/idomod.cfg

sudo vi /usr/local/icinga/etc/ido2db.cfg

db_user und db_password anpassen wenn nicht "icinga" als password verwendet wurde.

sudo vi /usr/local/icinga/etc/icinga.cfg

broker_module=/usr/local/icinga/bin/idomod.o config_file=/usr/local/icinga/etc/idomod.cfg

sudo /etc/init.d/ido2db start
sudo /etc/init.d/icinga start
sudo update-rc.d ido2db defaults 50
sudo update-rc.d icinga defaults 51



püfen der config

cd /usr/local/icinga/bin
sudo ./icinga -v /usr/local/icinga/etc/icinga.cfg




sudo apt-get install sendmail mailutils

vi /etc/mail/sendmail.mc

add: FEATURE(`mailertable', `hash -o /etc/mail/mailertable.db')dnl

vi /etc/mail/mailertable

example:

.domain.tld esmtp:[mailserver]


sendmailconfig



mail user@domain.tld

check mail recivied

ntop 4 installation unter Ubuntu 10.04 Server

nTop 4 unter Ubuntu 10.04(64bit)
--------------------------------

Internetanbindung notwendig!
Möglichst 2 Netzwerkkarten (eine zum Mitlauschen, eine zum Netzwerkzugriff)
Festplatte sollte min 4 GB haben (für kleinen Test) lieber grösser.


1. Installation von Ubuntu Server 10.04 (64bit)
Download: http://www.ubuntu.com/server/get-ubuntu/download
OpenSSH Server

2. Online Update
sudo apt-get update
sudo apt-get updrade

u.U. muss man den akt. Kernel noch instl.
sudo apt-get install linux-headers-server linux-image-server linux-server

diese sagt einem aber sudo apt-get upgrade wenn man es nochmals aufruft

Danach ein reboot: sudo reboot
dann sudo apt-get autoremove um alte nichtmehr benötigte
Packte zu deinstallieren

sudo apt-get install build-essential
sudo apt-get install libtool
sudo apt-get install autoconf
sudo apt-get install automake
sudo apt-get install m4
sudo apt-get install libpcap0.8
sudo apt-get install libpcap0.8-dev
sudo apt-get install zlib1g
sudo apt-get install zlib1g-dev
sudo apt-get install rrdtool
sudo apt-get install librrd4
sudo apt-get install librrd-dev
sudo apt-get install graphviz


sudo apt-get install openssl
sudo apt-get install libssl-dev

sudo apt-get install libgeoip-dev


sudo aptitude install python-dev
sudo apt-get install pyhton-dev
sudo apt-get install pyhton-mako

sudo apt-get install libgdbm-dev


3. Download von nTop Source
http://sourceforge.net/projects/ntop/

oder

wget http://sourceforge.net/projects/ntop/files/ntop/ntop-4.0.1/ntop-4.0.1.tar.gz/download

z.B: tar xvfz ntop-4.0.1.tar.gz


cd ntop-4.0.1

./autogen.sh

./configure

make

sudo make install

sudo adduser --system --group --home /usr/local/lib/ntop ntop


sudo cp packages/debian/etc/ld.so.conf.d/ntop.conf /etc/ld.so.conf.d




vi /etc/init.d/ntop

#! /bin/sh
#
# ntop script
#
# NOTE: Copy this script in /etc/init.d/ntop
#
# Author:
# Paul Mansfield
# Worldpay - 20020218
#
# Fixed by L.Deri - May 2007
# mod. D.Schneck - August 2010

set -e

NAME=ntop
DAEMON=/usr/local/bin/ntop
CONFIG=/etc/ntop/ntop.conf
PROTOCOLFILE=/etc/ntop/protocol.list
test -x $DAEMON || exit 0

start_ntop() {
echo -n "Starting ntop "
$DAEMON @$CONFIG -p $PROTOCOLFILE > /var/log/ntop.out &
echo " ...done"
}

stop_ntop() {
echo -n "Stopping ntop "
if test -f /var/run/ntop.pid ; then
kill `cat /var/run/ntop.pid`
echo -n " killed pid `cat /var/run/ntop.pid`"
rm /var/run/ntop.pid
fi
echo " ...done"
}

case "$1" in
start)
start_ntop
;;

stop)
stop_ntop
;;

restart)
stop_ntop
start_ntop
;;

defaults)
$DAEMON -u ntop --set-admin-password=admin
;;

*)
echo "Usage: /etc/init.d/$NAME {start|stop|restart|install}"
exit 1
;;
esac

exit 0



sudo chmod 755 /etc/init.d/ntop






sudo ldconfig

sudo chown -R ntop.ntop /usr/local/var/ntop

cd /etc/init.d

sudo mkdir /etc/ntop

cd /var/tmp/ntop-4.0.1

sudo cp packages/Redhat/ntop.conf.sample /etc/ntop/ntop.conf

In dieser Datei werden z.B: Portnummer, Netzwerkkarte usw. eingestellt.

--db-file-path /usr/local/var/ntop muss angepasst werden

sudo cp packages/debian.official/protocol.list /etc/ntop

sudo ntop --user ntop -P /usr/local/var/ntop

sudo chown -R ntop.ntop /usr/local/var/ntop

sudo service ntop start

Soll ntop beim starten des Systemns automatisch gestartet werden, geben Sie folgendes ein:

sudo update-rc.d ntop defaults

OGG in MP3 umwandeln

for x in *.ogg; do ffmpeg -i "$x" "`basename "$x" .ogg`.mp3"; done

Ändern von gruppen

ändern von gruppen(rechten)

find admin audit bin esa etc home lpp opt oracle pconsole sapmnt sbin tivoli unix usr var -group 203 -exec chgrp 200 {} \;