# Switch Monitoring on/off

## Turning Monitoring On or Off

If you intentionally want a System not to be monitored at all, you can turn the monitoring off. The System will be removed from RealTime Monitoring views, and there will be no Daily Checks performed while monitoring is off. The Avantra Agent still proceeds with availability tracking and some other tasks, though.

There are basically three ways to turn the monitoring on or off, and one case where this is performed automatically:

- Manual intervention using Avantra WebUI in order to turn the monitoring on or off immediately. This is described in Turning Monitoring On or Off ad-hoc using the UI.

  To avoid it being simply forgotten to turn the monitoring on again, there is a default monitoring off period defined. If this period is exceeded, Avantra turns the monitoring on again automatically.

  | You can also turn the monitoring on or off using the Avantra mobile app.

- Using a command-line option of the Avantra Agent. This option may be used with cluster switching scripts. This option is described in Turning Monitoring On or Off ad-hoc using the Agent.

- Using the Web Service. Using the Avantra Web Service in a Java Project and Downloading and Using Avantra CLI.

- Scheduling periods with the monitoring turned off in advance in order to, for example, map planned maintenance periods. This is done by the so-called Maintenance Windows and described in detail in Turning Monitoring On or Off using a Maintenance Window.

  Systems with monitoring turned off by a Maintenance Window are flagged with a icon.

- The monitoring is turned off automatically for SAP Instances that are no longer discovered by any Avantra Agent and in case you set a System not operational.

Basically, if you turn the monitoring on or off for a Physical Server, Virtual Cluster Server, SAP Instance, or stand-alone SAP System, only this particular System is affected. If you turn monitoring on or off for an SAP System, then the SAP System itself and all SAP Instances comprising the SAP System are affected.

However, in some cases, you may want to do this in a more "natural" way, like if you disable the monitoring for a {server}, the monitoring of all hosted SAP Instances will be turned off as well. This kind of _cascading is also available:

- In Avantra WebUI there is a dialog whenever you turn monitoring on or off that allows you to define which of the depending System's monitoring shall be turned on or off as well.

- The Avantra Agent provides a command-line option `-cascade` to turn the cascading on.

- For a Maintenance Window cascading is always turned on!

You can see the effect of monitoring switch cascading in the following table:

Table 1. Monitoring on/off Effects
System Type | Monitoring Switch | Cascade | Effect
--- | --- | --- | ---
Server | off/off-until | yes | Turns monitoring off for the Server and all monitored SAP Instances and Databases. If there is no other SAP Instance monitored for an affected SAP System, the SAP System monitoring is turned off as well
no | Turns monitoring off for the Server only
on | yes | Turns monitoring on for the Server and all monitored SAP Instances and Databases (and, if necessary, for the monitored SAP Systems)
no | Turns monitoring on for the Server only
SAP Instance | off/off-until | yes | If this is the last SAP Instance of an SAP System with monitoring on, turns SAP Instance and SAP System monitoring off. Otherwise, turns only SAP Instance off
no | Turns monitoring off for the SAP Instance only
on | n/a | Turns SAP Instance (and SAP System, if required) monitoring on
SAP System | off/off-until | n/a | Turns monitoring off for the SAP System and all SAP Instances
on | Turns monitoring on for the SAP System and all SAP Instances
Stand-alone Database | off/off-until | n/a | Turns monitoring off for the stand-alone Database
on | Turns monitoring on for the stand-alone Database

| There is no relation between the monitoring switches of a Physical Server and any configured Virtual Cluster Server.

### Turning Monitoring On or Off ad-hoc using the UI

To change the monitoring switch, perform the following steps:

1. Select the appropriate System. Choose Systems SAP Instances, or Systems SAP Systems, or Systems Databases, or Systems SAP BusinessObjects, or Systems Cloud Services.

   | You can select multiple Systems at the same time.

2. Push the Monitoring Switch button.

3. In the pop-up window, choose whether to Cascade including dependent Systems, Dependent Systems only, or the selected Systems only. The list box automatically shows the affected systems.

4. Choose one of the options: Monitoring on, Monitoring off (with a time limit), Monitoring off without time limit. In case you choose Monitoring off (with a time limit), fill in a date as well. You may define a Reason in the corresponding field.

5. Push the OK button.

### Turning Monitoring On or Off ad-hoc using the Avantra Agent

There is also the option to turn monitoring on or off by the Avantra Agent directly. You can turn monitoring on or off for:

- the Physical Server the Avantra Agent runs on

- any Virtual Cluster Server configured to run on the Physical Server the Avantra Agent runs on

- any SAP Instance hosted by the Physical Server or a configured Virtual Cluster Server

- any SAP System having an SAP Instance hosted by this Physical Server or any configured Virtual Cluster Server

- any stand-alone Database hosted by the Physical Server or a configured Virtual Cluster Server

The main purpose of this function is to allow the monitoring to be turned on or off from within startup scripts or cluster switching scripts. Use the following syntax:

    /opt/avantra/agent/bin/monoff.sh -on|-off <type>=<comp> [-cascade]

The following options are available for the `-on` and `-off` command line switch:

- `-on|-off Server=<server_name> [-cascade]` turns on or off monitoring of the Server `<server_name>`, where `<server_name>` may either be the host name of a physical server (as returned by the `hostname` OS command) or the Virtual Cluster Server Name as defined in Avantra WebUI.

- `-on|off SapInstance=[<host_name>:]<instance_name> [-cascade]` turns on or off monitoring for the named SAP Instance. If the `<instance_name>` is not unique, add the `<host_name>` to uniquely identify the SAP Instance in question.

- `-on|-off SapSystem=<real_sap_sid>` turns on or off monitoring of the named SAP System and all SAP Instances comprising the SAP System.

- `-on|-off Database=<db_unified_name>` turns on or off monitoring of the named Database.

For a description of the effect of `-cascade` see effects of monitoring on/off.

| The Avantra Agent needs a connection to the Avantra Server in order to process the `-on|-off` command line switch. The Avantra Server evaluates all the dependencies stated in effects of monitoring on/off and modifies the monitoring switches of all affected Systems accordingly. Finally, the Avantra Server deploys the new configuration settings back to all affected Systems.

Depending on the value of the TraceLevel Monitoring Parameter you may see log messages on stdout. If the Avantra Agent was able to contact Avantra Server properly in order to tell it the new monitoring configuration, it will exit with state 0, otherwise, it will exit with a value different from 0.

## Turning Monitoring On or Off using a Maintenance Window

| Apart from turning the monitoring on or off, Maintenance Windows can also be used to disable Notifications and to stop and start Systems.

Perform the following steps in order to create a new Maintenance Window:

| Please bear in mind the cascading of monitoring on or off for Maintenance Windows as described in effects of monitoring on/off.

Procedure: Defining a Maintenance Window

1. Select Configuration Maintenance Windows from the top-level menu and push the New button.

2. Fill in a Name, choose whether the Maintenance Window should be Active, and select a System Type.

   | Applying a Maintenance Window to a Business Service has the same effect as setting the Business Service inactive for the given period of time.

3. Choose a Customer if desired. In case you selected one, only the Systems of this Customer (and its descendants, if a Customer hierarchy is used) are considered. Also, a User must have the Permission View Maintenance Window / Edit Maintenance Window for the named Customer in order to view or modify the Maintenance Window.

   If you leave this field empty, Systems of all Customers are considered, but one needs the Permission View Maintenance Window / Edit Maintenance Window for all Customers in order to view or modify the Maintenance Window.

4. If you only want Notifications to be turned off during the Maintenance Window but keep monitoring turned on, choose `leave monitoring ON` for During maintenance.

5. Push the Next button.

6. Choose the Systems the Maintenance Window is applied to:

   - You can select existing System Selectors (also see Systems).

   - You can define a specific ad-hoc custom selection (which is only valid for this particular Parameter Set Maintenance Window. In this case, set the flag next to Define specific 'Ad-Hoc' Custom Selection and push the Create button. Fill in selection criteria, push the Test System Selector to verify the Systems, and hit the Save & Close button.

7. Push the Next button.

8. Add a Schedule(s) for the Maintenance Window:

   1. Push the New button.

   2. Fill in a Name and select a Timezone value.

   3. Choose one of the following options:

      For a non-recurrent Schedule

        Choose the Non-recurrent tab and fill in the Start date and either an End date or a Duration.

      For a recurrent Schedule

        Choose the Non-recurrent tab and fill in the Start date and either an End date or a Duration.

        Select a Range Start and optionally a Range End.

        Choose one of the following recurring options:

        Daily | is effective every day or every nth day.
        Weekly | is effective for selected days of every nth week.
        Monthly Day | is effective for a single day of every nth month, where the day of the month is given as number from 1 to 31. For values 29-31 the recurrence will fall on the last day of the month if the month has only 28, 29 or 30 days.
        Monthly Weekday | is effective for a single weekday of a single week of every nth month, where the weekday may be chosen from Sunday to Saturday and the week is specified as either 1st, 2nd, 3rd, 4th or last week of the month.
        Yearly Day | is effective for a single day of a single month of every year.
        Yearly Weekday | is similar to Monthly Weekday, except that it is only effective for the chosen month.

   4. You may choose to disable the Delete After End option (it is enabled by default).

   5. Push the OK button.

   6. Add further Schedules if desired.

9. Push the Create button.

| In availability Tracking Downtimes eventually detected during the Schedules of Maintenance Windows are considered “planned”. In availability data, these records are marked with the Wrench symbol.