Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

+ create centreon_health script #5990

Closed
wants to merge 19 commits into from
Closed

+ create centreon_health script #5990

wants to merge 19 commits into from

Conversation

Sims24
Copy link

@Sims24 Sims24 commented Jan 4, 2018

Script to quickly gather an overall overview of centreon scope and parameters. Very helpfull when things goes bad. Easily extensible.

Cover following topics :

  • rrd
  • database
  • module
  • server
  • systems
  • broker
  • logs

Centreon version : More complete for 2.8.x, but also manage 2.7.x (el6 and el7).

Offers following output format :

  • MARKDOWN
  • JSON
  • TEXT
  • DUMPER (debug perl)

Only prerequiste is perl binding for SSH C lib and centreon_plugins for Linux (SNMP) :

  • el6
yum install libssh libssh-devel 
git clone https://github.com/garnier-quentin/perl-libssh
cd perl-libssh/
perl Makefile.PL
make && make install
  • el7
yum install perl-Libssh-Session-0.3-1.el7.centos.x86_64

Sample output below (skip logs for the sake of clarity) :

[root@centreon-centos7 centreon]# su - centreon -c "/usr/share/centreon/bin/centreon_health --output-format MARKDOWN --skip-logs"

CENTREON_HEALTH TEXT OUTPUT

CENTREON OVERVIEW

  • Centreon Version: 2.8.17
  • Number of pollers: 2
  • Number of hosts: 17
  • Number of services: 139
  • Number of metrics: 318
  • Number of modules: 4
  • Number of plugin-packs: 35
  • Number of recurrent downtimes: 0

AVERAGE METRICS

  • Host / poller (avg): 8
  • Service / poller (avg): 69
  • Service / host (avg): 8
  • Metrics / service (avg): 2

RRD INFORMATIONS

  • RRD not updated since more than 180 days: 0
  • RRD written during last 5 five minutes: 33
  • RRD files Count/Size in /var/lib/centreon/metrics/ directory: 251/95M
  • RRD files Count/Size in /var/lib/centreon/status/ directory: 140/47M

DATABASES INFORMATIONS

Databases size

  • Size of centreon_storage database: 856M
  • Size of centreon database: 8M

Tables size (centreon_storage db)

  • Size of log_archive_host table: 29M
  • Size of downtimes table: 96K
  • Size of data_bin table: 687M
  • Size of log_archive_service table: 36M
  • Size of logs table: 100M

Partitioning check

  • Last partition date for log_archive_host table: 01/14/2018 00:00:00
  • Last partition date for data_bin table: 01/14/2018 00:00:00
  • Last partition date for log_archive_service table: 01/14/2018 00:00:00
  • Last partition date for logs table: 01/14/2018 00:00:00

SQL Engine tuning variables

  • Variable innodb_file_per_table = ON
  • Variable join_buffer_size = 4M
  • Variable key_buffer_size = 256M
  • Variable max_allowed_packet = 64M
  • Variable open_files_limit = 32000
  • Variable read_buffer_size = 512K
  • Variable read_only = OFF
  • Variable read_rnd_buffer_size = 256K
  • Variable sort_buffer_size = 32M

MODULE INFORMATIONS

  • Module Centreon License Manager is installed. (Author: Centreon # Codename: centreon-license-manager # Version: 1.0.1)
  • Module Centreon Plugin Pack Manager is installed. (Author: Centreon # Codename: centreon-pp-manager # Version: 2.2.0)
  • Module Centreon Open Tickets is installed. (Author: Centreon Team # Codename: centreon-open-tickets # Version: 1.2.0)
  • Module Centreon Auto Discovery is installed. (Author: Centreon # Codename: centreon-autodiscovery-server # Version: 2.3.0)

CENTREON NODES INFORMATIONS

Central

Identity:

  • Engine (version): Centreon Engine (1.7.2)
  • IP Address (SSH port): 127.0.0.1 (22)
  • Localhost: YES
  • Running: YES
  • Start time: 11/09/2017 16:49:33
  • Last alive: 01/04/2018 09:16:51
  • Uptime: 1M 3w 4d 5h 58m 15s
  • Count Hosts/Services - (Last command check): 13/114 - (01/04/2018 09:16:50)

Engine stats:

  • Buffer Usage(In_Use): 0
  • Buffer Usage(Max_Used): 3
  • Buffer Usage(Total_Available): 4096
  • Host Actively Checked(Last_15_minutes): 13
  • Host Actively Checked(Last_5_minutes): 13
  • Host Actively Checked(Last_hour): 13
  • Host Actively Checked(Last_minute): 1
  • Host Check Execution Time(Average): 1.468
  • Host Check Execution Time(Max): 10.002
  • Host Check Execution Time(Min): 0.000
  • Host Check Latency(Average): 0.082
  • Host Check Latency(Max): 0.175
  • Host Check Latency(Min): 0.000
  • Hosts Status(Down): 2
  • Hosts Status(Unreachable): 0
  • Hosts Status(Up): 12
  • Service Actively Checked(Last_15_minutes): 98
  • Service Actively Checked(Last_5_minutes): 78
  • Service Actively Checked(Last_hour): 113
  • Service Actively Checked(Last_minute): 7
  • Service Check Execution Time(Average): 7.109
  • Service Check Execution Time(Max): 60.155
  • Service Check Execution Time(Min): 0.003
  • Service Check Latency(Average): 0.092
  • Service Check Latency(Max): 0.208
  • Service Check Latency(Min): 0.002
  • Services Status(Critical): 3
  • Services Status(OK): 63
  • Services Status(Unknown): 47
  • Services Status(Warning): 1

Broker stats:

File: central-broker-master-stats.json
  • Version: 3.0.8
  • State: connected
  • Event proecessing speed 2.9
  • Queued events: 0
  • Last connection attempts: 12/30/2017 13:43:41
  • Last connection success: 12/30/2017 13:43:41
File: central-module-master-stats.json
  • Version: 3.0.8
  • State: connected
  • Event proecessing speed 1.1875
  • Queued events: 540
  • Last connection attempts: 12/30/2017 13:44:40
  • Last connection success: 12/30/2017 13:44:40
File: central-rrd-master-stats.json
  • Version: 3.0.8
  • State: listening
  • Event proecessing speed 0
  • Queued events: 0
  • Last connection attempts: -1
  • Last connection success: -1

System stats:

  • CPU => OK: CPU Usage: Wait 0.84 %, Guest 0.00 %, User 4.88 %, Soft Irq 0.02 %, Kernel 0.00 %, Interrupt 0.00 %, Guest Nice 0.00 %, Idle 93.30 %, Steal 0.00 %, System 0.96 %, Nice 0.00 % |
  • LOAD => OK: Load average: 0.00, 0.05, 0.08 |
  • MEMORY => OK: Ram Total: 1.80 GB, Used (-buffers/cache): 799.33 MB (43.44%), Buffer: 0.00 B, Cached: 835.89 MB, Shared: 96.30 MB |
  • SWAP => OK: Swap Total: 600.00 MB Used: 43.91 MB (7.32%) Free: 556.08 MB (92.68%) |
  • STORAGE => OK: All storages are ok |
    Storage '/' Usage Total: 1.99 GB Used: 1.15 GB (57.88%) Free: 858.37 MB (42.12%)
    Storage '/usr' Usage Total: 3.99 GB Used: 2.67 GB (66.81%) Free: 1.32 GB (33.19%)
    Storage '/var/lib/mysql' Usage Total: 3.99 GB Used: 3.00 GB (75.14%) Free: 1015.75 MB (24.86%)
    Storage '/tmp' Usage Total: 1016.66 MB Used: 258.26 MB (25.40%) Free: 758.40 MB (74.60%)

Poller

Identity:

  • Engine (version): Centreon Engine (1.7.2)
  • IP Address (SSH port): 10.30.2.66 (22)
  • Localhost: NO
  • Running: YES
  • Start time: 10/03/2017 17:14:17
  • Last alive: 01/04/2018 09:16:48
  • Uptime: 3M 1d 9h 35m 22s
  • Count Hosts/Services - (Last command check): 4/25 - (01/04/2018 09:16:48)

Engine stats:

  • Buffer Usage(In_Use): 0
  • Buffer Usage(Max_Used): 0
  • Buffer Usage(Total_Available): 4096
  • Host Actively Checked(Last_15_minutes): 3
  • Host Actively Checked(Last_5_minutes): 2
  • Host Actively Checked(Last_hour): 3
  • Host Actively Checked(Last_minute): 0
  • Host Check Execution Time(Average): 0.057
  • Host Check Execution Time(Max): 0.085
  • Host Check Execution Time(Min): 0.005
  • Host Check Latency(Average): 0.143
  • Host Check Latency(Max): 0.182
  • Host Check Latency(Min): 0.073
  • Hosts Status(Down): 0
  • Hosts Status(Unreachable): 0
  • Hosts Status(Up): 3
  • Service Actively Checked(Last_15_minutes): 13
  • Service Actively Checked(Last_5_minutes): 10
  • Service Actively Checked(Last_hour): 13
  • Service Actively Checked(Last_minute): 0
  • Service Check Execution Time(Average): 0.153
  • Service Check Execution Time(Max): 0.305
  • Service Check Execution Time(Min): 0.020
  • Service Check Latency(Average): 0.084
  • Service Check Latency(Max): 0.192
  • Service Check Latency(Min): 0.002
  • Services Status(Critical): 0
  • Services Status(OK): 7
  • Services Status(Unknown): 6
  • Services Status(Warning): 0

Broker stats:

File: poller-module-stats.json
  • Version: 3.0.7
  • State: connected
  • Event proecessing speed 0.5
  • Queued events: 392
  • Last connection attempts: 12/30/2017 13:44:10
  • Last connection success: 12/30/2017 13:44:10

System stats:

  • CPU => OK: CPU Usage: Wait 0.00 %, Guest 0.00 %, User 1.26 %, Soft Irq 0.01 %, Kernel 0.00 %, Interrupt 0.00 %, Guest Nice 0.00 %, Idle 98.42 %, Steal 0.00 %, System 0.31 %, Nice 0.00 % |
  • LOAD => OK: Load average: 0.01, 0.05, 0.05 |
  • MEMORY => OK: Ram Total: 1.80 GB, Used (-buffers/cache): 299.58 MB (16.28%), Buffer: 948.00 KB, Cached: 502.29 MB, Shared: 96.45 MB |
  • SWAP => OK: Swap Total: 820.00 MB Used: 0.00 B (0.00%) Free: 820.00 MB (100.00%) |
  • STORAGE => OK: Storage '/' Total: 6.19 GB Used: 2.09 GB (33.87%) Free: 4.09 GB (66.13%) |
    Storage '/' Total: 6.19 GB Used: 2.09 GB (33.87%) Free: 4.09 GB (66.13%)

@Sims24
Copy link
Author

Sims24 commented Jan 4, 2018

@garnier-quentin and @kduret would be great if you could take some time to review this one !

Copy link
Contributor

@kduret kduret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does not work if ppm is not installed

[root@localhost ~]# su - centreon -c "/usr/share/centreon/bin/centreon_health --output-format MARKDOWN --skip-logs"
2018-01-16 10:50:14 - MySQL error: Table 'centreon.mod_ppm_pluginpack' doesn't exist (caller: centreon::health::checkservers:/usr/share/perl5/vendor_perl/centreon/health/checkservers.pm:41) Query: SELECT count(*) FROM mod_ppm_pluginpack
Error: Illegal division by zero at /usr/share/perl5/vendor_perl/centreon/health/checkservers.pm line 105.

@Sims24
Copy link
Author

Sims24 commented Jan 17, 2018

Thanks @kduret i'll handle it

@kduret
Copy link
Contributor

kduret commented Apr 17, 2018

Can someone else reviews this PR ?


Specify snmp community to execute plugins

=item B<--output-type> <value>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Option is --ouput-format


=over 8

=item B<--centstorage-db> <value>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should require /etc/centreon/conf.pm to retrieve this information.
The centreon database can also be non standard.

Specify the name of your centstorage db if not standard
(default: centreon_storage).

=item B<--centreon-branch> <value>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it could be better if you get this information in the centreon database directly.

@lpinsivy
Copy link
Contributor

lpinsivy commented May 2, 2018

@Sims24 can you perform upgrade?

@Ridene Ridene force-pushed the master branch 2 times, most recently from a91ff91 to c2e9871 Compare July 26, 2018 11:48
+ fix division by zero, fix empty value
@lpinsivy lpinsivy added the status/in-backlog A dev will begin to work on your modifications soon label Feb 18, 2019
@garnier-quentin
Copy link
Contributor

It's still working with version 18.10. For me, it's ok. We can commit that version. We could do some update after.

@adr-mo
Copy link
Contributor

adr-mo commented Apr 12, 2019

New PR created https://github.com/centreon/centreon/pull/7418 to ease rework of commits, validation and merge

@adr-mo adr-mo closed this Apr 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/install kind/enhancement status/in-backlog A dev will begin to work on your modifications soon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants