Test de montée en charge (benchmark) avec des logiciels libres | L'admin sous GNU / Linux - Blog Libre:
'via Blog this'
Nombre total de pages vues
lundi 31 octobre 2011
vendredi 7 octobre 2011
jeudi 6 octobre 2011
Bash: script compte à rebours
Voici un petit script bash permettant d'afficher un compte à rebours dans le shell. On va utiliser une fonction pour ça: decompte.
On va afficher un décompte de 30 secondes avant de revenir sur le prompt.
[root@localhost ~]# vim compte_a_rebours.sh #!/bin/bash # fonction rebours # Affichage d'un compte à rebours # Usage : rebours [nombre de secondes] # Notes : le "echo -e" permet l'utilisation des caractères spéciaux decompte() { i=$1 echo " " while [[ $i -ge 0 ]] do echo -e "\033[31m\r "$i" \c\033[0m" sleep 1 i=$(expr $i - 1) done echo " - " echo -e "\033[32mFin du decompte\033[0m" } # appel d'un compte à rebours de 5 secondes decompte 30 exit :wq [root@localhost ~]# chmod 755 compte_a_rebours.sh [root@localhost ~]# ./compte_a_rebours.sh 0 - Fin du decompte [root@localhost ~]#
lundi 3 octobre 2011
Apache benchmark with Siege
Siege is an http load testing and benchmarking utility. It was designed to let web developers measure their code under duress, to see how it will stand up to load on the internet. Siege supports basic authentication, cookies, HTTP and HTTPS protocols. It lets its user hit a web server with a configurable number of simulated web browsers. Those browsers place the server "under siege."
Siege can be installed with yum (2.66 version from rpmforge repo or 2.70 version from epel repo) or from sources that can be found on the project website. In our case, we will use rpm package from epel repo.
Installation and initial configuration :
[root@localhost ~]# yum install siege -y [root@localhost ~]# siege.config New configuration template added to /root/.siegerc Run siege -C to view the current settings in that file [root@localhost ~]# siege -C CURRENT SIEGE CONFIGURATION JoeDog/1.00 [en] (X11; I; Siege 2.70) Edit the resource file to change the settings. ---------------------------------------------- version: 2.70 verbose: true debug: false protocol: HTTP/1.1 connection: close concurrent users: 15 time to run: n/a repetitions: n/a socket timeout: 30 delay: 1 sec internet simulation: false benchmark mode: false failures until abort: 1024 named URL: none URLs file: /usr/etc/urls.txt logging: true log file: /var/siege.log resource file: /root/.siegerc allow redirects: true allow zero byte data: true allow chunked encoding: true proxy auth: www auth:Available options:
[root@localhost ~]# siege -h SIEGE 2.70 Usage: siege [options] siege [options] URL siege -g URL Options: -V, --version VERSION, prints the version number. -h, --help HELP, prints this section. -C, --config CONFIGURATION, show the current config. -v, --verbose VERBOSE, prints notification to screen. -g, --get GET, pull down HTTP headers and display the transaction. Great for application debugging. -c, --concurrent=NUM CONCURRENT users, default is 10 -i, --internet INTERNET user simulation, hits URLs randomly. -b, --benchmark BENCHMARK: no delays between requests. -t, --time=NUMm TIMED testing where "m" is modifier S, M, or H ex: --time=1H, one hour test. -r, --reps=NUM REPS, number of times to run the test. -f, --file=FILE FILE, select a specific URLS FILE. -R, --rc=FILE RC, specify an siegerc file -l, --log[=FILE] LOG to FILE. If FILE is not specified, the default is used: PREFIX/var/siege.log -m, --mark="text" MARK, mark the log file with a string. -d, --delay=NUM Time DELAY, random delay before each requst between 1 and NUM. (NOT COUNTED IN STATS) -H, --header="text" Add a header to request (can be many) -A, --user-agent="text" Sets User-Agent in request Copyright (C) 2010 by Jeffrey Fulmer, et al. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.Testing:
[root@localhost ~]# siege -b -c 10 -r 3 http://nuxadmin.blogspot.com ** SIEGE 2.70 ** Preparing 10 concurrent users for battle The server is now under siege... HTTP/1.1 200 1.04 secs: 95476 bytes ==> / HTTP/1.1 200 1.17 secs: 95476 bytes ==> / HTTP/1.1 200 1.19 secs: 95476 bytes ==> / HTTP/1.1 200 1.56 secs: 95476 bytes ==> / HTTP/1.1 200 1.80 secs: 95476 bytes ==> / HTTP/1.1 200 0.79 secs: 95476 bytes ==> / HTTP/1.1 200 1.85 secs: 95476 bytes ==> / HTTP/1.1 200 2.07 secs: 95476 bytes ==> / HTTP/1.1 200 1.12 secs: 95476 bytes ==> / HTTP/1.1 200 0.81 secs: 95476 bytes ==> / HTTP/1.1 200 2.78 secs: 95476 bytes ==> / HTTP/1.1 200 1.07 secs: 95476 bytes ==> / HTTP/1.1 200 0.85 secs: 95476 bytes ==> / HTTP/1.1 200 2.93 secs: 95476 bytes ==> / HTTP/1.1 200 1.15 secs: 95476 bytes ==> / HTTP/1.1 200 0.91 secs: 95476 bytes ==> / HTTP/1.1 200 2.16 secs: 95476 bytes ==> / HTTP/1.1 200 1.68 secs: 95476 bytes ==> / HTTP/1.1 200 1.31 secs: 95476 bytes ==> / HTTP/1.1 200 0.78 secs: 95476 bytes ==> / HTTP/1.1 200 1.20 secs: 95476 bytes ==> / HTTP/1.1 200 1.37 secs: 95476 bytes ==> / HTTP/1.1 200 2.00 secs: 95476 bytes ==> / HTTP/1.1 200 1.45 secs: 95476 bytes ==> / HTTP/1.1 200 1.36 secs: 95476 bytes ==> / HTTP/1.1 200 0.61 secs: 95476 bytes ==> / HTTP/1.1 200 0.58 secs: 95476 bytes ==> / HTTP/1.1 200 5.55 secs: 95476 bytes ==> / HTTP/1.1 200 0.49 secs: 95476 bytes ==> / HTTP/1.1 200 0.47 secs: 95476 bytes ==> / done. Transactions: 30 hits Availability: 100.00 % Elapsed time: 6.52 secs< Data transferred: 2.73 MB Response time: 1.47 secs Transaction rate: 4.60 trans/sec Throughput: 0.42 MB/sec Concurrency: 6.76 Successful transactions: 30 Failed transactions: 0 Longest transaction: 5.55 Shortest transaction: 0.47 FILE: /var/siege.log You can disable this annoying message by editing the .siegerc file in your home directory; change the directive 'show-logfile' to falseAnother test:
[root@localhost ~]# siege -c 30 -i -t 30s -d 5 http://nuxadmin.blogspot.com ... Lifting the server siege... done. Transactions: 167 hits Availability: 100.00 % Elapsed time: 29.59 secs Data transferred: 15.21 MB Response time: 2.48 secs Transaction rate: 5.64 trans/sec Throughput: 0.51 MB/sec Concurrency: 13.99 Successful transactions: 167 Failed transactions: 0 Longest transaction: 6.84 Shortest transaction: 0.78 ...
dimanche 14 août 2011
Hack Wii 4.3 sans jeux
La célèbre team Twiizers vient de rendre disponible son tout nouveau projet dénommé LetterBomb et devance Giantpune qui a visiblement un peu trop attendu pour distribuer son outil nommé Mailbox Bomb.
LetterBomb permet donc de hacker la console Nintendo Wii fonctionnant avec le firmware 4.3 sans avoir besoin d'exploiter les failles des célèbres jeux nécessaires jusqu'à présent.
Les profiteurs qui vendaient un Lego Indiana Jones à 150 € sur Ebay vont devoir se trouver un autre business car la côte de ces jeux qui permettent le hack risquent de baisser rapidement !
Pour récupérer LetterBomb, il suffit de se rendre sur le site http://please.hackmii.com/ et indiquer l'adresse MAC de sa console.
On se retrouve alors avec une archive nommée LetterBomb.zip qu'il faudra dézipper à la racine d'une carte SD (comme d'habitude: maximum 2Go, formatée en FAT32).
Il suffit ensuite d'insérer la carte SD dans la Wii puis de consulter ses mails et lire le message 'LetterBomb' ceci va lancer HackMii à partir duquel on pourra installer BootMii et l'Homebrew Channel.
La Wii est désormais hackée et il ne reste plus qu'à installer le homebrew USB Loader GX pour pouvoir lancer ses backups depuis un sotckage USB.
Source: http://hackmii.com/2011/08/letterbomb/
LetterBomb permet donc de hacker la console Nintendo Wii fonctionnant avec le firmware 4.3 sans avoir besoin d'exploiter les failles des célèbres jeux nécessaires jusqu'à présent.
Les profiteurs qui vendaient un Lego Indiana Jones à 150 € sur Ebay vont devoir se trouver un autre business car la côte de ces jeux qui permettent le hack risquent de baisser rapidement !
Pour récupérer LetterBomb, il suffit de se rendre sur le site http://please.hackmii.com/ et indiquer l'adresse MAC de sa console.
On se retrouve alors avec une archive nommée LetterBomb.zip qu'il faudra dézipper à la racine d'une carte SD (comme d'habitude: maximum 2Go, formatée en FAT32).
Il suffit ensuite d'insérer la carte SD dans la Wii puis de consulter ses mails et lire le message 'LetterBomb' ceci va lancer HackMii à partir duquel on pourra installer BootMii et l'Homebrew Channel.
La Wii est désormais hackée et il ne reste plus qu'à installer le homebrew USB Loader GX pour pouvoir lancer ses backups depuis un sotckage USB.
Source: http://hackmii.com/2011/08/letterbomb/
mardi 2 août 2011
10 essential MySQL tools for admins
I found this very interesting article about MySQL tools on networkworld yesterday, it describes the following tools:
mk-query-digest
mydumper
xtrabackup and xtrabackup-manager
tcprstat
mk-table-checksum
stalk and collect
mycheckpoint
shard-query
mk-archiver
oak-security-audit
Here is the link:
mk-query-digest
mydumper
xtrabackup and xtrabackup-manager
tcprstat
mk-table-checksum
stalk and collect
mycheckpoint
shard-query
mk-archiver
oak-security-audit
Here is the link:
mercredi 27 juillet 2011
MySQL-MHA: HA replication tool
A new MySQL project about high availability is proposed by Yoshinori Matsunobu. This project permits to automating master failover and slave promotion within short downtime.
This is the first time that we can see a serious MySQL failover project into replication environment. I haven't tested it yet but lot of people speak about MySQL-MHA on the web actually. Yoshinori Matsunobu is associate with SkySQL for that they provide the commercial support.
MySQL-MHA brings a lot of advantages such as:
Every informations and descriptions can be found on the google code web page of MySQL-MHA.
You can know more about Yoshinori Matsunobu on his blog.
Project is released few days ago and I think that it will no need to wait for a long time to seeing this marvelous tools into your MySQL production replication environment.
This is the first time that we can see a serious MySQL failover project into replication environment. I haven't tested it yet but lot of people speak about MySQL-MHA on the web actually. Yoshinori Matsunobu is associate with SkySQL for that they provide the commercial support.
MySQL-MHA brings a lot of advantages such as:
- Automated master monitoring and failover
- Interactive (manual) Master Failover
- Non-interactive master failover
- Online switching master to a different host
Every informations and descriptions can be found on the google code web page of MySQL-MHA.
You can know more about Yoshinori Matsunobu on his blog.
Project is released few days ago and I think that it will no need to wait for a long time to seeing this marvelous tools into your MySQL production replication environment.
lundi 25 juillet 2011
Cobbler installation server
INTRODUCTION
Cobbler is an installation server that permits to install easily and automatically operating systems, virtualized or not with PXE. We will describe installation, configuration and use into this howto.
For this howto we use a CentOS 5 x86_64 distro.
INSTALLATION
First thing to do is to configure DHCP server. In our case, Cobbler server is not on the same machine that DHCP server, so we have to register the PXE class for Cobbler server on DHCP server.
Here is the part of dhcpd.conf config file regarding Cobbler service. After configuration, we have to restart the DHCP service to validate changes:
CONFIGURATION
For configuration, we will initially adjust cobbler parameters, we have to define an encrypted password that will be the root password for the machine installed with PXE and we define IP address for cobbler server.
We begin by creating the encrypted password using htpasswd:
We have so customized CentOS using CD1 of CentOS. A Howto was written on this blog about customization of CentOS, you can find it here: Customize CentOS
We are going to use this custom ISO file for the import into Cobbler server.
First, we must download this ISO file locally (on Cobbler server) then we gonna mount it and import it.
This operation takes time and a lot of disk space. Knowing that we have no need of all packages available on the official CentOS repo we will create a local repo with little packets which will occupy little disk space but more importantly to make the installation via PXE even faster.
So to create the local repo, we have to install a virtual machine using the custom CentOS ISO created previously (howto on the blog) and then we're gonna download all installed packages locally (on the virtual machine) for create the local repository.
I don't detail the installation of a VM from customized CentOS ISO (I assume you know how to do this).
To download installed packages, we're gonna use a method described previously on this blog too (here is the article: Download RPM packages with yum): with yumdownloader program
COBBLER WEB
We will now install the web interface allows the administration of the cobbler and then configure:
Login: cobbler
Password: cobbler
On this web interface, you can do everything that you can do from command line interface (CLI).
KOAN
Koan is a small program that adds to cobbler and interacts with it for reinstallation and virtualization management. Koan means: kickstart over a network, thus we can use it on a client server to calling cobbler server.
In our case, we will mainly use it for deploying virtual machines. It can be installed via yum, but a more current version is available from the EPEL repo.
Be careful about kernel used in CentOS custom ISO. In my experience, I met problems with some kernels on Xen systems using koan.
To get koan and install it:
This howto is ended, I hope that you can apply it in your workspace and that you understand how having a Cobbler server working perfectly. I use a CentOS environment but I think that other distros are supported with this system. Contact me if you need more help with Cobbler.
Cobbler is an installation server that permits to install easily and automatically operating systems, virtualized or not with PXE. We will describe installation, configuration and use into this howto.
For this howto we use a CentOS 5 x86_64 distro.
INSTALLATION
First thing to do is to configure DHCP server. In our case, Cobbler server is not on the same machine that DHCP server, so we have to register the PXE class for Cobbler server on DHCP server.
Here is the part of dhcpd.conf config file regarding Cobbler service. After configuration, we have to restart the DHCP service to validate changes:
vi /etc/dhcp/dhcpd.conf host cobbler { option host-name "cobbler"; ddns-hostname "cobbler"; hardware ethernet 00:00:00:00:00:00; #MAC address of cobbler server fixed-address 192.168.0.XX; #IP of Cobbler server allow booting; allow bootp; class "PXE" { match if substring(option vendor-class-identifier, 0, 9) = "PXEClient"; next-server 192.168.0.XX; #IP of Cobbler server filename "pxelinux.0"; } } :wq /etc/init.d/dhcpd restartNext, an easy yum command permits to install the Cobbler service on the server:
yum install PyYAML cobbler cobbler-webInstallation is now finished.
CONFIGURATION
For configuration, we will initially adjust cobbler parameters, we have to define an encrypted password that will be the root password for the machine installed with PXE and we define IP address for cobbler server.
We begin by creating the encrypted password using htpasswd:
/usr/bin/htpasswd -c /home/htpasswd root New password: [cobbler] Re-type new password: [cobbler] Adding password for user root cat /home/htpasswd root:xH.KydRoK8CyQThe password to use in the config file of Cobbler server is located after 'root', now we can edit the config file of Cobbler server:
vi /etc/cobbler/settings default_password_crypted: xH.KydRoK8CyQ next_server: 192.168.0.XX #IP of Cobbler server server: 192.168.0.XX #IP of Cobbler server :wqThen we will install the services needed to run cobbler:
yum install tftp tftp-server xinetd /etc/init.d/xinetd start /etc/init.d/cobblerd start chkconfig xinetd on chkconfig cobblerd onNow we will monitor the proper Cobbler configuration and adjust the parameters as will be shown:
cobbler check /etc/init.d/httpd start vi /etc/xinetd.d/rsync disable = no :wq yum install cman cobbler get-loaders yum install debmirror vi /etc/debmirror.conf # @dists="sid"; # @arches="i386"; :wq /etc/init.d/cobblerd restart cobbler sync cobbler checkCobbler is now properly configured. The next step is to import the ISO distribution that we want to make it available via PXE. In our case we will use CentOS and import can not be done with the netinstall ISO and ISO DVD includes too many packages that do not serve us.
We have so customized CentOS using CD1 of CentOS. A Howto was written on this blog about customization of CentOS, you can find it here: Customize CentOS
We are going to use this custom ISO file for the import into Cobbler server.
First, we must download this ISO file locally (on Cobbler server) then we gonna mount it and import it.
mount -t auto -o loop /downloads/CentOS-5.5-x86_64-core.iso /mnt/ cobbler import --path=/mnt --name=Centos5 –arch=x86_64 cobbler sync cobbler list distros: Centos5-x86_64 Centos5-xen-x86_64 profiles: Centos5-x86_64 Centos5-xen-x86_64 systems: repos: images:We can see in this list (distros and profiles) that CentOS ISO was added to Cobbler server. Now we have to create local repository. We could use the official repo CentOS but be aware that the cobbler will grab all the packages locally from the repo.
This operation takes time and a lot of disk space. Knowing that we have no need of all packages available on the official CentOS repo we will create a local repo with little packets which will occupy little disk space but more importantly to make the installation via PXE even faster.
So to create the local repo, we have to install a virtual machine using the custom CentOS ISO created previously (howto on the blog) and then we're gonna download all installed packages locally (on the virtual machine) for create the local repository.
I don't detail the installation of a VM from customized CentOS ISO (I assume you know how to do this).
To download installed packages, we're gonna use a method described previously on this blog too (here is the article: Download RPM packages with yum): with yumdownloader program
mkdir /tmp/rpm yum update -y yum install yum-utils -y rm -rf /root/rpm.log &&rpm -qa > rpm.log for i in $(cat /root/rpm.log) ; do yumdownloader $i --destdir=/tmp/rpm ; doneThen, we declare this local repo on the Cobbler server. To do this we copy every rpm packages into /tmp/rpm directory's on the VM to /tmp/rpm on the Cobbler server:
# Copy packages from VM to Cobbler server scp -r /tmp/rpm/* user@IP_COBBLER:/tmp/rpm/ # Declare Cobbler local repo cobbler repo add --mirror=/tmp/rpm/ --name=centos5-local cobbler reposyncWe can see now the cobbler local repo:
cobbler list repos: centos5-localThen we will edit the default kickstart file, this file permits to automate CentOS install:
cd /var/lib/cobbler/kickstarts/ mv sample.ks sample.ks_bak vi sample.ks auth --useshadow --enablemd5 bootloader --location=mbr clearpart --all --initlabel text firewall --disabled firstboot --disable keyboard fr-pc lang fr_FR.UTF-8 url --url=$tree $yum_repo_stanza $SNIPPET('network_config') reboot rootpw --iscrypted $default_password_crypted selinux --disabled skipx timezone --utc Europe/Paris install zerombr autopart %pre $SNIPPET('log_ks_pre') $kickstart_start $SNIPPET('pre_install_network_config') # Enable installation monitoring $SNIPPET('pre_anamon') %packages $SNIPPET('func_install_if_enabled') %post $SNIPPET('log_ks_post') $yum_config_stanza $SNIPPET('post_install_kernel_options') $SNIPPET('post_install_network_config') $SNIPPET('func_register_if_enabled') $SNIPPET('download_config_files') $SNIPPET('koan_environment') $SNIPPET('redhat_register') $SNIPPET('cobbler_register') $SNIPPET('post_anamon') $kickstart_done :wqThe Cobbler configuration is now finished, we can test the Cobbler service. We create a new VM without boot media, we must activate network/PXE in the boot sequence. Then we start this new VM that will ask an IP address to DHCP server and ask PXE for install support.
COBBLER WEB
We will now install the web interface allows the administration of the cobbler and then configure:
yum install cobbler-web vi /etc/cobbler/modules.conf [authentication] module = authn_configfile [authorization] module = authz_allowall :wq htdigest -c /etc/cobbler/users.digest "Cobbler"cobbler # Type cobbler twice when asking password to have login/password: cobbler/cobbler /etc/init.d/cobblerd restart /etc/init.d/httpd restartYou can get on the interface with a browser to the URL: http://192.168.0.X/cobbler_web (where X must be replace with your Cobbler IP)
Login: cobbler
Password: cobbler
On this web interface, you can do everything that you can do from command line interface (CLI).
KOAN
Koan is a small program that adds to cobbler and interacts with it for reinstallation and virtualization management. Koan means: kickstart over a network, thus we can use it on a client server to calling cobbler server.
In our case, we will mainly use it for deploying virtual machines. It can be installed via yum, but a more current version is available from the EPEL repo.
Be careful about kernel used in CentOS custom ISO. In my experience, I met problems with some kernels on Xen systems using koan.
To get koan and install it:
cd /downloads wget http://download.fedora.redhat.com/pub/epel/5/x86_64/koan-2.0.9-1.el5.noarch.rpm rpm -i koan-2.0.9-1.el5.noarch.rpmHere is an example of koan command to install CentOS virtual machine on Xen system (kernel 2.6.18-194.el5)
koan --virt --profile=centxenvm-xen-x86_64 --server=192.168.0.98 --virt-type=auto --nogfx --virt-name=centos –virt-path=/home/xen/centos/I don't specify the method used to deploy a new VM with koan because I had to customize a lot of thing before that the VM works... It's DIY and I'm not quite happy with it in order to describe it !
This howto is ended, I hope that you can apply it in your workspace and that you understand how having a Cobbler server working perfectly. I use a CentOS environment but I think that other distros are supported with this system. Contact me if you need more help with Cobbler.
lundi 18 juillet 2011
phpSysInfo
phpSysInfo is a PHP script that displays information about the host being accessed. It will displays things like :
- Uptime
- CPU
- Memory
- SCSI, IDE, PCI
- Ethernet
- Floppy
- Video Information
website: http://phpsysinfo.sourceforge.net/
- Uptime
- CPU
- Memory
- SCSI, IDE, PCI
- Ethernet
- Floppy
- Video Information
website: http://phpsysinfo.sourceforge.net/
vendredi 1 juillet 2011
Innotop: MySQL InnoDB Monitor
Innotop est un clone de top (ou top-like) pour MySQL, orienté innoDB. Cette application vous permet d'effectuer de la surveillance. Par ailleurs, ce projet propose plus de fonctionnalités et de souplesses par rapport aux autres outils de la même famille.
Cette nouvelle version (1.8.0) apporte de nouvelles fonctionnalités, comme :
Cette nouvelle version (1.8.0) apporte de nouvelles fonctionnalités, comme :
- Une interface en plugins entièrement configurable
- Une surveillance du nombre de serveurs avec la possibilité de les regrouper
- Une trousse à outils variés comme mytop
- De nouvelles fonctionnalités comme l'interrogation de la période
- Analyse et affiches les informations venant de InnoDB
Inscription à :
Articles (Atom)