From Technical Knowledge to IT Service Management

Posts Tagged ‘restart’

Nagios – demarrage & arret

>>> I. Test et verification

Nagios adopte une configuration modulaire, il n’est pas rare d’oublier le definition d’un contact, oublier une parenthese,….
Pour tester votre configuration actuelle de Nagios executer /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Voici le resultat:

$/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios 2.9
Copyright (c) 1999-2007 Ethan Galstad (http://www.nagios.org)
Last Modified: 04-10-2007
License: GPL

Reading configuration data…

Running pre-flight check on configuration data…

Checking services…
Warning: Service ‘Load’ on host ‘Serveur_01′  has no default contact group(s) defined!
Checked 155 services.
Checking hosts…
Warning: Host ‘Serveur_02′ has no services associated with it!
Checked 94 hosts.
Checking host groups…
Checked 14 host groups.
Checking service groups…
Checked 1 service groups.
Checking contacts…
Checked 3 contacts.
Checking contact groups…
Checked 2 contact groups.
Checking service escalations…
Checked 0 service escalations.
Checking service dependencies…
Checked 0 service dependencies.
Checking host escalations…
Checked 0 host escalations.
Checking host dependencies…
Checked 0 host dependencies.
Checking commands…
Checked 30 commands.
Checking time periods…
Checked 5 time periods.
Checking extended host info definitions…
Checked 0 extended host info definitions.
Checking extended service info definitions…
Checked 0 extended service info definitions.
Checking for circular paths between hosts…
Checking for circular host and service dependencies…
Checking global event handlers…
Checking obsessive compulsive processor commands…
Checking misc settings…

Total Warnings: 2
Total Errors:   0

Things look okay – No serious problems were detected during the pre-flight check

J’ai volontairement laissé de “petites” erreurs dans la configuration, ces dernieres sont sans conséquences pour le bon fonctionnement de Nagios, il s’agit de Warning. Nagios pourra etre lancé.

Si nous avions eu une erreur, par exemple

$/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios 2.9
Copyright (c) 1999-2007 Ethan Galstad (http://www.nagios.org)
Last Modified: 04-10-2007
License: GPL

Reading configuration data…

Error: Could not find any host matching ‘Serveur_99′
Error: Could not expand hostgroups and/or hosts specified in service (config file ‘/usr/local/nagios/etc/services.cfg’, starting on line 12)

***> One or more problems was encountered while processing the config files…

Check your configuration file(s) to ensure that they contain valid
directives and data defintions.  If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version.  Make sure to read
the HTML documentation regarding the config files, as well as the
‘Whats New’ section to find out what has changed.

J’ai volontairement defini un service avec un serveur qui n’etait pas defini, ce qui explique l’erreur ci dessus.
Il faut donc corriger toutes les erreurs, nous pourrons ensuite demarrer nagios

>>> II. Lancement

# Lacement classique (foreground process)
$ /usr/local/nagios/bin/nagios /usr/local/nagios/etc/nagios.cfg
> pour l’arret un CTRL+C suffit

To stop Nagios at any time, just press CTRL-C. If you’ve enabled the debugging options you’ll probably want to redirect the output to a file for easier review later.

# Lancement silencieux (Background Process)
$ /usr/local/nagios/bin/nagios /usr/local/nagios/etc/nagios.cfg &

# Lancement en tant que Daemon
$ /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg

Ces differentes methodes sont utiles sur des plateformes de test ou sur un pc pour tester le produit, en fonctionnement de production, il faudra adapter le choix suivant.

# Start Nagios
$ /etc/rc.d/init.d/nagios start

# Stop Nagios (tue le process lancé par nagios start)
$ /etc/rc.d/init.d/nagios stop

# Restart Nagios (=nagios stop puis nagios start)
$ /etc/rc.d/init.d/nagios restart

# Reload Configuration Data (envois un SIGHUP au process Nagios, forcant une prise en compte immédiate des nouveaux fichiers de configuration, l’avantage est de ne pas couper le process, par exemple an cas d’ajout d’un serveur ou d’un service)
$ /etc/rc.d/init.d/nagios reload

Startup and Shutdown Options

When everything is ok, you should do like that:

startup
STARTUP OPEN PFILE=%ORACLE_BASE%\admin\nuxoradb\pfile\init.ora

shutdown
CONNECT system/manager@nuxoradb AS SYSDBA
SHUTDOWN NORMAL

The OPEN option starts the instance, reads the control file, attaches the database, and then opens it.
The OPEN option is the default option, it is not mandatory to write it.

The NORMAL option will wait for users to log out and then it will close the database and shutdown the instance.

Oracle logs, such as alert log file are very useful and give a good status about the databse and can explain many things, and help you to choose between different options.

Depending your needs, the situation you are facing, many options are available to start a database:

startup MOUNT
CONNECT system/manager@nuxoradb AS SYSDBA
STARTUP MOUNT PFILE=%ORACLE_BASE%\admin\nuxoradb\pfile\init.ora

The MOUNT option, starts the instance, reads the control file, and attaches the database, but does not open it.

To open and use the database:

ALTER DATABASE OPEN;

You have to do that because MOUNT option does’nt open your database

startup NOMOUNT
CONNECT system/manager@nuxoradb AS SYSDBA
STARTUP NOMOUNT PFILE=%ORACLE_BASE%\admin\nuxoradb\pfile\init.ora


The NOMOUNT option starts the instance without mounting the database. It means that only the memory structure and background processes are set up.

To open and use the database, you’ll have then to MOUNT it and OPEN it:

ALTER DATABASE MOUNT;
ALTER DATABASE OPEN;

startup READONLY
CONNECT system/manager@nuxoradb AS SYSDBA
STARTUP OPEN READ ONLY PFILE=%ORACLE_BASE%\admin\nuxoradb\pfile\init.ora

In the READ ONLY mode, You can only read, and no modification is possible, insert, update, or delete, create, later or drop are impossible to use.

And off course many options to shutdown oracle:

shutdown IMMEDIATE

CONNECT system/manager@nuxoradb AS SYSDBA
SHUTDOWN IMMEDIATE

The IMMEDIATE option won’t wait a user’s logoff either uncommitted rollback, it will shutdown the instance and close the database immediatly.

shutdown TRANSACTIONAL
SHUTDOWN TRANSACTIONAL
CONNECT system/manager@nuxoradb AS SYSDBA

The TRANSACTIONAL option tells oracle not to wait for a user to log off, but wait for the client to end the transaction that is in progress, then shut down the instance and close the database.

shutdown ABORT
CONNECT system/manager@nuxoradb AS sysdba
SHUTDOWN ABORT

The ABORT option shutdown the instance (no roll back, user sessions are killed).

And then you have a special option, in case of emergency:

shutdown ans startup FORCE
CONNECT system/manager@nuxoradb AS sysdba
STARTUP FORCE PFILE=%ORACLE_BASE%\admin\nuxoradb\pfile\init.ora