{"id":1431,"date":"2026-07-29T14:42:30","date_gmt":"2026-07-29T12:42:30","guid":{"rendered":"https:\/\/communaute-omr.fr\/?p=1431"},"modified":"2026-07-29T15:50:18","modified_gmt":"2026-07-29T13:50:18","slug":"database-centreon-storage","status":"publish","type":"post","link":"https:\/\/communaute-omr.fr\/?p=1431","title":{"rendered":"Database centreon-storage"},"content":{"rendered":"\n<h1 id=\"avant-propos\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Avant-propos\"><\/span>Avant-propos<span class=\"ez-toc-section-end\"><\/span><\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Il est important de comprendre que la database centreon_storage est la table du temps r\u00e9el.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Toutes les donn\u00e9es affich\u00e9es dans la console en dehors des vues configuration et administration proviennent de cette database.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Il y a un lien entre les databases centreon et centeon_storage ce sont les ID pour&nbsp;:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Les h\u00f4tes<\/li>\n\n\n\n<li>Les diff\u00e9rents regroupements<\/li>\n\n\n\n<li>Services<\/li>\n\n\n\n<li>Hosts<\/li>\n\n\n\n<li>Services<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Donc tous les vues temps r\u00e9el s\u2019appuient sur cette database en utilisant la dur\u00e9e de r\u00e9tention pour afficher l\u2019historique dans les diff\u00e9rentes vues.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">La structure de la database est sensiblement identique \u00e0 celle de centreon.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Pour faire un raccourci dans la database centreon les tables sont au singulier et dans centreon-storage au pluriel.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ainsi par exemple les tables&nbsp;on peut faire les relations suivantes :<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th><strong>centreon<\/strong><\/th><th><strong>ce<\/strong>ntreon_storage<\/th><\/tr><\/thead><tbody><tr><td>acl_group_contactgroups_relations<\/td><td>centreon_acl<\/td><\/tr><tr><td>host<\/td><td>hosts<\/td><\/tr><tr><td>hostgroup<\/td><td>hostgroups<\/td><\/tr><tr><td>host_service_relation<\/td><td>&nbsp;<\/td><\/tr><tr><td>host_template_relation<\/td><td>&nbsp;<\/td><\/tr><tr><td>Hostcategories<\/td><td>&nbsp;<\/td><\/tr><tr><td>hostcategories_relation<\/td><td>&nbsp;<\/td><\/tr><tr><td>hostgroup_hg_relation<\/td><td>&nbsp;<\/td><\/tr><tr><td>hostgroup_relation<\/td><td>hosts_hostgroups<\/td><\/tr><tr><td>dependency<\/td><td>&nbsp;<\/td><\/tr><tr><td>dependency_hostChild_relation<\/td><td>hosts_hosts_dependencies<\/td><\/tr><tr><td>dependency_hostParent_relation<\/td><td>&nbsp;<\/td><\/tr><tr><td>host_service_relation<\/td><td>&nbsp;<\/td><\/tr><tr><td>host_hostparent_relation<\/td><td>hosts_hosts_parents<\/td><\/tr><tr><td>servicegroup<\/td><td>servicegroups<\/td><\/tr><tr><td>service<\/td><td>services<\/td><\/tr><tr><td>servicegroup_relation<\/td><td>services_servicegroups<\/td><\/tr><tr><td>dependency_serviceParent_relation<\/td><td>services_services_dependencies<\/td><\/tr><tr><td>dependency_serviceChild_relation<\/td><td>&nbsp;<\/td><\/tr><tr><td>dependency_servicegroupChild_relation<\/td><td>&nbsp;<\/td><\/tr><tr><td>dependency_servicegroupParent_relation<\/td><td>&nbsp;<\/td><\/tr><tr><td>service_categories<\/td><td>&nbsp;<\/td><\/tr><tr><td>service_categories_relation<\/td><td>&nbsp;<\/td><\/tr><tr><td>nagios_server<\/td><td>instances<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Nous pouvons noter que certaines tables n\u2019existent pas dans cetreon_storage. Donc la console aura besoin des 2 databases pour afficher les informations dans la console.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h1 id=\"demarche\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Demarche\"><\/span>D\u00e9marche<span class=\"ez-toc-section-end\"><\/span><\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Les requ\u00eates s\u2019appuieront sur les donn\u00e9es valides dans la database centreon pour afficher les informations contenues dans centreon_storage.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Cela \u00e9vitera d\u2019afficher&nbsp;les h\u00f4tes et les services d\u00e9sactiv\u00e9s<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">D\u00fb \u00e0 la dur\u00e9e de r\u00e9tention certains host, services, groupes, cat\u00e9gories sont pr\u00e9sentes dans la database centreon_storage<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Nous allons rechercher les h\u00f4tes ou les services actifs dans centreon et remonter leur \u00e9tat depuis centreon_storage.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">J\u2019ai fait un export de mon centreon et je l\u2019ai import\u00e9 sur un mysql en local pour titiller la b\u00eate.&nbsp;\ud83d\ude00<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">J\u2019ai \u00e9galement modifi\u00e9 volontairement certains status pour valider l\u2019affichage des ceux-ci.<\/p>\n\n\n\n<h1 id=\"lister-letat-des-hosts\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Lister_letat_des_hosts\"><\/span>Lister l\u2019\u00e9tat des hosts<span class=\"ez-toc-section-end\"><\/span><\/h1>\n\n\n\n<h2 id=\"schema\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Schema\"><\/span>Sch\u00e9ma<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/communaute-omr.fr\/wp-content\/uploads\/2026\/07\/image1-16.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2 id=\"analyse\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Analyse\"><\/span>Analyse<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Ce sera certainement l\u2019analyse la plus courte de cet article&nbsp;\ud83d\ude00<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On va rechercher dans centreon les h\u00f4tes actifs ,qui ne sont pas des templates et dans centreon_storage leurs \u00e9tats<\/p>\n\n\n\n<h2 id=\"requete\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Requete\"><\/span>Requ\u00eate<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 id=\"requete-depuis-la-database-centreon\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Requete_depuis_la_database_centreon\"><\/span>Requ\u00eate depuis la database centreon<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro omr-terminal\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>SELECT HST.host_name AS \"HOST\",&lt;br>REPLACE(REPLACE(REPLACE(REPLACE(CHST.state,\"0\",\"OK\"),\"1\",\"UNREACHABLE\"),\"2\",\"DOWN\"),\"3\",\"PENDING\") AS STATUS&lt;br>FROM centreon.host AS HST&lt;br>LEFT JOIN centreon_storage.hosts AS CHST ON CHST.host_id=HST.host_id&lt;br>WHERE HST.host_register=\"1\"&lt;br>AND HST.host_activate=\"1\"<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">SELECT<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_name<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;HOST&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #E1E4E8\">br<\/span><span style=\"color: #F97583\">&gt;<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">CHST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">state<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;0&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;OK&quot;<\/span><span style=\"color: #E1E4E8\">),<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;UNREACHABLE&quot;<\/span><span style=\"color: #E1E4E8\">),<\/span><span style=\"color: #9ECBFF\">&quot;2&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;DOWN&quot;<\/span><span style=\"color: #E1E4E8\">),<\/span><span style=\"color: #9ECBFF\">&quot;3&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;PENDING&quot;<\/span><span style=\"color: #E1E4E8\">) <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">STATUS&lt;<\/span><span style=\"color: #E1E4E8\">br<\/span><span style=\"color: #F97583\">&gt;FROM<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HST<\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #E1E4E8\">br<\/span><span style=\"color: #F97583\">&gt;LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon_storage<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hosts<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> CHST <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">CHST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #E1E4E8\">br<\/span><span style=\"color: #F97583\">&gt;WHERE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_register<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #E1E4E8\">br<\/span><span style=\"color: #F97583\">&gt;AND<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_activate<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 id=\"requete-depuis-la-database-centreon_storage\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Requete_depuis_la_database_centreon_storage\"><\/span>Requ\u00eate depuis la database centreon_storage<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro omr-terminal\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>SELECT HST.host_name AS \"HOST\",\nREPLACE(REPLACE(REPLACE(REPLACE(CHST.state,\"0\",\"OK\"),\"1\",\"UNREACHABLE\"),\"2\",\"DOWN\"),\"3\",\"PENDING\") AS STATUS\nFROM centreon_storage.hosts AS CHST\nLEFT JOIN centreon.host AS HST ON HST.host_id=CHST.host_id\nWHERE HST.host_register=\"1\"\nAND HST.host_activate=\"1\"<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">SELECT<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_name<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;HOST&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">CHST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">state<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;0&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;OK&quot;<\/span><span style=\"color: #E1E4E8\">),<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;UNREACHABLE&quot;<\/span><span style=\"color: #E1E4E8\">),<\/span><span style=\"color: #9ECBFF\">&quot;2&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;DOWN&quot;<\/span><span style=\"color: #E1E4E8\">),<\/span><span style=\"color: #9ECBFF\">&quot;3&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;PENDING&quot;<\/span><span style=\"color: #E1E4E8\">) <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">STATUS<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">FROM<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon_storage<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hosts<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> CHST<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HST <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">CHST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">WHERE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_register<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">AND<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_activate<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 id=\"resultat\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Resultat\"><\/span>R\u00e9sultat<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-table tableau-sql\"><table><thead><tr><th>HOST<\/th><th>STATUS<\/th><\/tr><\/thead><tbody><tr><td>Central-Centreon<\/td><td>OK<\/td><\/tr><tr><td>Central-OMR-WEB1<\/td><td>OK<\/td><\/tr><tr><td>Poller-2<\/td><td>DOWN<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>OK<\/td><\/tr><tr><td>communaute-omr.fr<\/td><td>OK<\/td><\/tr><tr><td>Centreon-OMR-central-VIP<\/td><td>PENDING<\/td><\/tr><tr><td>Centreon-OMR-DB-VIP<\/td><td>UNREACHABLE<\/td><\/tr><tr><td>Centreon-OMR-Database2<\/td><td>OK<\/td><\/tr><tr><td>Central-OMR-WEB2<\/td><td>OK<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h1 id=\"lister-letat-hosts-dans-un-hostgroup\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Lister_letat_hosts_dans_un_hostgroup\"><\/span>Lister l\u2019\u00e9tat hosts dans un hostgroup<span class=\"ez-toc-section-end\"><\/span><\/h1>\n\n\n\n<h2 id=\"schema-2\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Schema-2\"><\/span>Sch\u00e9ma<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/communaute-omr.fr\/wp-content\/uploads\/2026\/07\/image2-15.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2 id=\"analyse-2\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Analyse-2\"><\/span>Analyse<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Le sch\u00e9ma ci-dessus nous montre comment la table centreon_storage.hosts est aliment\u00e9 par les tables de centreon host et nagios_server.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>La table host_id de centreon alimente le champ host_id de centreon_storage<\/li>\n\n\n\n<li>La table nagios_server de centreon alimente le champ instance_id dans centreon_storage.<\/li>\n<\/ul>\n\n\n\n<h2 id=\"requete-2\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Requete-2\"><\/span>Requ\u00eate<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro omr-terminal\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>SELECT\nNS.name AS Poller,\nHST.host_name AS HOST,\nHST.host_alias AS ALIAS,\nREPLACE(REPLACE(REPLACE(CHST.state, \"0\", \"OK\"), \"1\", \"DOWN\"), \"2\", \" UNREACHABLE \") AS STATUS\nFROM centreon.host AS HST\nLEFT JOIN centreon_storage.hosts AS CHST on CHST.host_id=HST.host_id\nLEFT JOIN centreon.nagios_server AS NS ON NS.id=CHST.instance_id\nWHERE host_register=\"1\"\nAND host_activate='1'\nORDER BY NS.name,HST.host_name;<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">SELECT<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">NS<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">name<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> Poller,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_name<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HOST,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_alias<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> ALIAS,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">CHST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">state<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #9ECBFF\">&quot;0&quot;<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #9ECBFF\">&quot;OK&quot;<\/span><span style=\"color: #E1E4E8\">), <\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #9ECBFF\">&quot;DOWN&quot;<\/span><span style=\"color: #E1E4E8\">), <\/span><span style=\"color: #9ECBFF\">&quot;2&quot;<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #9ECBFF\">&quot; UNREACHABLE &quot;<\/span><span style=\"color: #E1E4E8\">) <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">STATUS<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">FROM<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HST<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon_storage<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hosts<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> CHST <\/span><span style=\"color: #F97583\">on<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">CHST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">nagios_server<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> NS <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">NS<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">CHST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">instance_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">WHERE<\/span><span style=\"color: #E1E4E8\"> host_register<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">AND<\/span><span style=\"color: #E1E4E8\"> host_activate<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">&#39;1&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">ORDER BY<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">NS<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">name<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_name<\/span><span style=\"color: #E1E4E8\">;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 id=\"resultat-2\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Resultat-2\"><\/span>R\u00e9sultat<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-table tableau-sql\"><table><thead><tr><th><strong>Poller<\/strong><\/th><th><strong>HOST<\/strong><\/th><th><strong>ALIAS<\/strong><\/th><th><strong>STATUS<\/strong><\/th><\/tr><\/thead><tbody><tr><td>Central<\/td><td>Central-Centreon<\/td><td>Central-Centreon<\/td><td>OK<\/td><\/tr><tr><td>Central<\/td><td>Poller-2<\/td><td>Poller-2<\/td><td>UNREACHABLE<\/td><\/tr><tr><td>poller-2<\/td><td>Central-OMR<\/td><td>Central-OMR<\/td><td>OK<\/td><\/tr><tr><td>poller-2<\/td><td>Centreon-OMR-Database1<\/td><td>Centreon-OMR-Database1<\/td><td>DOWN<\/td><\/tr><tr><td>poller-2<\/td><td>communaute-omr.fr<\/td><td>communaute-omr.fr<\/td><td>OK<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h1 id=\"lister-letat-des-services-dun-hote\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Lister_letat_des_services_dun_hote\"><\/span>Lister l\u2019\u00e9tat des services d\u2019un h\u00f4te<span class=\"ez-toc-section-end\"><\/span><\/h1>\n\n\n\n<h2 id=\"schema-3\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Schema-3\"><\/span>Sch\u00e9ma<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/communaute-omr.fr\/wp-content\/uploads\/2026\/07\/image3-9.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2 id=\"analyse-3\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Analyse-3\"><\/span>Analyse<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Nous voyons bien l\u2019h\u00e9ritage des tables de centreon_storage par celles de centreon<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Contrairement \u00e0 la database centreon le lien entre les hosts et les services sont directement dans la table des services.<\/p>\n\n\n\n<h2 id=\"requete-3\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Requete-3\"><\/span>Requ\u00eate<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro omr-terminal\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>SELECT\nHST.host_name AS HOST,\nSVC.service_description AS SERVICE,\nREPLACE(REPLACE(REPLACE(REPLACE(CSVC.state,\"0\",\"OK\"),\"1\",\"WARNING\"),\"2\",\"CRITICAL\"),\"3\",\"UNKNOWN\") AS STATUS\nFROM centreon.host AS HST\nLEFT JOIN centreon_storage.hosts AS CHST on CHST.host_id=HST.host_id\nLEFT JOIN centreon_storage.services AS CSVC ON CSVC.host_id=HST.host_id\nLEFT JOIN centreon.service AS SVC ON SVC.service_id=CSVC.service_id\nWHERE HST.host_register=\"1\"\nAND HST.host_activate='1'\nAND SVC.service_activate=\"1\"\nAND SVC.service_register=\"1\"\nAND CHST.state=0\nORDER BY HST.host_name,SVC.service_description;<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">SELECT<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_name<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HOST,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">SVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_description<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">SERVICE<\/span><span style=\"color: #E1E4E8\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">CSVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">state<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;0&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;OK&quot;<\/span><span style=\"color: #E1E4E8\">),<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;WARNING&quot;<\/span><span style=\"color: #E1E4E8\">),<\/span><span style=\"color: #9ECBFF\">&quot;2&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;CRITICAL&quot;<\/span><span style=\"color: #E1E4E8\">),<\/span><span style=\"color: #9ECBFF\">&quot;3&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;UNKNOWN&quot;<\/span><span style=\"color: #E1E4E8\">) <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">STATUS<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">FROM<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HST<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon_storage<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hosts<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> CHST <\/span><span style=\"color: #F97583\">on<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">CHST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon_storage<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">services<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> CSVC <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">CSVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> SVC <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">SVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">CSVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">WHERE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_register<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">AND<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_activate<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">&#39;1&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">AND<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">SVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_activate<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">AND<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">SVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_register<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">AND<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">CHST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">state<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">0<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">ORDER BY<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_name<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #79B8FF\">SVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_description<\/span><span style=\"color: #E1E4E8\">;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 id=\"resultat-exemple\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Resultat_exemple\"><\/span>R\u00e9sultat exemple<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-table tableau-sql\"><table><thead><tr><th><strong>HOST<\/strong><\/th><th><strong>SERVICE<\/strong><\/th><th><strong>STATUS<\/strong><\/th><\/tr><\/thead><tbody><tr><td> Central-OMR-WEB1         <\/td><td> App-Webserver-Apache-Content-Status                           <\/td><td> OK       <\/td><\/tr><tr><td> Central-OMR-WEB1         <\/td><td> OS-Linux-Disk-\/home-Usage                                     <\/td><td> OK       <\/td><\/tr><tr><td> Central-OMR-WEB1         <\/td><td> OS-Linux-Disk-\/-Usage                                         <\/td><td>WARNING<\/td><\/tr><tr><td> Central-OMR-WEB1         <\/td><td> OS-Linux-Process-ntpd-Status                                  <\/td><td> OK       <\/td><\/tr><tr><td> Central-OMR-WEB1         <\/td><td> OS-Linux-SYS-Uptime                                           <\/td><td> OK       <\/td><\/tr><tr><td> Central-OMR-WEB1         <\/td><td> Ping                                                          <\/td><td> OK       <\/td><\/tr><tr><td> Central-OMR-WEB2         <\/td><td> OS-Linux-Process-snmpd-Status                                 <\/td><td> OK       <\/td><\/tr><tr><td> Central-OMR-WEB2         <\/td><td> OS-Linux-Process-sshd-Status                                  <\/td><td> OK       <\/td><\/tr><tr><td> Central-OMR-WEB2         <\/td><td> OS-Linux-SYS-CPU                                              <\/td><td> OK       <\/td><\/tr><tr><td> Central-OMR-WEB2         <\/td><td> Ping                                                          <\/td><td> OK       <\/td><\/tr><tr><td> Centreon-OMR-central-VIP <\/td><td> App-Cluster-Centreon-HA-Resource-cbd_central_broker-Status    <\/td><td> OK       <\/td><\/tr><tr><td> Centreon-OMR-central-VIP <\/td><td> App-Cluster-Centreon-HA-Resource-cbd_rrd-clone-Status         <\/td><td> OK       <\/td><\/tr><tr><td> Centreon-OMR-central-VIP <\/td><td> App-Monitoring-Centreon-Broker-module-Stats                   <\/td><td> OK       <\/td><\/tr><tr><td> Centreon-OMR-central-VIP <\/td><td> Ping                                                          <\/td><td> OK       <\/td><\/tr><tr><td> Centreon-OMR-Database1   <\/td><td> App-DB-MySQL-Connections-Number                               <\/td><td> OK       <\/td><\/tr><tr><td> Centreon-OMR-Database1   <\/td><td> App-DB-MySQL-Connection-Time                                  <\/td><td>WARNING<\/td><\/tr><tr><td> Centreon-OMR-Database1   <\/td><td> OS-Linux-SYS-Uptime                                           <\/td><td> OK       <\/td><\/tr><tr><td> Centreon-OMR-Database1   <\/td><td> Ping                                                          <\/td><td> OK       <\/td><\/tr><tr><td> Centreon-OMR-Database2   <\/td><td> App-DB-MySQL-Connections-Number                               <\/td><td> OK       <\/td><\/tr><tr><td> Centreon-OMR-Database2   <\/td><td> OS-Linux-SYS-NTP                                              <\/td><td> OK       <\/td><\/tr><tr><td> Centreon-OMR-Database2   <\/td><td> Ping                                                          <\/td><td> OK       <\/td><\/tr><tr><td> Centreon-OMR-DB-VIP      <\/td><td> App-Cluster-Centreon-HA-Resource-ms_mysql-clone-Status        <\/td><td> OK       <\/td><\/tr><tr><td> Centreon-OMR-DB-VIP      <\/td><td> App-Cluster-Centreon-HA-Resource-vip_mysql-clone-Status       <\/td><td> OK       <\/td><\/tr><tr><td> Centreon-OMR-DB-VIP      <\/td><td> App-DB-MySQL-MariaDB-Replication                              <\/td><td> CRITICAL <\/td><\/tr><tr><td> Centreon-OMR-DB-VIP      <\/td><td> Ping                                                          <\/td><td> OK       <\/td><\/tr><tr><td> communaute-omr.fr        <\/td><td> App-Webserver-Apache-ResponseTime                             <\/td><td> OK       <\/td><\/tr><tr><td> communaute-omr.fr        <\/td><td> OS-Linux-Process-sshd-Status                                  <\/td><td> OK       <\/td><\/tr><tr><td> communaute-omr.fr        <\/td><td> OS-Linux-SYS-CPU                                              <\/td><td> OK       <\/td><\/tr><tr><td> communaute-omr.fr        <\/td><td> Ping                                                          <\/td><td> OK       <\/td><\/tr><tr><td> Poller-2                 <\/td><td> App-Monitoring-Centreon-Broker-module-Stats                   <\/td><td> OK       <\/td><\/tr><tr><td> Poller-2                 <\/td><td> OS-Linux-Process-crond-Status                                 <\/td><td> OK       <\/td><\/tr><tr><td> Poller-2                 <\/td><td> OS-Linux-SYS-Uptime                                           <\/td><td> OK       <\/td><\/tr><tr><td> Poller-2                 <\/td><td> Ping                                                          <\/td><td> OK       <\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h1 id=\"lister-letat-services-dans-un-hostgroup\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Lister_letat_services_dans_un_hostgroup\"><\/span>Lister l\u2019\u00e9tat services dans un hostgroup<span class=\"ez-toc-section-end\"><\/span><\/h1>\n\n\n\n<h2 id=\"schema-4\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Schema-4\"><\/span>Sch\u00e9ma<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/communaute-omr.fr\/wp-content\/uploads\/2026\/07\/image4-9.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2 id=\"analyse-4\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Analyse-4\"><\/span>Analyse<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">L\u00e0 \u00e7a commence de devenir super sweet&nbsp;\ud83d\ude00<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Pour afficher 4 colonnes nous avons besoin de 6 tables dans 2 databases rien que cela&nbsp;\ud83d\ude1b<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">La d\u00e9marche est la suivante&nbsp;:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>On recherche les hostgroups actifs<\/li>\n\n\n\n<li>On recherche les hosts dans le hostgroup<\/li>\n\n\n\n<li>On v\u00e9rifie que les hosts sont bien actifs<\/li>\n\n\n\n<li>On recherche les services rattach\u00e9s aux hosts<\/li>\n\n\n\n<li>On v\u00e9rifie que les services sont actifs<\/li>\n\n\n\n<li>On regarde enfin leur status en parsant la valeur par une indication parlante<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Tout un programme&nbsp;\ud83d\ude00<\/p>\n\n\n\n<h2 id=\"requete-4\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Requete-4\"><\/span>Requ\u00eate<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro omr-terminal\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>SELECT HG.hg_name AS HOSTGROUP,\nHST.host_name,\nSVC.service_description AS SERVICE,\nREPLACE(REPLACE(REPLACE(REPLACE(REPLACE(CSVC.state,\"0\",\"OK\"),\"1\",\"WARNING\"),\"2\",\"CRITICAL\"),\"3\",\"UNKNOWN\"),\"4\",\"PENDING\") AS STATUS\nFROM centreon.hostgroup AS HG\nLEFT JOIN centreon.hostgroup_relation AS HGR on HGR.hostgroup_hg_id=HG.hg_id\nLEFT JOIN  centreon.host AS HST ON HST.host_id=HGR.host_host_id\nLEFT JOIN centreon_storage.hosts AS CHST ON CHST.host_id=HST.host_id\nLEFT JOIN centreon_storage.services AS CSVC ON CSVC.host_id=HST.host_id\nLEFT JOIN centreon.service AS SVC ON SVC.service_id=CSVC.service_id\nWHERE HST.host_activate=\"1\"\nAND HST.host_register=\"1\"\nAND SVC.service_activate=\"1\"\nAND SVC.service_register=\"1\"\nAND SVC.service_description like \"%ping%\"\nORDER BY HG.hg_name, HST.host_name<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">SELECT<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HG<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hg_name<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HOSTGROUP,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_name<\/span><span style=\"color: #E1E4E8\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">SVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_description<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">SERVICE<\/span><span style=\"color: #E1E4E8\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">CSVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">state<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;0&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;OK&quot;<\/span><span style=\"color: #E1E4E8\">),<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;WARNING&quot;<\/span><span style=\"color: #E1E4E8\">),<\/span><span style=\"color: #9ECBFF\">&quot;2&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;CRITICAL&quot;<\/span><span style=\"color: #E1E4E8\">),<\/span><span style=\"color: #9ECBFF\">&quot;3&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;UNKNOWN&quot;<\/span><span style=\"color: #E1E4E8\">),<\/span><span style=\"color: #9ECBFF\">&quot;4&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;PENDING&quot;<\/span><span style=\"color: #E1E4E8\">) <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">STATUS<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">FROM<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hostgroup<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HG<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hostgroup_relation<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HGR <\/span><span style=\"color: #F97583\">on<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HGR<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hostgroup_hg_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">HG<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hg_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\">  <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HST <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">HGR<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_host_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon_storage<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hosts<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> CHST <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">CHST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon_storage<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">services<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> CSVC <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">CSVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> SVC <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">SVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">CSVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">WHERE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_activate<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">AND<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_register<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">AND<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">SVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_activate<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">AND<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">SVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_register<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">AND<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">SVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_description<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">like<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;%ping%&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">ORDER BY<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HG<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hg_name<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_name<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 id=\"resultat-3\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Resultat-3\"><\/span>R\u00e9sultat<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-table tableau-sql\"><table><thead><tr><th><strong>HOSTGROUP<\/strong><\/th><th><strong>HOST<\/strong><\/th><th><strong>SERVICE<\/strong><\/th><th><strong>STATUS<\/strong><\/th><\/tr><\/thead><tbody><tr><td>Centreon<\/td><td>Central-OMR-WEB1<\/td><td>Ping<\/td><td>OK<\/td><\/tr><tr><td>Centreon<\/td><td>Central-OMR-WEB2<\/td><td>Ping<\/td><td>PENDING<\/td><\/tr><tr><td>Centreon<\/td><td>Centreon-OMR-Database1<\/td><td>Ping<\/td><td>OK<\/td><\/tr><tr><td>Centreon<\/td><td>Centreon-OMR-Database2<\/td><td>Ping<\/td><td>UNKNOWN<\/td><\/tr><tr><td>Centreon<\/td><td>Poller-2<\/td><td>Ping<\/td><td>WARNING<\/td><\/tr><tr><td>Centreon_Cluster<\/td><td>Central-OMR-WEB1<\/td><td>Ping<\/td><td>OK<\/td><\/tr><tr><td>Centreon_Cluster<\/td><td>Central-OMR-WEB2<\/td><td>Ping<\/td><td>PENDING<\/td><\/tr><tr><td>Centreon_Cluster<\/td><td>Centreon-OMR-central-VIP<\/td><td>Ping<\/td><td>OK<\/td><\/tr><tr><td>Centreon_Cluster<\/td><td>Centreon-OMR-Database1<\/td><td>Ping<\/td><td>OK<\/td><\/tr><tr><td>Centreon_Cluster<\/td><td>Centreon-OMR-Database2<\/td><td>Ping<\/td><td>UNKNOWN<\/td><\/tr><tr><td>Centreon_Cluster<\/td><td>Centreon-OMR-DB-VIP<\/td><td>Ping<\/td><td>CRITICAL<\/td><\/tr><tr><td>Centreon_Cluster<\/td><td>Poller-2<\/td><td>Ping<\/td><td>WARNING<\/td><\/tr><tr><td>Communaute-omr<\/td><td>communaute-omr.fr<\/td><td>Ping<\/td><td>OK<\/td><\/tr><tr><td>Pollers_LAN<\/td><td>Poller-2<\/td><td>Ping<\/td><td>WARNING<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h1 id=\"lister-letat-services-dans-un-servicegroup\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Lister_letat_services_dans_un_servicegroup\"><\/span>Lister l\u2019\u00e9tat services dans un servicegroup<span class=\"ez-toc-section-end\"><\/span><\/h1>\n\n\n\n<h2 id=\"schema-5\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Schema-5\"><\/span>Sch\u00e9ma<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/communaute-omr.fr\/wp-content\/uploads\/2026\/07\/image5-7.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2 id=\"analyse-5\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Analyse-5\"><\/span>Analyse<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On continue&nbsp;\ud83d\ude00<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Pour afficher 4 colonnes nous avons toujours besoin de 6 tables dans 2 databases . Et oui \ud83d\ude1b<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">La d\u00e9marche est la suivante&nbsp;:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>On recherche les servicesgroups actifs<\/li>\n\n\n\n<li>On recherche la relation entre les servicegroups et les services<\/li>\n\n\n\n<li>On v\u00e9rifie que les services sont bien actifs<\/li>\n\n\n\n<li>On recherche les hosts rattach\u00e9s aux services<\/li>\n\n\n\n<li>On v\u00e9rifie que les hosts sont actifs<\/li>\n\n\n\n<li>On regarde enfin le status des services en parsant la valeur par une indication parlante<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Encore tout un programme&nbsp;\ud83d\ude00<\/p>\n\n\n\n<h2 id=\"requete-5\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Requete-5\"><\/span>Requ\u00eate<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro omr-terminal\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>SELECT DISTINCT\nSG.sg_name AS \"SERVICEGROUP\",\nHST.host_name AS \"HOST\",\nSVC.service_description AS \"SERVICE\",\nREPLACE(REPLACE(REPLACE(REPLACE(CSVC.state,\"0\",\"OK\"),\"1\",\"WARNING\"),\"2\",\"CRITICAL\"),\"3\",\"UNKNOWN\") AS STATUS\nFROM centreon.servicegroup AS SG\nLEFT JOIN centreon.servicegroup_relation AS SGR ON SGR.servicegroup_sg_id=SG.sg_id\nLEFT JOIN centreon.service AS SVC ON SVC.service_id=SGR.service_service_id\nLEFT JOIN centreon.host_service_relation AS HSR ON HSR.service_service_id=SVC.service_ID\nLEFT JOIN centreon.host AS HST ON HST.host_id=HSR.host_host_id\nLEFT JOIN centreon_storage.services AS CSVC on CSVC.service_id=SVC.service_id\nWHERE SVC.service_activate='1'\nAND SVC.service_register=\"1\"\nAND SVC.service_description like \"OS%process%snmp%\"\nORDER BY SG.sg_name, HST.host_name,SVC.service_description;<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">SELECT DISTINCT<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">SG<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">sg_name<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;SERVICEGROUP&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_name<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;HOST&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">SVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_description<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;SERVICE&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">CSVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">state<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;0&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;OK&quot;<\/span><span style=\"color: #E1E4E8\">),<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;WARNING&quot;<\/span><span style=\"color: #E1E4E8\">),<\/span><span style=\"color: #9ECBFF\">&quot;2&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;CRITICAL&quot;<\/span><span style=\"color: #E1E4E8\">),<\/span><span style=\"color: #9ECBFF\">&quot;3&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;UNKNOWN&quot;<\/span><span style=\"color: #E1E4E8\">) <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">STATUS<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">FROM<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">servicegroup<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> SG<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">servicegroup_relation<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> SGR <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">SGR<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">servicegroup_sg_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">SG<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">sg_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> SVC <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">SVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">SGR<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_service_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_service_relation<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HSR <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HSR<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_service_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">SVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_ID<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HST <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">HSR<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_host_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon_storage<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">services<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> CSVC <\/span><span style=\"color: #F97583\">on<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">CSVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">SVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">WHERE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">SVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_activate<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">&#39;1&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">AND<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">SVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_register<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">AND<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">SVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_description<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">like<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;OS%process%snmp%&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">ORDER BY<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">SG<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">sg_name<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_name<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #79B8FF\">SVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_description<\/span><span style=\"color: #E1E4E8\">;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 id=\"resultat-4\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Resultat-4\"><\/span>R\u00e9sultat<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-table tableau-sql\"><table><thead><tr><th><strong>SERVICEGROUP<\/strong><\/th><th><strong>HOST<\/strong><\/th><th><strong>SERVICE<\/strong><\/th><th><strong>STATUS<\/strong><\/th><\/tr><\/thead><tbody><tr><td>SG_Centreon<\/td><td>Central-OMR-WEB1<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>OK<\/td><\/tr><tr><td>SG_Centreon<\/td><td>Central-OMR-WEB2<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>OK<\/td><\/tr><tr><td>SG_Centreon<\/td><td>Centreon-OMR-Database1<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>WARNING<\/td><\/tr><tr><td>SG_Centreon<\/td><td>Centreon-OMR-Database2<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>PENDING<\/td><\/tr><tr><td>SG_Centreon<\/td><td>communaute-omr.fr<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>CRITICAL<\/td><\/tr><tr><td>SG_Linux<\/td><td>Central-OMR-WEB1<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>OK<\/td><\/tr><tr><td>SG_Linux<\/td><td>Central-OMR-WEB2<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>OK<\/td><\/tr><tr><td>SG_Linux<\/td><td>Centreon-OMR-Database1<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>WARNING<\/td><\/tr><tr><td>SG_Linux<\/td><td>Centreon-OMR-Database2<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>PENDING<\/td><\/tr><tr><td>SG_Linux<\/td><td>communaute-omr.fr<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>CRITICAL<\/td><\/tr><tr><td>SG_Linux<\/td><td>Poller-2<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>WARNING<\/td><\/tr><tr><td>SG_Linux-Process<\/td><td>Central-OMR-WEB1<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>OK<\/td><\/tr><tr><td>SG_Linux-Process<\/td><td>Central-OMR-WEB2<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>OK<\/td><\/tr><tr><td>SG_Linux-Process<\/td><td>Centreon-OMR-Database1<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>WARNING<\/td><\/tr><tr><td>SG_Linux-Process<\/td><td>Centreon-OMR-Database2<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>PENDING<\/td><\/tr><tr><td>SG_Linux-Process<\/td><td>communaute-omr.fr<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>CRITICAL<\/td><\/tr><tr><td>SG_Linux-Process<\/td><td>Poller-2<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>WARNING<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h1 id=\"lister-letat-services-dans-un-hostgroup-2\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Lister_letat_services_dans_un_hostgroup-2\"><\/span>Lister l\u2019\u00e9tat services dans un hostgroup<span class=\"ez-toc-section-end\"><\/span><\/h1>\n\n\n\n<h2 id=\"schema-6\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Schema-6\"><\/span>Sch\u00e9ma<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/communaute-omr.fr\/wp-content\/uploads\/2026\/07\/image6-5.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2 id=\"analyse-6\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Analyse-6\"><\/span>Analyse<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">La d\u00e9marche reste la m\u00eame&nbsp;:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>On recherche les hostgroups actifs<\/li>\n\n\n\n<li>On recherche la relation entre la table hostgroup et la table host<\/li>\n\n\n\n<li>On recherche les services rattach\u00e9s aux h\u00f4tes<\/li>\n\n\n\n<li>On v\u00e9rifie que les services sont actifs<\/li>\n\n\n\n<li>On regarde enfin le status des services en parsant la valeur par une indication parlante<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Nous verrons dans un premier temps une requ\u00eate raccourcie qui ne v\u00e9rifie pas si les services sont bien actifs, du coup nous avons l\u2019historique des services d\u00e9sactiv\u00e9s et enfin THE requ\u00eate&nbsp;\ud83d\ude00<\/p>\n\n\n\n<h2 id=\"requete-6\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Requete-6\"><\/span>Requ\u00eate<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 id=\"version-courte\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Version_courte\"><\/span>Version courte<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro omr-terminal\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>SELECT DISTINCT\nHG.hg_name AS \"HOSTGROUP\",\nHST.host_name AS \"HOST\",\nCSVC.description AS \"SERVICE\",\nREPLACE(REPLACE(REPLACE(REPLACE(CSVC.state,\"0\",\"OK\"),\"1\",\"WARNING\"),\"2\",\"CRITICAL\"),\"3\",\"UNKNOWN\") AS STATUS\nFROM centreon.hostgroup AS HG\nLEFT JOIN centreon.hostgroup_relation AS HGR ON HGR.hostgroup_hg_id=HG.hg_id\nLEFT JOIN centreon.host AS HST ON HST.host_id=HGR.host_host_id\nLEFT JOIN centreon_storage.services AS CSVC ON CSVC.host_id=HST.host_id\nWHERE HST.host_activate=\"1\"\nAND CSVC.description like \"OS%process%snmp%\"\nORDER BY HG.hg_name, HST.host_name,CSVC.description;<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">SELECT DISTINCT<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">HG<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hg_name<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;HOSTGROUP&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_name<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;HOST&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">CSVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">description<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;SERVICE&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">CSVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">state<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;0&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;OK&quot;<\/span><span style=\"color: #E1E4E8\">),<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;WARNING&quot;<\/span><span style=\"color: #E1E4E8\">),<\/span><span style=\"color: #9ECBFF\">&quot;2&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;CRITICAL&quot;<\/span><span style=\"color: #E1E4E8\">),<\/span><span style=\"color: #9ECBFF\">&quot;3&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;UNKNOWN&quot;<\/span><span style=\"color: #E1E4E8\">) <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">STATUS<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">FROM<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hostgroup<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HG<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hostgroup_relation<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HGR <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HGR<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hostgroup_hg_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">HG<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hg_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HST <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">HGR<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_host_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon_storage<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">services<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> CSVC <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">CSVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">WHERE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_activate<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">AND<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">CSVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">description<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">like<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;OS%process%snmp%&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">ORDER BY<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HG<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hg_name<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_name<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #79B8FF\">CSVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">description<\/span><span style=\"color: #E1E4E8\">;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 id=\"version-complete\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Version_complete\"><\/span>Version compl\u00e8te<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro omr-terminal\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>SELECT DISTINCT\nHG.hg_name AS \"HOSTGROUP\",\nHST.host_name AS \"HOST\",\nCSVC.description AS \"SERVICE\",\nREPLACE(REPLACE(REPLACE(REPLACE(CSVC.state,\"0\",\"OK\"),\"1\",\"WARNING\"),\"2\",\"CRITICAL\"),\"3\",\"UNKNOWN\") AS STATUS\nFROM centreon.hostgroup AS HG\nLEFT JOIN centreon.hostgroup_relation AS HGR ON HGR.hostgroup_hg_id=HG.hg_id\nLEFT JOIN centreon.host AS HST ON HST.host_id=HGR.host_host_id\nLEFT JOIN centreon_storage.services AS CSVC ON CSVC.host_id=HST.host_id\nLEFT JOIN centreon.service AS SVC ON SVC.service_id=CSVC.service_id\nWHERE HST.host_activate=\"1\"\nAND CSVC.description like \"OS%process%snmp%\"\nAND SVC.service_activate=\"1\"\nORDER BY HG.hg_name, HST.host_name,CSVC.description;<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">SELECT DISTINCT<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">HG<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hg_name<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;HOSTGROUP&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_name<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;HOST&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">CSVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">description<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;SERVICE&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">REPLACE<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">CSVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">state<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;0&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;OK&quot;<\/span><span style=\"color: #E1E4E8\">),<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;WARNING&quot;<\/span><span style=\"color: #E1E4E8\">),<\/span><span style=\"color: #9ECBFF\">&quot;2&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;CRITICAL&quot;<\/span><span style=\"color: #E1E4E8\">),<\/span><span style=\"color: #9ECBFF\">&quot;3&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;UNKNOWN&quot;<\/span><span style=\"color: #E1E4E8\">) <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">STATUS<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">FROM<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hostgroup<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HG<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hostgroup_relation<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HGR <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HGR<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hostgroup_hg_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">HG<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hg_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HST <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">HGR<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_host_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon_storage<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">services<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> CSVC <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">CSVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">LEFT JOIN<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> SVC <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">SVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">CSVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">WHERE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_activate<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">AND<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">CSVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">description<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">like<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;OS%process%snmp%&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">AND<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">SVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_activate<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">&quot;1&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">ORDER BY<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HG<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hg_name<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_name<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #79B8FF\">CSVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">description<\/span><span style=\"color: #E1E4E8\">;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 id=\"resultat-5\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Resultat-5\"><\/span>R\u00e9sultat<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-table tableau-sql\"><table><thead><tr><th><strong>HOSTGROUP<\/strong><\/th><th><strong>HOST<\/strong><\/th><th><strong>SERVICE<\/strong><\/th><th><strong>STATUS<\/strong><\/th><\/tr><\/thead><tbody><tr><td>Centreon<\/td><td>Central-OMR-WEB1<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>OK<\/td><\/tr><tr><td>Centreon<\/td><td>Central-OMR-WEB2<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>UNKNOWN<\/td><\/tr><tr><td>Centreon<\/td><td>Centreon-OMR-Database1<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>WARNING<\/td><\/tr><tr><td>Centreon<\/td><td>Centreon-OMR-Database2<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>OK<\/td><\/tr><tr><td>Centreon<\/td><td>Poller-2<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>WARNING<\/td><\/tr><tr><td>Centreon_Cluster<\/td><td>Central-OMR-WEB1<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>OK<\/td><\/tr><tr><td>Centreon_Cluster<\/td><td>Central-OMR-WEB2<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>UNKNOWN<\/td><\/tr><tr><td>Centreon_Cluster<\/td><td>Centreon-OMR-Database1<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>WARNING<\/td><\/tr><tr><td>Centreon_Cluster<\/td><td>Centreon-OMR-Database2<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>OK<\/td><\/tr><tr><td>Centreon_Cluster<\/td><td>Poller-2<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>WARNING<\/td><\/tr><tr><td>Communaute-omr<\/td><td>communaute-omr.fr<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>CRITICAL<\/td><\/tr><tr><td>Pollers_LAN<\/td><td>Poller-2<\/td><td>OS-Linux-Process-snmpd-Status<\/td><td>WARNING<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h1 id=\"conclusion\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Nous venons de voir plusieurs fa\u00e7ons de requ\u00eater autour de centreon_storage.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Je n\u2019ai pas abord\u00e9 tous les cas de figures, ce serait trop long, le but \u00e9tant de faire comprendre le fonctionnement des relation entre les tables et les databases.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Avant-propos Il est important de comprendre que la database centreon_storage est la table du temps r\u00e9el. Toutes les donn\u00e9es affich\u00e9es dans la console en dehors des vues configuration et administration proviennent de cette database. Il y a un lien entre les databases centreon et centeon_storage ce sont les ID pour&nbsp;: Donc tous les vues temps r\u00e9el s\u2019appuient sur cette database en utilisant la dur\u00e9e de r\u00e9tention pour afficher l\u2019historique dans les diff\u00e9rentes vues. La structure de la database est sensiblement identique \u00e0 celle de centreon. Pour faire un raccourci dans la database centreon les tables sont au singulier et dans centreon-storage au pluriel. Ainsi par exemple les tables&nbsp;on peut faire les relations suivantes : centreon centreon_storage acl_group_contactgroups_relations centreon_acl host hosts hostgroup hostgroups host_service_relation &nbsp; host_template_relation&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[34,38,5,41,35,40],"tags":[],"class_list":["post-1431","post","type-post","status-publish","format-standard","hentry","category-base-de-donnees","category-bdd","category-centreon","category-interface","category-mysql","category-centreon_storage"],"_links":{"self":[{"href":"https:\/\/communaute-omr.fr\/index.php?rest_route=\/wp\/v2\/posts\/1431","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/communaute-omr.fr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/communaute-omr.fr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/communaute-omr.fr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/communaute-omr.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1431"}],"version-history":[{"count":6,"href":"https:\/\/communaute-omr.fr\/index.php?rest_route=\/wp\/v2\/posts\/1431\/revisions"}],"predecessor-version":[{"id":1443,"href":"https:\/\/communaute-omr.fr\/index.php?rest_route=\/wp\/v2\/posts\/1431\/revisions\/1443"}],"wp:attachment":[{"href":"https:\/\/communaute-omr.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1431"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/communaute-omr.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1431"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/communaute-omr.fr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}