How to change the Outage Type in bulk in a time range?
search cancel

How to change the Outage Type in bulk in a time range?

book

Article ID: 277440

calendar_today

Updated On:

Products

DX NetOps CA Spectrum

Issue/Introduction

A couple of weeks ago we had a large network outage problem and I would need to exempt the outage. In the OneClick Administration page --> Outage Editor I have to do per device/model.

Is there a way to do in bulk, in a time range?

Environment

Spectrum: any version

Resolution

These are the Outage Types:

mysql> select * from outagetype;
+-------------+-------------+
| outage_type | outage_desc |
+-------------+-------------+
|           0 | Initial     |
|           1 | Unplanned   |
|           2 | Planned     |
|           3 | Exempt      |
+-------------+-------------+
4 rows in set (0.00 sec)

This is the modeloutage table description:

mysql> desc modeloutage;
+----------------------+-----------------+------+-----+-------------------+-----------------------------------------------+
| Field                | Type            | Null | Key | Default           | Extra                                         |
+----------------------+-----------------+------+-----+-------------------+-----------------------------------------------+
| model_outage_ID      | bigint unsigned | NO   | PRI | NULL              | auto_increment                                |
| model_key            | int unsigned    | NO   | MUL | NULL              |                                               |
| landscape_h          | int unsigned    | NO   | MUL | NULL              |                                               |
| start_time           | datetime        | NO   | MUL | NULL              |                                               |
| end_time             | datetime        | YES  | MUL | NULL              |                                               |
outage_type          | int unsigned    | NO   | MUL | NULL              |                                               |
| zero_length_outage   | tinyint         | NO   | MUL | 0                 |                                               |
| start_event_key      | bigint unsigned | YES  | MUL | NULL              |                                               |
| end_event_key        | bigint unsigned | YES  | MUL | NULL              |                                               |
| legacy_outage_id     | int unsigned    | YES  |     | NULL              |                                               |
| legacy_outage_source | char(1)         | YES  |     | NULL              |                                               |
| last_updated_time    | datetime        | YES  |     | CURRENT_TIMESTAMP | DEFAULT_GENERATED on update CURRENT_TIMESTAMP |
+----------------------+-----------------+------+-----+-------------------+-----------------------------------------------+
12 rows in set (0.00 sec)

You will have to change the value of the outage_type in the modeloutage table in a time range.

Here is an example:

update modeloutage set outage_type=3 where outage_type!=0 and start_time > '2023-11-22 00:00:00' and start_time < '2023-11-23 00:00:00';

Note: outage_type=0 is the initial outage that we cannot change.