Deactive Port Status and Bandwidth Check

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
astiostech18
Posts: 3
Joined: Fri Aug 24, 2018 2:31 am

Deactive Port Status and Bandwidth Check

Post by astiostech18 »

Hi Support,

We have thousands of port status and bandwidth check in our NagiosXI. We add this check using switch wizard. We want to deactivate the service in CCM for the port that is in CRITICAL/WARNING/UNKNOWN state. We don't want to delete it since it contain the configuration of the port ID and RRD file and maybe we will use it in future.

Is there any SQL queries that can be used to deactivate all this port check? Deactivating it port status and bandwidth check one by one based on it current state is tedious.

Any help and input is appreciated. Thanks.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Deactive Port Status and Bandwidth Check

Post by cdienger »

The database where the status is stored is separate from the database where the configuration where config activation is stored and I don't see a good way to join the two. That said, you can get a list of the active services by running:

echo "select id,active,service_description,config_name from tbl_service where active='1'" | mysql -uroot -pnagiosxi -Dnagiosql

Comparing that to dashboard results showing services in CRITICAL/WARNING/UNKNOWN state to determine what needs to be disabled, you can then update the db to deactive the config:

UPDATE `tbl_service` SET `active` = '1' WHERE `id` = <service_id_from_previous_sql>;
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
astiostech18
Posts: 3
Joined: Fri Aug 24, 2018 2:31 am

Re: Deactive Port Status and Bandwidth Check

Post by astiostech18 »

In which table is the service status stored?

We have statusengine broker and db installed. And this is how I planned to do it.

Code: Select all

update nagiosql.tbl_service, statusengine.statusengine_servicestatus
set nagiosql.tbl_service.active = '0'
where nagiosql.tbl_service.service_description IN (select service_description from statusengine.statusengine_servicestatus where current_state != '0' and check_command like '%ifoperstatus%') 
and nagiosql.tbl_service.config_name IN (select hostname from statusengine.statusengine_servicestatus where current_state != '0' and check_command like '%ifoperstatus%')
This query will set active to 0 if the specific port status is not OK. However, I still haven't found a way to disable it's bandwidth check as well.

So if port eth0 is CRITICAL, I want to set active to 0 for 'eth0 Status' check and 'eth0 Bandwidth' check.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Deactive Port Status and Bandwidth Check

Post by cdienger »

It looks like it creates a state field in the statusengine_servicechecks field:

Code: Select all

CREATE TABLE `statusengine_servicechecks` (
  `hostname`              VARCHAR(255),
  `service_description`   VARCHAR(255),
  `state`                 TINYINT(2) UNSIGNED DEFAULT 0,
  `is_hardstate`          TINYINT(1) UNSIGNED DEFAULT 0,
  `start_time`            BIGINT(13) NOT NULL,
  `end_time`              BIGINT(13) NOT NULL,
  `output`                VARCHAR(1024),
  `timeout`               TINYINT(3) UNSIGNED DEFAULT 0,
  `early_timeout`         TINYINT(1) UNSIGNED DEFAULT 0,
  `latency`               FLOAT               DEFAULT 0,
  `execution_time`        FLOAT               DEFAULT 0,
  `perfdata`              VARCHAR(1024),
  `command`               VARCHAR(1024),
  `current_check_attempt` TINYINT(3) UNSIGNED DEFAULT 0,
  `max_check_attempts`    TINYINT(3) UNSIGNED DEFAULT 0,
  `long_output`           VARCHAR(8192),
  KEY `servicename` (`hostname`, `service_description`, `start_time`)

)
Not being too familiar with the broker though, I would first poke around the db querying these fields and table while making changes in the UI and maybe ping the authors if needed.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked