1.2 Automating Daemon Mode Operations

Oracle recommends that you use the daemon process to schedule recurring health checks at regular intervals.

Configure the daemon to:

  • Schedule recurring health checks at regular interval

  • Send email notifications when the health check runs complete, clearly showing any differences since the last run

  • Purge collection results after a pre-determined period

  • Check and send email notification about stale passwords

  • Store multiple profiles for automated health check runs

  • Restart automatically if the server or node where it is running restarts

Note:

While running, the daemon answers all of the prompts required by subsequent on-demand health checks.

To run on-demand health checks, do not use the daemon process started by any other user. Run on-demand health checks within the same directory where you have started the daemon.

If you change the system configuration such as adding or removing servers or nodes, then restart the daemon.

1.2.1 Setting and Getting Options for the Daemon

Set the daemon options before you start the daemon. Reset those options anytime after starting the daemon.

Set the daemon options using the –set option.

Set an option as follows:
$ ./orachk –set "option_1=option_1_value"
$ ./exachk –set "option_1=option_1_value"
Set multiple options using the name=value format separated by semicolons as follows:
$ ./orachk –set "option_1=option_1_value;option_2=option_2_value;option_n=option_n_value"
$ ./exachk –set "option_1=option_1_value;option_2=option_2_value;option_n=option_n_value"

1.2.1.1 AUTORUN_SCHEDULE

Schedule recurring health checks using the AUTORUN_SCHEDULE daemon option.

Set the AUTORUN_SCHEDULE option, as follows:
AUTORUN_SCHEDULE=hour day month day_of_week
where:
  • hour is 0 – 23

  • day is 1 - 31

  • month is 1 - 12

  • day_of_week is 0 - 6, where 0=Sunday and 6=Saturday

Use the asterisk (*) as a wildcard to specify multiple values separated by commas.


Table 1-1 AUTORUN_SCHEDULE

Example Result

"AUTORUN_SCHEDULE=* * * *"

Runs every hour.

"AUTORUN_SCHEDULE=3 * * 0"

Runs at 3 AM every Sunday.

"AUTORUN_SCHEDULE=2 * * 1,3,5"

Runs at 2 AM on Monday, Wednesday, and Friday.

"AUTORUN_SCHEDULE=4 1 * *"

Runs at 4 AM on the first day of every month.

"AUTORUN_SCHEDULE=8,20 * * 1,2,3,4,5"

Runs at 8 AM and 8 PM every Monday, Tuesday, Wednesday, Thursday, and Friday.


$ ./orachk –set "AUTORUN_SCHEDULE=3 * * 0"
$ ./exachk –set "AUTORUN_SCHEDULE=3 * * 0"

1.2.1.2 AUTORUN_FLAGS

The AUTORUN_FLAGS daemon option determines how health checks are run.

Set the AUTORUN_FLAGS option as follows: AUTORUN_FLAGS=flags, where flags can be any combination of valid command-line flags.


Table 1-2 AUTORUN_FLAGS

Example Result

"AUTORUN_FLAGS=-profile dba"

Runs only the dba profile checks.

"AUTORUN_FLAGS=-profile sysadmin –tag syadmin"

Runs only the dba profile checks and tags the output with the value sysadmin.

-excludeprofile ebs

Runs all checks except those in the ebs profile.


$ ./orachk –set "AUTORUN_FLAGS=-profile sysadmin –tag sysadmin"
$ ./exachk –set "AUTORUN_FLAGS=-profile sysadmin –tag sysadmin"

1.2.1.3 NOTIFICATION_EMAIL

Set the NOTIFICATION_EMAIL daemon option to send email notifications to the recipients you specify. The daemon notifies the recipients each time a health check run completes or when the daemon experiences a problem.

Specify a comma-delimited list of email addresses, as follows:
$ ./orachk –set "NOTIFICATION_EMAIL=some.person@acompany.com,another.person@acompany.com"
$ ./exachk –set "NOTIFICATION_EMAIL=some.person@acompany.com,another.person@acompany.com"
Test the email notification configuration using the –testemail option, as follows:
$ ./orachk -testemail all
$ ./exachk -testemail all
After the first health check run, the daemon notifies the recipients with report output attached.

Figure 1-10 First Email Notification

Description of Figure 1-10 follows
Description of "Figure 1-10 First Email Notification"

For the subsequent health check runs after the first email notification, the daemon emails the diff report of the current run and the immediate past run to all users specified in the NOTIFICATION_EMAIL list.

The email notification message contains:

  • System Health Score of this run compared to previous

  • Summary of number of checks run and differences between runs

  • Most recent report result as attachment

  • Previous report result as attachment

  • Diff report as attachment

Figure 1-11 Subsequent Email Notification

Description of Figure 1-11 follows
Description of "Figure 1-11 Subsequent Email Notification"

Related Topics

1.2.1.4 collection_retention

Set the collection_retention daemon option to purge health check collection results that are older than a specified number of days.

Set the collection_retention option, as follows: collection_retention=number_of_days.

The daemon does not purge the stale collection if you do not set this option.

Set the collection_retention option to an appropriate number of days based on the frequency of your scheduled collections, size of the collection results, and the available disk space.

Note:

Specify the collection_retention option lower case.

Example 1-1 collection_retention

$ ./orachk –set "collection_retention=60"
$ ./exachk –set "collection_retention=60"

1.2.1.5 PASSWORD_CHECK_INTERVAL

The PASSWORD_CHECK_INTERVAL daemon option defines the frequency, in hours, for the daemon to validate the passwords entered when the daemon was started the first time. If an invalid password is found due to a password change, then the daemon stops, makes an entry in the daemon log, and then sends an email notification message to recipients specified in the NOTIFICATION_EMAIL option.

Set the PASSWORD_CHECK_INTERVAL option, as follows: PASSWORD_CHECK_INTERVAL=number_of_hours.

If you do not set the PASSWORD_CHECK_INTERVAL option, then the daemon can not actively check password validity and fails the next time it tries to run after a password change. Using the PASSWORD_CHECK_INTERVAL option enables you to take corrective action and restart the daemon with the correct password rather than having failed collections.

Set the PASSWORD_CHECK_INTERVAL option to an appropriate number of hours based on the frequency of your scheduled collections and password change policies.

Example 1-2 PASSWORD_CHECK_INTERVAL

$ ./orachk –set "PASSWORD_CHECK_INTERVAL=1"
$ ./exachk –set "PASSWORD_CHECK_INTERVAL=1"

Related Topics

1.2.1.6 AUTORUN_INTERVAL

The AUTORUN_INTERVAL daemon option provides an alternative method of regularly running health checks.

Note:

The functionality of the AUTORUN_INTERVAL option has been superseded by the AUTORUN_SCHEDULE option and is only retained for backwards compatibility. Oracle recommends that you use the AUTORUN_SCHEDULE option.

Set the AUTORUN_INTERVAL option, as follows: AUTORUN_INTERVAL=n [d | h], where:

  • n is a number

  • d is days

  • h is hours


Table 1-3 AUTORUN_INTERVAL

Example Result

"AUTORUN_INTERVAL=1h"

Runs every hour.

"AUTORUN_INTERVAL=12h"

Runs every 12 hours.

"AUTORUN_INTERVAL=1d"

Runs every day.

"AUTORUN_INTERVAL=7d"

Runs every week.


1.2.1.7 Setting Multiple Option Profiles for the Daemon

Use only one daemon process for each server. Do not start a single daemon on multiple databases in a cluster, or multiple daemons on the same database. The daemon does not start if it detects another Oracle ORAchk or Oracle EXAchk daemon process running locally.

You can define multiple different run profiles using the same daemon. This enables you to run multiple different health checks with different daemon options, such as different schedules, email notifications, and auto run flags. The daemon manages all profiles.

Define daemon option profiles using the –id id option before the –set option, where id is the name of the profile.
$ ./orachk –id id –set "option=value"
$ ./exachk –id id –set "option=value"

Example 1-3 Setting Multiple Option Profiles for the Daemon

For example, if database administrator wants to run checks within the dba profile and the system administrator wants to run checks in the sysadmin profile, then configure the daemon using the profiles option.

Define the database administrator profile as follows:
$ ./orachk –id dba –set "NOTIFICATION_EMAIL=dba@example.com;\
   AUTORUN_SCHEDULE=4,8,12,16,20 * * *;AUTORUN_FLAGS=-profile dba –tag dba;\
   collection_retention=30"

Created notification_email for ID[dba]
Created autorun_schedule for ID[dba]
Created autorun_flags for ID[dba]
Created collection_retention for ID[dba]
$ ./exachk –id dba –set "NOTIFICATION_EMAIL=dba@example.com;\
   AUTORUN_SCHEDULE=4,8,12,16,20 * * *; AUTORUN_FLAGS=-profile dba –tag dba;\
   collection_retention=30"

Created notification_email for ID[dba]
Created autorun_schedule for ID[dba]
Created autorun_flags for ID[dba]
Created collection_retention for ID[dba]
Define the system administrator profile as follows:
$ ./orachk –id sysadmin –set "NOTIFICATION_EMAIL=sysadmin@example.com;\
   AUTORUN_SCHEDULE=3 * * 1,3,5; AUTORUN_FLAGS=-profile sysadmin –tag sysadmin;\
   collection_retention=60"

Created notification_email for ID[sysadmin]
Created autorun_schedule for ID[sysadmin]
Created autorun_flags for ID[sysadmin]
Created collection_retention for ID[sysadmin]
$ ./exachk –id sysadmin –set "NOTIFICATION_EMAIL=sysadmin@example.com;\
   AUTORUN_SCHEDULE=3 * * 1,3,5; AUTORUN_FLAGS=-profile sysadmin –tag sysadmin;\
   collection_retention=60"

Created notification_email for ID[sysadmin]
Created autorun_schedule for ID[sysadmin]
Created autorun_flags for ID[sysadmin]
Created collection_retention for ID[sysadmin]

1.2.1.8 Getting the Existing Options for the Daemon

Query the values that you set for the daemon options.

To query the values, use [-id ID ] -get option | all, where

  • ID is a daemon option profile

  • option is a specific daemon option you want to retrieve

  • all returns values of all options

To get a specific daemon option, use –get option.

Example 1-4 Getting Existing Options for the Daemon

$ ./orachk –get NOTIFICATION_EMAIL

ID: orachk.default
------------------------------------------
notification_email = some.body@example.com
$ ./exachk –get NOTIFICATION_EMAIL

ID: exachk.default
------------------------------------------
notification_email = some.body@example.com
To query multiple daemon option profiles, use the –get option: .
$ ./orachk –get NOTIFICATION_EMAIL

ID: orachk.default
------------------------------------------
notification_email = some.body@example.com

ID: dba
------------------------------------------
notification_email = dba@example.com


ID: sysadmin
------------------------------------------
notification_email = sysadmin@example.com
$ ./exachk –get NOTIFICATION_EMAIL

ID: exachk.default
------------------------------------------
notification_email = some.person@example.com

ID: dba
------------------------------------------
notification_email = dba@example.com


ID: sysadmin
------------------------------------------
notification_email = sysadmin@example.com

To limit the request to a specific daemon option profile, use the –id ID -get option.

To get the NOTIFICATION_EMAIL for a daemon profile called dba:
$ ./orachk –id dba –get NOTIFICATION_EMAIL

ID: dba
------------------------------------------
notification_email = dba@example.com
$ ./exachk –id dba –get NOTIFICATION_EMAIL

ID: dba
------------------------------------------
notification_email = dba@example.com

To get all options set use –get all

$ ./orachk –get all

ID: orachk.default
------------------------------------------
notification_email = some.body@example.com
autorun_schedule = 3 * * 0
collection_retention = 30
password_check_interval = 1
$ ./exachk –get all

ID: exachk.default
------------------------------------------
notification_email = some.body@example.com
autorun_schedule = 3 * * 0
collection_retention = 30
password_check_interval = 1
To query all daemon option profiles, use the –get all  option.
$ ./orachk –get all

ID: orachk.default
------------------------------------------
notification_email = some.body@example.com
autorun_schedule = 3 * * 0
collection_retention = 30
password_check_interval = 12

ID: dba
------------------------------------------
notification_email = dba@example.com
autorun_schedule = 4,8,12,16,20 * * *
autorun_flags = -profile dba – tag dba
collection_retention = 30
password_check_interval = 1

ID: sysadmin
------------------------------------------
notification_email = sysadmin@example.com
autorun_schedule = 3 * * 1,3,5
autorun_flags = -profile sysadmin –tag sysadmin
collection_retension = 60
password_check_interval = 1
$ ./exachk –get all

ID: exachk.default
------------------------------------------
notification_email = some.body@example.com
autorun_schedule = 3 * * 0
collection_retention = 30
password_check_interval = 1

ID: dba
------------------------------------------
notification_email = dba@example.com
autorun_schedule = 4,8,12,16,20 * * *
autorun_flags = -profile dba – tag dba
collection_retention = 30
password_check_interval = 1

ID: sysadmin
------------------------------------------
notification_email = sysadmin@example.com
autorun_schedule = 3 * * 1,3,5
autorun_flags = -profile sysadmin –tag sysadmin
collection_retension = 60
password_check_interval = 1

To limit the request to a specific daemon option profile use, –id ID -get all  option.

To get all the options set for a daemon profile called dba:
$ ./orachk –id dba –get all

ID: dba
------------------------------------------
notification_email = dba@example.com
autorun_schedule = 4,8,12,16,20 * * *
autorun_flags = -profile dba – tag dba
collection_retention = 30
password_check_interval = 1
$ ./exachk –id dba –get all

ID: dba
------------------------------------------
notification_email = dba@example.com
autorun_schedule = 4,8,12,16,20 * * *
autorun_flags = -profile dba – tag dba
collection_retention = 30
password_check_interval = 1

1.2.2 Starting and Stopping the Daemon

Use these commands to start and stop the daemon, and to force the daemon to stop a health check run.

  1. To start the daemon, use the –d start option as follows:
    $ ./orachk –d start
    
    $ ./exachk –d start
    

    The tool prompts you to provide required information during startup.

    $ ./exachk -d start
    
    Checking ssh user equivalency settings on all nodes in cluster
    
    Node randomadm08 is configured for ssh user equivalency for root user
    
    Searching for running databases . . . . .
    
    . . 
    List of running databases registered in OCR
    1. dbm
    2. None of above
    
    Select databases from list for checking best practices. 
    For multiple databases, select 1 for All or comma separated number like 1,2 etc [1-2] [1].
    . . . .
    
    .
    Checking Status of Oracle Software Stack - Clusterware, ASM, RDBMS
    
    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
    ---------------------------------------------------------------------------------------
                                                    Oracle Stack Status
    ---------------------------------------------------------------------------------------                                         
    Host Name   CRS Installed    RDBMS Installed    CRS UP  ASM Up  RDBMS UP        Instance Name
    ---------------------------------------------------------------------------------------
    randomadm07     Yes                 Yes             Yes     Yes         Yes       dbm1
    randomadm08     Yes                 Yes             Yes     Yes         Yes             dbm2
    ---------------------------------------------------------------------------------------
    
    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
    
    9 of the included audit checks require root privileged data collection on INFINIBAND SWITCH .
    
    1. Enter 1 if you will enter root password for each INFINIBAND SWITCH when prompted
    
    2. Enter 2 to exit and to arrange for root access and run the exachk later.
    
    3. Enter 3 to skip checking best practices on INFINIBAND SWITCH
    
    Please indicate your selection from one of the above options for INFINIBAND SWITCH[1-3][1]:-
    
    Is root password same on all INFINIBAND SWITCH ?[y/n][y]
    
    Enter root password for INFINIBAND SWITCH :-
    
    Verifying root password.
    
    . . .
    
    exachk daemon is started with PID : 69068
    Daemon log file location is : /opt/oracle.SupportTools/exachk/20160318/exachk/exachk_daemon.log
    
  2. To stop the daemon, use the –d stop option as follows:
    $ ./orachk –d stop
    
    $ ./exachk –d stop
    

    The daemon confirms when it stops.

    $./exachk –d stop
    Stopping exachk daemon..
    
    Stopped.
    

    If a health check run is progress when you run the stop command, then the daemon indicates so and continues running.

  3. To force the daemon to stop a health check run, use the –d stop_client option:
    $ ./orachk –d stop_client
    
    $ ./exachk –d stop_client
    
The daemon stops the health check run and then confirms when it is done. If required, stop the daemon using the –d stop option.

1.2.3 Querying the Status and Next Planned Daemon Run

Query the status and next auto run schedule of the running daemon.

You can query the information about the running daemon using the following options:
-d status|info|nextautorun
  • -d status: checks if the daemon is running.

  • -d info: print information about running daemon.

  • -d nextautorun [-id ID]: prints the next auto run time.

  1. To check if the daemon is running, use –d status:
    $ ./orachk –d status
    
    $ ./exachk –d status
    

    If running, then he daemon confirms and displays the PID.

    $./exachk –d status
    
    exachk daemon is running. Daemon PID : 65550
    
  2. To query more detailed information about the daemon, use –d info:
    $ ./orachk –d info
    
    $ ./exachk –d info
    

    The daemon responds with the following information:

    • install node

    • version

    • install location

    • time when it was started

    $  ./exachk -d info
    
    -----------------------------------------------------------
    exachk daemon information
    -----------------------------------------------------------
    
    install node = randomadm07
    
    exachk daemon version = 12.1.0.2.6_20160317
    
    Install location = /opt/oracle.SupportTools/exachk/20160318/exachk
    
    Started at = Thu Apr  7 08:21:57 PDT 2016
    
  3. To query the next scheduled health check run, use –d nextautorun:
    $ ./orachk –d nextautorun
    
    $ ./exachk –d nextautorun
    

    The daemon responds with details of schedule. If you have configured multiple daemon option profiles, then the output shows whichever is scheduled to run next.

    $ ./exachk –d nextautorun
    
    ID: sysadmin
    
    Next auto run starts on Apr 4, 2016 03:00:00
    
    If you have configured multiple daemon option profiles, then query the next scheduled health check run of a specific profile using –id ID -d nextautorun:
    $ ./orachk –d ID –d nextautorun
    
    $ ./exachk –d ID –d nextautorun
    

    The daemon responds with details of the schedule for the daemon options profile ID you have specified .

    $ ./exachk –id dba –d nextautorun
    
    ID: dba
    
    Next auto run starts on Apr 4, 2016 04:00:00
    

1.2.4 Configuring the Daemon for Auto Restart

By default, you must manually restart the daemon if you restart the server or node on which it is running. However, if you use the auto restart option, the daemon restarts automatically after the server or node reboot.

Daemon auto restart requires passwordless SSH user equivalence to root for the user who is configuring the auto-start feature, for example, root or oracle. If passwordless SSH user equivalence is not in place, then Oracle ORAchk and Oracle EXAchk optionally configure for you.

The passwordless SSH user equivalence is retained as long as the daemon auto restart functionality is configured.

Deconfiguring the daemon auto restart feature will restore the SSH configuration to the state it was found before auto restart start was configured.

  1. To setup daemon auto restart use, –initsetup:
    $ ./orachk –initsetup
    
    $ ./exachk –initsetup
    

    The tool prompts you to provide the required information during startup.

    $ ./exachk -initsetup
    
    Checking ssh user equivalency settings on all nodes in cluster
    
    Node randomadm08 is configured for ssh user equivalency for root user
    
    Checking ssh user equivalency between root and root user on COMPUTE nodes
    
    Node randomadm07 is configured for ssh user equivalency between root and root user
    
    Node randomadm08 is configured for ssh user equivalency between root and root user
    
    Checking ssh user equivalency between root and root user on STORAGE Servers
    
    192.0.0.1 is configured for ssh user equivalency for root user 
    
    192.0.0.4 is configured for ssh user equivalency for root user 
    
    192.0.0.6 is configured for ssh user equivalency for root user 
    
    . . . . . . . . . . . 
    
    Checking ssh user equivalency between root and root user on INFINIBAND SWITCH
    
    s10sw-ib is not configured for ssh user equivalency for root user
    
    Do you want to configured SSH for user root on s10sw-ib [y/n][y]
    
    Is root password same on all IBSWITCHES?[y/n[y]
    Enter root password :-
    
    Verifying root password.
    
    . .
    .
    s10sw-ib has been configured for ssh user equivalency for root user
    
    Verifying root password
    
    . .
    .
    s4sw-ib has been configured for ssh user equivalency for root user
    
    Verifying root password
    
    . .
    .
    sc8 has been configured for ssh user equivalency for root user
    
    Verifying root password
    
    . .
    .
    
    s10sw-ib has been configured for ssh user equivalency for root user
    
    Verifying root password
    . .
    .
    
    s10sw-ib0 has been configured for ssh user equivalency for root user
    
    Setting up exachk auto restart functionality using inittab
    
    Starting exachk daemon. . . . . . . . . . . . . . . . . . . . . . 
    
    exachk daemon started successfully
    

    Note:

    If the daemon is already running, stop it before running –initsetup .
    You can pre-configure root user equivalence for all COMPUTE, STORAGE, or IBSWITCHES using the –initpresetup option (root equivalency for COMPUTE nodes is mandatory for setting up the auto restart functionality):
    $ ./orachk –initpresetup
    
    $ ./exachk –initpresetup
    
  2. To query the auto restart status of the daemon use, –initcheck:
    $ ./orachk –initcheck
    
    $ ./exachk –initcheck
    
    $ ./exachk –initcheck
    
    Auto restart functionality is configured.
    
    exachk daemon is running. PID : 68230
    
    To remove auto-restart configuration, use the –initrmsetup option:
    $ ./orachk –initrmsetup
    
    $ ./exachk –initrmsetup
    
    $ ./exachk –initrmsetup
    Shetting down exachk
    Stopping exachk daemon..
    
    Stopped.
    
    Removed exachk from inittab