- le nombre de type de sessions ouvertes;
- le nombre de sessions ouvertes et d'utilisateurs connectés.
Nombre de type de sessions ouvertes
#!/bin/sh#
-*- sh -*-
: << =cut
=head1 NAME
Sage X3 - Type sessions
=head1 Configuration
Configuration parameters for /etc/munin/plugin-conf.d/sagex3_typesession
[sagex3_typesession]
user root
env.sessions_types 1 2 3 4 5
env.type1_name Windows
env.type2_name Seconds
env.type3_name Batch
env.type4_name Various
env.type5_name Terminal
=head1 NOTES
Type of sessions open
=head1 AUTHOR
Philippe MALADJIAN <http://blogoflip.fr>
=head1 LICENSE
GPL
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title Number of type session open'
echo 'graph_scale yes'
echo 'graph_args --base 1000 --lower-limit 0'
echo 'graph_category sage'
echo 'graph_vlabel Type sessions'
echo 'type1.label '$type1_name
echo 'type1.draw LINE1'
echo 'type1.type GAUGE'
echo 'type2.label '$type2_name
echo 'type2.draw LINE2'
echo 'type2.type GAUGE'
echo 'type3.label '$type3_name
echo 'type3.draw LINE3'
echo 'type3.type GAUGE'
echo 'type4.label '$type4_name
echo 'type4.draw LINE4'
echo 'type4.type GAUGE'
echo 'type5.label '$type5_name
echo 'type5.draw LINE5'
echo 'type5.type GAUGE'
exit 0
fi
type1=0
type2=0
type3=3
type4=0
type5=0
TYPES=$sessions_types
for type in $TYPES
do
CMD=`su - x3 -c "psadx -t | sed '1,2d' | sed '$d' | sed -r 's/^ *//;s/ {2,}/;/g' | cut -d ';' -f3 | grep $type"`
for line in $CMD
do
case $line in
1) type1=`expr $type1 + 1` ;;
2) type2=`expr $type2 + 1` ;;
3) type3=`expr $type3 + 1` ;;
4) type4=`expr $type4 + 1` ;;
5) type5=`expr $type5 + 1` ;;
*) ;;
esac
done
done
echo "type1.value "$type1
echo "type2.value "$type2
echo "type3.value "$type3
echo "type4.value "$type4
echo "type5.value "$type5
Après quelques heures voila le résultat
Le nombre de sessions ouvertes et d'utilisateurs connectés
#!/bin/shAprès quelques heures voila le résultat
# -*- sh -*-
: << =cut
=head1 NAME
Sage X3 - Open sessions
=head1 NOTES
Number of open sessions on Sage X3
=head1 AUTHOR
Philippe MALADJIAN <http://blogoflip.fr>
=head1 LICENSE
GPL
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title Number of open sessions/users on Sage X3'
echo 'graph_scale yes'
echo 'graph_args --base 1000 --lower-limit 0'
echo 'graph_vlabel number sessions / number users'
echo 'graph_category sage'
echo 'sagex3_nbsession.label Number sessions' echo 'sagex3_nbsession.draw AREA'
echo 'sagex3_nbuser.label Number users'
echo 'sagex3_nbuser.draw LINE1'
exit 0
fi
echo "sagex3_nbsession.value " `su - x3 -c 'psadx -g | wc -l'`
NUSER=`su - x3 -c "psadx -g | sed '1,2d' | sed '$d' | sed -r 's/^ *//;s/ {2,}/;/g' | cut -d ';' -f3 | sort -u | wc -l"`
echo "sagex3_nbuser.value " $NUSER