Oct 202011
 

We had performance issues on our NFS servers, very poor performances.
after analyze we have seen that the bottleneck came from the disks, as always;
but tuning the FS did not solve the problem.

I talk about 1500 NFS mountpoint (running on 9 nodes from ServiceGuard cluster solution) as in my actual mission, everything works through NFS.
The homedir of course but also the applications, the logs, libraries etc…
Continue reading »

Oct 142011
 

Hi gents,

after searching a script to massive set quota for users on HP-UX, i’ve found nothing, only people asking how to do it.
of course you have the ‘edquota’ command, which can copy a user’s quota template into another account, but this is not the best way.

so, i’ve wrote a little script to do the job, for all my NFS users.

this script will definitively not fit for an other person than me and my needs, but I think it can be a good basis.
Continue reading »

Août 112011
 

la commande « sleep x » sous Unix permet de faire une pause de x secondes.

je viens de trouver une commande perl assez satisfaisante permettant de faire des pause de moins d’une seconde.
intéressant par exemple lorsque l’on fork des process.
en effet, s’il n’y a pas de pause dans le script, lorsque les forks se terminent, ils restent en état zombie.
Continue reading »

Juin 232011
 

Voici un script qui regarde si l’espace disponible pour un crash dump est suffisant ou pas.
bien évidemment, il faut le lancer avant que la machine ne freeze.

Download : checkdumpsize.sh

#!/bin/sh

PATH=/bin:/usr/bin:/sbin:/usr/sbin
SAVECRASH_DIR="/var/adm/crash"

[ -f /etc/rc.config.d/savecore ] && . /etc/rc.config.d/savecore
[ -f /etc/rc.config.d/savecrash ] && . /etc/rc.config.d/savecrash
[ -f /etc/rc.config.d/savecrash ] || {
	echo "ERROR: /etc/rc.config.d/savecrash defaults file MISSING"
	exit 0
}

Print_data () {
	printf " %4s Size Mem dump %6d\n" "$1" $MEM_DUMP_SIZE

	if [ "$MEM_DUMP_SIZE" -lt "$LV_DUMP_SIZE" ]
	then 
		printf " Size Disk dump     %6d OK\n" $LV_DUMP_SIZE
	else
		printf " Size Disk dump     %6d Error\n" $LV_DUMP_SIZE
	fi

	if [ "$MEM_DUMP_SIZE" -lt "$FS_DUMP_SIZE" ]
	then 
		printf " Size free Dir      %6d OK\n" $FS_DUMP_SIZE
	else
		printf " Size free Dir      %6d Error\n" $FS_DUMP_SIZE
	fi

	printf "\n"
}

MEM_DUMP_SIZE=$( /sbin/crashconf -v |grep "Total pages included in dump"| cut -d":" -f2 )
MEM_DUMP_SIZE=$( echo $MEM_DUMP_SIZE |awk '{ printf ("%d\n", ($1 * 4 / 1024)) }' )
FS_DUMP_SIZE=$( bdf $SAVECRASH_DIR |grep -v used | awk '{ print $4 }' )
FS_DUMP_SIZE=$( echo $FS_DUMP_SIZE |awk '{ printf ("%d\n", ($1 / 1024)) }' )
LV_DUMP_SIZE="0"

for SIZE in $( /sbin/crashconf -v |grep "dev" | awk '{ print $3 }' )
do
	LV_DUMP_SIZE=$(expr $SIZE + $LV_DUMP_SIZE)
done

LV_DUMP_SIZE=$( echo $LV_DUMP_SIZE |awk '{ printf ("%d\n", ($1 / 1024)) }')

printf "\n                     Data in Mb\n"
Print_data ""

MEM_DUMP_SIZE=$(echo $MEM_DUMP_SIZE |awk '{ printf ("%d\n", ($1 * 105 / 100)) }')
Print_data "+5%"

MEM_DUMP_SIZE=$(echo $MEM_DUMP_SIZE |awk '{ printf ("%d\n", ($1 * 1047 / 1000)) }')
Print_data "+10%"

MEM_DUMP_SIZE=$(echo $MEM_DUMP_SIZE |awk '{ printf ("%d\n", ($1 * 1091 / 1000)) }')
Print_data "+20%"

il affiche l’espace dispo pour maintenant et aussi si la mémoire utilisée augmente de +5, +10 et +20%.
on peut donc prévoir un rajout d’espace disque.

exemple de sortie du script:
Continue reading »

Juin 202011
 

script permettant un affichage amélioré de : bdf

bdf affiche généralement sur 2 ligne une info concernant un point de montage si celui-ci dépasse 80 caractère, ce qui est souvent le cas.

ce script affiche chaque enregistrement sur une seule ligne, avec en sus, des infos comme le nombre d’inodes et le type de filesystème.

la version perl de ce script fonctionne très bien.
cependant, perl n’est pas présent sur tout les serveurs.

voici donc la version ksh.

Download : bdfa.sh


 Publié par à 12 h 47 min  Taggué avec :
Juin 152011
 

j’ai eu un filesystème à 90% ce Week-End.
j’ai eu beau chercher partout avec « find » et « du », rien a faire, je ne trouvais pas ce qui clochait.

la seule explication que j’ai pu trouver était : les fichiers sont sous un point de montage,on ne peut pas les voir.
seulement voila, on ne démonte pas un filesystem sur un serveur en production pour voir s’il y a des fichiers en dessous !
heureusement, il y a toujours une solution xD
Continue reading »

 Publié par à 13 h 03 min  Taggué avec : ,
Juin 152011
 

Testé sur HP-UX

veuillez vérifier le chemin de /bin/printf et /bin/echo

détection de la taille de l’écran.
affichage sans débordement à moins que l’un des choix soit lui même plus grand que le taille de cet écran.

cette fonction prend en argument un liste de valeur et retourne cette liste comme un menu.
ce menu sera adapté à la taille de votre terminal.

si la taille ne peut pas être détectée, l’affichage sera un choix par ligne.
Continue reading »

Juin 152011
 

avec awk sur des multiples de 1024
pour mémoire

petit awk pour calculer les octets en Koctet

$ echo 1023 |awk '{ if($1<1025){print "1";exit}else{x=$1}; x = $1<1025 ? 1025 : $1 ; x /= x>1024 ? 1024 : 0 ; printf("%dn", x += int(x)<x ? 1 : 0) }'
1
$ echo 1024 |awk '{ if($1<1025){print "1";exit}else{x=$1}; x = $1<1025 ? 1025 : $1 ; x /= x>1024 ? 1024 : 0 ; printf("%dn", x += int(x)<x ? 1 : 0) }'
1
$ echo 1025 |awk '{ if($1<1025){print "1";exit}else{x=$1}; x = $1<1025 ? 1025 : $1 ; x /= x>1024 ? 1024 : 0 ; printf("%dn", x += int(x)<x ? 1 : 0) }'
2
$ echo 4095 |awk '{ if($1<1025){print "1";exit}else{x=$1}; x = $1<1025 ? 1025 : $1 ; x /= x>1024 ? 1024 : 0 ; printf("%dn", x += int(x)<x ? 1 : 0) }'
4
$ echo 4096 |awk '{ if($1<1025){print "1";exit}else{x=$1}; x = $1<1025 ? 1025 : $1 ; x /= x>1024 ? 1024 : 0 ; printf("%dn", x += int(x)<x ? 1 : 0) }'
4
$ echo 4097 |awk '{ if($1<1025){print "1";exit}else{x=$1}; x = $1<1025 ? 1025 : $1 ; x /= x>1024 ? 1024 : 0 ; printf("%dn", x += int(x)<x ? 1 : 0) }'
5