ONYX - 9.0 - Usage
ONYX Server Supervision Guide under Linux
Sommaire
- 1 Introduction
- 2 General operations
- 3 Log files
- 4 Processes
- 5 Opérations de maintenance
Introduction
This article provides you with examples of operations on ONYX Server under Linux. This needs to be adapted according to your internal processes.
This only regards ONYX Server. The administration of Apache web server (stop / restart) is not described in this article.
General operations
Selecting the Mapping instance
Several different ONYX Server instances can be installed on the same Unix/Linux server. This way, specifying the Mapping environment is required before entering any command. This is done by changing the MAPPING_PATH environment variable.
In interactive mode: with the "mappingenv" command
-bash-4.2$ mappingenv Which environment must be changed: 1 : Mapping_PROD /apps/mapping/conf/mapping.conf 8002 Enter the name or number of the environment:1 bash-4.2$
The list of environments is is based on the /etc/mappingtab file
The mappingenv command is located in " /bin " by default
In a script: The MAPPING_PATH environment variable must be exported with the complete path of the mapping.conf file which corresponds to the desired Mapping environment.
export MAPPING_PATH=/apps/mapping/conf/mapping.conf
Log files
General information on log files
Most Mapping log files are not in text format, they thus cannot be edited as is. There are two methods used to see them:
- Via the Mapping Web interface
- Using the /apps/mapping/bin/map_log_txt command
For more information on this command:
/apps/mapping/bin/map_log_txt --help
Display example of the content of the log file of the map_lpd:
/apps/mapping/bin/map_log_txt -log_file:/apps/mapping/spool/logs/map_lpd.log
Common log files
Most log files are located in the /apps/mapping/spool/logs folder.
Log file examples:
<name of the queue>.log | Logs linked to queues (printer or entry points) |
map_daemon.log | General log of the spooler |
map_lpd.log | Log of the LPD server |
map_lpr.log | Log of the LPR Mapping client if called in a command line |
To access it via the interface: "Main menu" / "View log"
Log files linked to standard outputs and errors
/apps/mapping/temp/stdout.txt /apps/mapping/temp/stderr.txt
These are text files which can be edited as is without needing to be converted.
Log files of the jobs in the spooler
Each job as its own log file. These files are located in the /apps/mapping/spool/global file. Their name starts with the letter L followed by the number of the job (MAP_JOBNUM).
Processes
Description of the main Mapping processes
The following processes are frequently seen when displaying the list of current processes. This is often done using the following command:
ps -eaf | grep map
map_daemon | Processes of the spooler which allow jobs to be managed in the queues. |
map_lpd | Recovery process of the jobs sent via LPR. This is a derivative of the map_daemon process. |
map_splf | Process which notably allows you to add a job in a queue. This is a derivative of the map_lpd process, it communicates with the map_daemon process via the port defined by the PORT_SOCKET_DAEMON parameter in the mapping.conf file. It can also be directly triggered in command line to manage queues or jobs. |
map_exec | Process which handles jobs in queues to apply processes to them (workflow, script execution, delivery to a printer…). This is a derivative of the map_daemon process. There is one map_exec per queue being processed. |
map_lpr | Process which sends a printing stream to a printer using the LPR protocol. This is a derivative of the map_exec process. It can also be directly triggered in command line. |
map_809 | Execution Process of a Workflow. This is a derivative of the map_exec process. |
mapcpysplf | Process which calls for the mapping of a document. It can be triggered in command line, in a script, in the workflow (map_809)… |
map_815UCS | Mapping processus of a document (called by the mapcpysplf command). |
map_mail | Process which sends an e-mail with an attachment. |
map_scanfolder | Process linked to a robot which allows you to monitor files in a folder so as to launch a workflow processing on each of them. |
Other processes with the prefix " map_ " can also be seen, notably if they are called via scripts or in the workflow.
Starting and stopping Mapping processes
Starting the spooler
The following command launches the map_daemon process as well as its derivative map_lpd
export MAPPING_PATH=/apps/mapping/conf/mapping.conf /apps/mapping/bin/map_daemon start
When starting the map_daemon process, a flag file which contains the process identifier of map_daemon process is created in the spooled file folder. The process cannot start because of it. It needs to be deleted.
/apps/mapping/spool/map_daemon.ID
Stopping the spooler
The following command stops the map_daemon process as well as its derivative map_lpd
export MAPPING_PATH=/apps/mapping/conf/mapping.conf /apps/mapping/bin/map_daemon stop
Caution: if "scanfolder" robots processing consists in sending a file to a queue of the spooler, stopping the map_daemon process will result in errors each time a file is processed. It is therefore essential to stop the "scanfolder" robots before stopping the map_daemon process.
Starting the "scanfolder" robots
The following command starts a "scanfolder" robot
export MAPPING_PATH=/apps/mapping/conf/mapping.conf /apps/mapping/bin/map_scanfolder -name:nom_du_robot
Example of a script to start all the robots:
export MAPPING_PATH=/apps/mapping/conf/mapping.conf LISTROBOT=`/apps/mapping/bin/map_scanfolder -listRobot | awk ' { print $2 } '` for ROBOT in $LISTROBOT do /apps/mapping/bin/map_scanfolder -name:${ROBOT} done
When starting the map_scanfolder process, a flag file contenant le process identifier of the map_scanfolder process is created in temp folder. The process cannot start because of it. It needs to be deleted.
/apps/mapping/temp/_apps_mapping_temp_nom_du_robot_map_scanfolder.ID
Attention : la suppression de ce fichier .ID doit être effectuée en connaissance de cause, c’est à dire uniquement si le robot n’est pas en cours d’exécution. En effet, en cas de suppression de ce fichier, il est alors possible de lancer une autre instance du même robot, ce qui provoque des conflits d’accès simultanés aux mêmes fichiers.
Arrêt des robots « scanfolder »
La commande suivante arrête un robot « scanfolder »
export MAPPING_PATH=/apps/mapping/conf/mapping.conf /apps/mapping/bin/map_scanfolder -stop -name:nom_du_robot
Exemple de script pour arrêter tous les robots :
export MAPPING_PATH=/apps/mapping/conf/mapping.conf LISTROBOT=`/apps/mapping/bin/map_scanfolder -listRobot | awk ' { print $2 } '` for ROBOT in $LISTROBOT do /apps/mapping/bin/map_scanfolder -stop -name:${ROBOT} done
Les processus à monitorer
map_daemon et map_lpd
Ces 2 processus sont des services et doivent être constamment en cours d’exécution. Comme ils sont forkés régulièrement, il peut éventuellement y en avoir plusieurs à instant donné.
-bash-4.1$ ps -eaf | grep map_ mapadmin 29551 1 1 Oct25 ? 04:00:29 /apps/mapping/bin/map_daemon start mapadmin 27424 29551 0 Oct30 ? 00:00:00 /apps/mapping/bin/map_lpd -port:515 -nbfork:100
map_scanfolder
Il y a autant de processus map_scanfolder que de robot en cours d’exécution. Ils sont identifiés grâce à leur option « -name ». Ils sont indépendants les uns des autres, mais également indépendants du map_daemon.
mapadmin 8271 1 0 17:02 ? 00:00:00 /apps/mapping/bin/map_scanfolder -name:test
httpd
Le bon fonctionnement d’Apache peut être contrôlé par la présence du processus httpd. Ce processus est souvent forké, d’où la présence de plusieurs lignes dans la liste des processus.
-bash-4.2$ ps -eaf | grep httpd apache 4590 11849 0 10:56 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 4874 11849 0 08:23 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 4876 11849 0 08:23 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 4890 11849 0 08:23 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND root 11849 1 0 oct.15 ? 00:01:42 /usr/sbin/httpd -DFOREGROUND apache 15641 11849 0 08:54 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 16301 11849 0 08:56 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
Actions en cas de crash d’un processus Mapping
Crash du map_daemon
1- Tenter un arrêt propre du spooler Mapping :
export MAPPING_PATH=/apps/mapping/conf/mapping.conf /apps/mapping/bin/map_daemon stop
2- Arrêter proprement les processus scanfolder actifs (cf. démarrage et arrêt des processus Mapping)
3- Killer (kill -9) les autres processus mapping encore actifs :
- map_daemon
- map_lpd
- map_exec
- map_lpr
- map_809
A noter que tous ces processus peuvent devenir fils du processus système (PID=1) en cas de crash de leur processus « père », point commun : leur propriétaire est "mapadmin".
Exemple (à adapter selon le système et la configuration) :
ps -f -U mapadmin | grep -v bash | grep -v "ps \-f" | grep -v "UID" | while read LINE do PID=`echo $LINE | awk ' { print $2 } '` kill -9 $PID done
4- Supprimer le fichier flag /apps/mapping/spool/map_daemon.ID
5- Démarrer le spooler Mapping
/apps/mapping/bin/map_daemon start
Crash du map_lpd
Si le processus map_daemon est toujours actif, il est possible de redémarrer le map_lpd à l’aide de la commande suivante :
export MAPPING_PATH=/apps/mapping/conf/mapping.conf /apps/mapping/bin/map_control -start_lpd
Crash d’un robot « scanfolder »
Lors du démarrage d'un robot, un fichier avec le nom du robot et l'extension ".ID" est créé, ainsi qu'un fichier avec le numéro de process et l'extension .pid Exemple :
_apps_mapping_temp_nom_du_robot_map_scanfolder.ID 4656.pid
En cas de crash du robot, ces fichiers ne sont pas supprimés et empêche le redémarrage du robot. Par conséquent, pour permettre le redémarrage du robot, le fichier « .ID » correspondant au robot arrêté doit être supprimé du répertoire « /apps/mapping/temp »
Opérations de maintenance
Nettoyage courant
Les commandes suivantes peuvent être planifiées très régulièrement. Dans l’idéal, au moins une fois par jour.
Suppression des travaux terminés et arrivé à échéance
export MAPPING_PATH=/apps/mapping/conf/mapping.conf /apps/mapping/bin/map_cron -date
Suppression des travaux non effectués (quel que soit leur statut), après 30 jours
export MAPPING_PATH=/apps/mapping/conf/mapping.conf /apps/mapping/bin/map_cron -cleanspool -relative_date:30/0/0. # jour/mois/années
Suppression des fichiers de session web obsolètes
Fichiers context_menu.*, historique.*, et *.id du dossier /apps/mapping/temp
export MAPPING_PATH=/apps/mapping/conf/mapping.conf /apps/mapping/bin/map_cron -cleanid
Suppression des fichiers temporaires de conversion XPS et de Workflow
Ces fichiers se trouvent dans le dossier temporaire /apps/mapping/temp. Normalement, ils sont supprimés automatiquement. Mais en cas de problème (crash, interruption forcée…), ils peuvent subsister dans le dossier temp. Ce n’est donc pas une situation normale.
find /apps/mapping/temp -name "*cri.tmp" -mtime +2 -exec rm -f {} \; find /apps/mapping/temp -name "*ttf.tmp" -mtime +2 -exec rm -f {} \; find /apps/mapping/temp -name "compress_*" -mtime +2 -exec rm -f {} \; find /apps/mapping/temp -name "*.[0-9]" -mtime +2 -exec rm -f {} \; find /apps/mapping/temp -name "*.[0-9][0-9]" -mtime +2 -exec rm -f {} \;
Opérations de nettoyage et de rotations des logs
Pour des raisons pratiques, les commandes suivantes ne doivent pas être planifiées plus d’une fois par jour. Cela afin de ne pas multiplier les archives créées, et éviter de perdre des derniers jours de logs. La fréquence idéale est de 2 fois par semaine, par exemple le lundi soir et le jeudi soir, avant le déclenchement des batchs de nuit.
Archivage des logs
Cette commande permet de faire une conversion texte de tous les fichiers de logs, puis de les archiver dans un fichier zip horodaté.
export MAPPING_PATH=/apps/mapping/conf/mapping.conf /apps/mapping/bin/map_cron -cleanlog -folder:/apps/mapping/spool/logs -format:TXT
Résultat :
bash-4.2$ ls -lrt /apps/mapping/spool/logs/*.zip -rw-r--r-- 1 mapadmin staff 254186924 30 oct. /apps/mapping/spool/logs/2018_10_30_19_51.zip -rw-r--r-- 1 mapadmin staff 58479965 7 nov. /apps/mapping/spool/logs/2018_11_07_12_32.zip
Rotation des logs des sorties standard et erreur
mv /apps/mapping/temp/stderr.txt /apps/mapping/temp/stderr.txt.bak mv /apps/mapping/temp/stdout.txt /apps/mapping/temp/stdout.txt.bak
Suppression des archives de logs de plus de 30 jours
find /apps/mapping/spool/logs -name "*.zip" -mtime +30 -exec rm -f {} \;
Archivage des logs
Cette commande permet de faire une conversion texte de tous les fichiers de logs, puis de les archiver dans un fichier zip horodaté. export MAPPING_PATH=/apps/mapping/conf/mapping.conf
/apps/mapping/bin/map_cron -cleanlog -folder:/apps/mapping/spool/logs -format:TXT
Résultat :
bash-4.2$ ls -lrt /apps/mapping/spool/logs/*.zip -rw-r--r-- 1 mapadmin staff 254186924 30 oct. /apps/mapping/spool/logs/2018_10_30_19_51.zip -rw-r--r-- 1 mapadmin staff 58479965 7 nov. /apps/mapping/spool/logs/2018_11_07_12_32.zip
Rotation des logs des sorties standard et erreur
mv /apps/mapping/temp/stderr.txt /apps/mapping/temp/stderr.txt.bak mv /apps/mapping/temp/stdout.txt /apps/mapping/temp/stdout.txt.bak
Suppression des archives de logs de plus de 30 jours
find /apps/mapping/spool/logs -name "*.zip" -mtime +30 -exec rm -f {} \;