{"id":1213,"date":"2026-07-25T09:03:08","date_gmt":"2026-07-25T07:03:08","guid":{"rendered":"https:\/\/communaute-omr.fr\/?p=1213"},"modified":"2026-07-25T09:49:28","modified_gmt":"2026-07-25T07:49:28","slug":"relation-entres-les-tables-de-service-2","status":"publish","type":"post","link":"https:\/\/communaute-omr.fr\/?p=1213","title":{"rendered":"Relation entres les tables d&rsquo;h\u00f4tes"},"content":{"rendered":"\n<h1 id=\"convention\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Convention\"><\/span>Convention<span class=\"ez-toc-section-end\"><\/span><\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Le mot cl\u00e9 \u00ab&nbsp;distinct&nbsp;\u00bb sera utilis\u00e9 dans les requ\u00eates pour \u00e9viter les lignes en doublons<\/p>\n\n\n\n<h1 id=\"les-tables-en-presence\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Les_tables_en_presence\"><\/span>Les tables en pr\u00e9sence<span class=\"ez-toc-section-end\"><\/span><\/h1>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Tables<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>host<\/td><td>Liste les h\u00f4tes et leur templates <\/td><\/tr><tr><td>host _categories<\/td><td>Liste les cat\u00e9gories d\u2019h\u00f4tes<\/td><\/tr><tr><td>host _categories_relation<\/td><td>Relation entre les tables service et host_categories<\/td><\/tr><tr><td>hostgroup<\/td><td>Liste les groupes d\u2019h\u00f4tes<\/td><\/tr><tr><td>hostgroup_relation<\/td><td>Relation entre les tables hostgroup et hostgroup_relation<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h1 id=\"les-hosts\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Les_hosts\"><\/span>Les hosts<span class=\"ez-toc-section-end\"><\/span><\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Nous allons commencer par le d\u00e9but&nbsp;: Lister les hosts de la plateforme<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Comme pour les services le champ register d\u00e9termine si nous avons \u00e0 faire \u00e0 un template ou non.<\/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<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 host_name,\n  host_alias,\n  host_address\nFROM centreon.host\nWHERE host_register=\"1\"\nAND 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\"> host_name,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  host_alias,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  host_address<\/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>\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 style=\"color: #E1E4E8\">;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<!--more-->\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><strong>host_name<\/strong><\/th><th><strong>host_alias<\/strong><\/th><th><strong>host_address<\/strong><\/th><\/tr><\/thead><tbody><tr><td> Central-Centreon         <\/td><td> Central avec Templating Centreon<\/td><td> 192.168.12.110 <\/td><\/tr><tr><td> Central-OMR-WEB1         <\/td><td> Serveur Web 1 du cluster centreon <\/td><td> 192.168.12.110 <\/td><\/tr><tr><td> Poller-2                 <\/td><td> Poller-2                          <\/td><td> 192.168.12.121 <\/td><\/tr><tr><td> Centreon-OMR-Database1   <\/td><td> Centreon-OMR-Database1            <\/td><td> 192.168.12.111 <\/td><\/tr><tr><td> communaute-omr.fr        <\/td><td>Portail de la communaut\u00e9<\/td><td> 192.168.12.100 <\/td><\/tr><tr><td> Centreon-OMR-central-VIP <\/td><td> Vip Centreon WEB                  <\/td><td> 192.168.12.150 <\/td><\/tr><tr><td> Centreon-OMR-DB-VIP      <\/td><td> Vip Centreon DB                   <\/td><td> 192.168.12.151 <\/td><\/tr><tr><td> Central-OMR-WEB2         <\/td><td> Serveur Web 2 du cluster centreon <\/td><td> 192.168.12.210 <\/td><\/tr><tr><td> Centreon-OMR-Database2   <\/td><td> Serveur Mariadb 2 pour le cluster <\/td><td> 192.168.12.211 <\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h1 id=\"les-hosttemplates\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Les_HostTemplates\"><\/span>Les HostTemplates<span class=\"ez-toc-section-end\"><\/span><\/h1>\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 host_name,\n  host_alias\nFROM centreon.host\nwhere host_register=\"0\"\nAND host_activate=\"1\"\nAND (host_name like \"%Centreon%\" OR host_name like \"%Linux%\")\nORDER BY 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\"> host_name,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  host_alias<\/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>\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;0&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\">&quot;1&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">AND<\/span><span style=\"color: #E1E4E8\"> (host_name <\/span><span style=\"color: #F97583\">like<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;%Centreon%&quot;<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">OR<\/span><span style=\"color: #E1E4E8\"> host_name <\/span><span style=\"color: #F97583\">like<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;%Linux%&quot;<\/span><span style=\"color: #E1E4E8\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">ORDER BY<\/span><span style=\"color: #E1E4E8\"> host_name;<\/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>host_name<\/strong><\/th><th><strong>host_alias<\/strong><\/th><\/tr><\/thead><tbody><tr><td> OS-Windows-Centreon-Monitoring-Agent-custom            <\/td><td> Windows server monitored using the Centreon Monitoring Agent                             <\/td><\/tr><tr><td> TH_App-Jvm-Centreon-Map-Engine                         <\/td><td> Template to monitor Centreon Map Engine using Actuator                                   <\/td><\/tr><tr><td> TH_App-Monitoring-Centreon-Central                     <\/td><td> Template to check Centreon Central Server                                                <\/td><\/tr><tr><td> TH_App-Monitoring-Centreon-Database                    <\/td><td> Template to check Centreon Database Server                                               <\/td><\/tr><tr><td> TH_App-Monitoring-Centreon-HA-Cluster-Node             <\/td><td> App-Monitoring-Centreon-HA-Cluster-Node                                                  <\/td><\/tr><tr><td> TH_App-Monitoring-Centreon-HA-VIP-DB                   <\/td><td>Template to check VIP DB Cluster centreon<\/td><\/tr><tr><td> TH_App-Monitoring-Centreon-HA-VIP-WEB                  <\/td><td>Template to check VIP WEB Cluster centreon<\/td><\/tr><tr><td> TH_App-Monitoring-Centreon-MBI                         <\/td><td> Template to check centreon MBI reporting server                                          <\/td><\/tr><tr><td> TH_App-Monitoring-Centreon-Poller                      <\/td><td> Template to check Centreon Poller Server                                                 <\/td><\/tr><tr><td> TH_App-Monitoring-Centreon-SQL-Metrics                 <\/td><td> Template to check Centreon SQL advanced metrics                                          <\/td><\/tr><tr><td> TH_OS-Linux-SNMP                                       <\/td><td> Template to check Linux server using SNMP protocol                                       <\/td><\/tr><tr><td> TH_OS-Linux-SNMPv3                                     <\/td><td> Template to check Linux server using SNMP protocol v3                                    <\/td><\/tr><tr><td> TH_OS-Linux-SSH                                        <\/td><td> Template to check Linux server using SSH protocol                                        <\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h1 id=\"relation-host-hosttemplate\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Relation_HostHostTemplate\"><\/span>Relation Host\/HostTemplate<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-11.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\">Pour avoir ces informations nous pouvons avoir 3 approches&nbsp;:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Depuis la table des h\u00f4tes<\/li>\n\n\n\n<li>Recherche depuis les h\u00f4tes avec le champ host_register=\u20191\u2019<\/li>\n\n\n\n<li>Recherche depuis les templates avec le champ host_register=\u20190\u2019<\/li>\n\n\n\n<li>Depuis la table des relations<\/li>\n<\/ul>\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<h3 id=\"recherche-depuis-les-hotes\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Recherche_depuis_les_hotes\"><\/span>Recherche depuis les h\u00f4tes<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,\n  HTPL.host_name AS Template\nFROM centreon.host as HST\nLEFT JOIN centreon.host_template_relation AS HTR ON HTR.host_host_id=HST.host_id\nLEFT JOIN centreon.host as HTPL ON HTPL.host_id=HTR.host_tpl_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\"> Host,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  <\/span><span style=\"color: #79B8FF\">HTPL<\/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\"> Template<\/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<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_template_relation<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HTR <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HTR<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_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\">host<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">as<\/span><span style=\"color: #E1E4E8\"> HTPL <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HTPL<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">HTR<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_tpl_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<h3 id=\"recherche-depuis-les-templates\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Recherche_depuis_les_templates\"><\/span>Recherche depuis les templates<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,\n  HTPL.host_name AS Host\nFROM centreon.host as HTPL\nLEFT JOIN centreon.host_template_relation AS HTR ON HTR.host_tpl_id=HTPL.host_id\nLEFT JOIN centreon.host AS HST ON HTR.host_host_id=HST.host_id\nWHERE HTPL.host_register=\"0\"\nAND HTPL.host_activate=\"1\"\nAND HST.host_register=\"1\"\nORDER BY HST.host_name,HTPL.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\">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: #E1E4E8\">  <\/span><span style=\"color: #79B8FF\">HTPL<\/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: #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\"> HTPL<\/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_template_relation<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HTR <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HTR<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_tpl_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">HTPL<\/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\">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\">HTR<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_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\">HTPL<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_register<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">&quot;0&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">AND<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HTPL<\/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\">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\">HTPL<\/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<h3 id=\"recherche-depuis-les-relations\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Recherche_depuis_les_relations\"><\/span>Recherche depuis les relations<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,\n  HTPL.host_name AS Host\nFROM centreon.host_template_relation AS HTR\nLEFT JOIN centreon.host AS HTPL ON HTR.host_tpl_id=HTPL.host_id\nLEFT JOIN centreon.host AS HST ON HTR.host_host_id=HST.host_id\nWHERE HTPL.host_register=\"0\"\nAND HTPL.host_activate=\"1\"\nAND HST.host_register=\"1\"\nORDER BY HST.host_name,HTPL.host_name\u00a0;<\/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\"> HOST,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  <\/span><span style=\"color: #79B8FF\">HTPL<\/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: #F97583\">FROM<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">centreon<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_template_relation<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HTR<\/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\"> HTPL <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HTR<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_tpl_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">HTPL<\/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\">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\">HTR<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_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\">HTPL<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_register<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">&quot;0&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">AND<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HTPL<\/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\">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\">HTPL<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_name<\/span><span style=\"color: #E1E4E8\">\u00a0;<\/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>host<\/strong><\/th><th><strong>Template<\/strong><\/th><\/tr><\/thead><tbody><tr><td>Central-Centreon<\/td><td>App-Monitoring-Centreon-Central-custom<\/td><\/tr><tr><td>Central-Centreon<\/td><td>OS-Linux-SNMP-custom<\/td><\/tr><tr><td>Central-OMR<\/td><td>TH_App-Monitoring-Centreon-Central<\/td><\/tr><tr><td>Central-OMR<\/td><td>TH_App-Webserver-Apache-ServerStatus<\/td><\/tr><tr><td>Central-OMR<\/td><td>TH_OS-Linux-SNMP<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>TH_App-DB-MySQL<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>TH_OS-Linux-SNMP<\/td><\/tr><tr><td>communaute-omr.fr<\/td><td>TH_App-Webserver-Apache-ServerStatus<\/td><\/tr><tr><td>communaute-omr.fr<\/td><td>TH_OS-Linux-SNMP<\/td><\/tr><tr><td>Poller-1<\/td><td>generic-active-host-custom<\/td><\/tr><tr><td>Poller-2<\/td><td>TH_App-Monitoring-Centreon-Poller<\/td><\/tr><tr><td>Poller-2<\/td><td>TH_OS-Linux-SNMP<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h1 id=\"relation-host-service\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Relation_HostService\"><\/span>Relation Host\/Service<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-10.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 la relation entre les h\u00f4tes et les services&nbsp;:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Nous voyons que la table host_service_relation est au centreon de la jointure&nbsp;:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>host.host_id= host_service_relation.host_host_id<\/li>\n\n\n\n<li>host_service_relation.service_service_id=service.service_id<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Il est important de noter que cette relation est valable oussi bien pour les h\u00f4tes que pour les Templates.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Il suffira donc de placer le flag register (host ou service) \u00e0 0 ou 1 pour d\u00e9terminer  le but de la requete<\/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<h3 id=\"vision-depuis-les-services\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Vision_depuis_les_services\"><\/span>Vision depuis les services<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,\n  HST.host_address,\n  SVC.service_description\nFROM centreon.service AS SVC\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\nWHERE HST.host_register=\"1\"\nAND HST.host_activate=\"1\"\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 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>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_address<\/span><span style=\"color: #E1E4E8\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  <\/span><span style=\"color: #79B8FF\">SVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_description<\/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\">service<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> SVC<\/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\">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>\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<h3 id=\"vision-depuis-les-hotes\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Vision_depuis_les_hotes\"><\/span>Vision depuis les h\u00f4tes<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,\n  HST.host_address,\n  SVC.service_description\nFROM centreon.host AS HST\nLEFT JOIN centreon.host_service_relation AS HSR ON HSR.host_host_id=HST.host_id\nLEFT JOIN centreon.service AS SVC ON SVC.service_id=HSR.service_service_id\nWHERE HST.host_register=\"1\"\nAND HST.host_activate=\"1\"\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 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>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  <\/span><span style=\"color: #79B8FF\">HST<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_address<\/span><span style=\"color: #E1E4E8\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  <\/span><span style=\"color: #79B8FF\">SVC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_description<\/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<\/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\">host_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\">HSR<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">service_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\">&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\">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-partiel\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Resultat_partiel\"><\/span>R\u00e9sultat partiel<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>host_address<\/strong><\/th><th><strong>service_description<\/strong><\/th><\/tr><\/thead><tbody><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>App-Monitoring-Centreon-Broker-module-Stats<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>App-Monitoring-Centreon-Broker-RRD-Stats-Central<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>App-Monitoring-Centreon-Broker-SQL-Stats-Central<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>App-Monitoring-Centreon-Process-broker-rrd<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>App-Monitoring-Centreon-Process-broker-sql<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>App-Monitoring-Centreon-Process-cbd<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>App-Monitoring-Centreon-Process-centengine<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>App-Monitoring-Centreon-Process-gorgoned<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>App-Webserver-Apache-Content-Status<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>App-Webserver-Apache-Cpuload<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>App-Webserver-Apache-Process-httpd-Stats<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>App-Webserver-Apache-Process-httpd-Status<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>App-Webserver-Apache-ResponseTime<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>App-Webserver-Apache-SlotStates<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>App-Webserver-Apache-Workers<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>OS-Linux-Disk-\/-Usage<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>OS-Linux-Disk-\/home-Usage<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>OS-Linux-Process-crond-Status<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>OS-Linux-Process-ntpd-Status<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>OS-Linux-Process-snmpd-Status<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>OS-Linux-Process-sshd-Status<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>OS-Linux-SYS-CPU<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>OS-Linux-SYS-CPU-Detailed<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>OS-Linux-SYS-Load<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>OS-Linux-SYS-Memory<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>OS-Linux-SYS-NTP<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>OS-Linux-SYS-Swap<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>OS-Linux-SYS-Uptime<\/td><\/tr><tr><td>Central-OMR<\/td><td>192.168.12.110<\/td><td>Ping<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>App-DB-MySQL-Connection-Time<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>App-DB-MySQL-Connections-Number<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>App-DB-MySQL-Database-Size<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>App-DB-MySQL-Long-Queries<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>App-DB-Mysql-Process-mysqld-Status<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>App-DB-MySQL-Slowqueries<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>App-DB-MySQL-Uptime<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>OS-Linux-Disk-\/-Usage<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>OS-Linux-Disk-\/home-Usage<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>OS-Linux-Disk-\/var\/lib\/mysql-Usage<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>OS-Linux-Disk-\/var\/log\/mysql-Usage<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>OS-Linux-Process-crond-Status<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>OS-Linux-Process-ntpd-Status<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>OS-Linux-Process-snmpd-Status<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>OS-Linux-Process-sshd-Status<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>OS-Linux-SYS-CPU<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>OS-Linux-SYS-CPU-Detailed<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>OS-Linux-SYS-Load<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>OS-Linux-SYS-Memory<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>OS-Linux-SYS-NTP<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>OS-Linux-SYS-Swap<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>OS-Linux-SYS-Uptime<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>192.168.12.111<\/td><td>Ping<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h1 id=\"relation-host-hostgroups\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Relation_HostHostGroups\"><\/span>Relation Host\/HostGroups<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-4.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\">Le sch\u00e9ma ci-dessus nous montre la relation entre les services et templates de service&nbsp;:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Comme indiqu\u00e9 ci-dessus il n\u2019y a pas de table de relation entre les services et ses<\/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<h3 id=\"vision-depuis-la-table-host\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Vision_depuis_la_table_host\"><\/span>Vision depuis la table host<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 HG.hg_name AS HOSTGROUP,\nHG.hg_alias AS DESCRIPTION,\nHST.host_name AS HOST\nFROM centreon.host AS HST\nLEFT JOIN centreon.hostgroup_relation AS HGR ON HGR.host_host_id=HST.host_id\nLEFT JOIN centreon.hostgroup AS HG ON HG.hg_id=HGR.hostgroup_hg_id\nWHERE HST.host_activate=\"1\"\nAND HST.host_register=\"1\"\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\">HG<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hg_alias<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">DESCRIPTION<\/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\"> HOST<\/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<\/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\">host_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\">hostgroup<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HG <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HG<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hg_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">HGR<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hostgroup_hg_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\">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><\/code><\/pre><\/div>\n\n\n\n<h3 id=\"vision-depuis-la-table-hostgroup\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Vision_depuis_la_table_hostgroup\"><\/span>Vision depuis la table hostgroup<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 HG.hg_name AS HOSTGROUP,\nHG.hg_alias AS DESCRIPTION,\nHST.host_name AS HOST\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\nWHERE HST.host_activate=\"1\"\nAND HST.host_register=\"1\"\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\">HG<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hg_alias<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">DESCRIPTION<\/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\"> HOST<\/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\">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\">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><\/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>HOSTGROUP<\/strong><\/th><th><strong>DESCRIPTION<\/strong><\/th><th><strong>HOST<\/strong><\/th><\/tr><\/thead><tbody><tr><td>Centreon<\/td><td>Serveurs centreon <\/td><td>Central-OMR-WEB1 <\/td><\/tr><tr><td>Centreon<\/td><td>Serveurs centreon <\/td><td>Central-OMR-WEB2 <\/td><\/tr><tr><td>Centreon<\/td><td>Serveurs centreon <\/td><td>Centreon-OMR-Database1 <\/td><\/tr><tr><td>Centreon <\/td><td>Serveurs centreon <\/td><td>Centreon-OMR-Database2 <\/td><\/tr><tr><td>Centreon <\/td><td>Serveurs centreon <\/td><td>Poller-1 <\/td><\/tr><tr><td>Centreon <\/td><td>Serveurs centreon <\/td><td>Poller-2 <\/td><\/tr><tr><td>Centreon_Cluster<\/td><td>Serveurs du cluster Centreon <\/td><td>Central-OMR-WEB1 <\/td><\/tr><tr><td>Centreon_Cluster<\/td><td>Serveurs du cluster Centreon <\/td><td>Central-OMR-WEB2 <\/td><\/tr><tr><td>Centreon_Cluster<\/td><td>Serveurs du cluster Centreon <\/td><td>Centreon-OMR-WEB-VIP <\/td><\/tr><tr><td>Centreon_Cluster<\/td><td>Serveurs du cluster Centreon <\/td><td>Centreon-OMR-Database1 <\/td><\/tr><tr><td>Centreon_Cluster<\/td><td>Serveurs du cluster Centreon <\/td><td>Centreon-OMR-Database2 <\/td><\/tr><tr><td>Centreon_Cluster<\/td><td>Serveurs du cluster Centreon <\/td><td>Centreon-OMR-DB-VIP <\/td><\/tr><tr><td>Communaute-omr  <\/td><td>Portail de la communaute     <\/td><td>communaute-omr.fr <\/td><\/tr><tr><td>Pollers_LAN<\/td><td>Pollers Centreon LAN      <\/td><td>Poller-2 <\/td><\/tr><tr><td>Pollers_WAN<\/td><td>Poller centreon WAN<\/td><td>Poller-1<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h1 id=\"relation-host-hostcategories\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Relation_HostHostCategories\"><\/span>Relation Host\/HostCategories<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-4.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\">Le sch\u00e9ma ci-dessus nous montre la relation entre la table host et hostgategories&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Le lien entre les tables se fera via les ID stock\u00e9s dans la table hostcategories_relation<\/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=\"vision-depuis-la-table-host-2\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Vision_depuis_la_table_host-2\"><\/span>Vision depuis la table host<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,\nHC.hc_name AS HOSTCATEGORY\nFROM centreon.host AS HST\nLEFT JOIN centreon.hostcategories_relation AS HCR ON HCR.host_host_id=HST.host_id\nLEFT JOIN centreon.hostcategories AS HC ON HC.hc_id=HCR.hostcategories_hc_id\nWHERE HST.host_activate=\"1\"\nAND HST.host_register=\"1\"\nORDER BY HC.hc_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\">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\">HC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hc_name<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HOSTCATEGORY<\/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<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hostcategories_relation<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HCR <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HCR<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_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\">hostcategories<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HC <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hc_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">HCR<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hostcategories_hc_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\">ORDER BY<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hc_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<h3 id=\"vision-depuis-la-table-hostcategories\" class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Vision_depuis_la_table_hostcategories\"><\/span>Vision depuis la table hostcategories<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,\nHC.hc_name AS HOSTCATEGORY\nFROM centreon.hostcategories AS HC\nLEFT JOIN centreon.hostcategories_relation AS HCR ON HCR.hostcategories_hc_id=HC.hc_id\nLEFT JOIN centreon.host AS HST ON HST.host_id=HCR.host_host_id\nWHERE HST.host_activate=\"1\"\nAND HST.host_register=\"1\"\nORDER BY HC.hc_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\">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\">HC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hc_name<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HOSTCATEGORY<\/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\">hostcategories<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HC<\/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\">hostcategories_relation<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">AS<\/span><span style=\"color: #E1E4E8\"> HCR <\/span><span style=\"color: #F97583\">ON<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HCR<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hostcategories_hc_id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">HC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hc_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\">HCR<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">host_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\">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\">ORDER BY<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">HC<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">hc_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-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>HOST<\/strong><\/th><th><strong>HOSTCATEGORY<\/strong><\/th><\/tr><\/thead><tbody><tr><td>Central-OMR-WEB1<\/td><td>HC_Centreon<\/td><\/tr><tr><td>Central-OMR-WEB2<\/td><td>HC_Centreon<\/td><\/tr><tr><td>Poller-2<\/td><td>HC_Centreon<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>HC_Centreon-DB<\/td><\/tr><tr><td>Centreon-OMR-Database2<\/td><td>HC_Centreon-DB<\/td><\/tr><tr><td>Central-OMR-WEB1<\/td><td>HC_Centreon-Master<\/td><\/tr><tr><td>Centreon-OMR-Database1<\/td><td>HC_Centreon-Master<\/td><\/tr><tr><td>Central-OMR-WEB2<\/td><td>HC_Centreon-Slave<\/td><\/tr><tr><td>Centreon-OMR-Database2<\/td><td>HC_Centreon-Slave<\/td><\/tr><tr><td>Centreon-OMR-central-VIP<\/td><td>HC_Centreon-VIP<\/td><\/tr><tr><td>Centreon-OMR-DB-VIP<\/td><td>HC_Centreon-VIP<\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Convention Le mot cl\u00e9 \u00ab&nbsp;distinct&nbsp;\u00bb sera utilis\u00e9 dans les requ\u00eates pour \u00e9viter les lignes en doublons Les tables en pr\u00e9sence Tables Description host Liste les h\u00f4tes et leur templates host _categories Liste les cat\u00e9gories d\u2019h\u00f4tes host _categories_relation Relation entre les tables service et host_categories hostgroup Liste les groupes d\u2019h\u00f4tes hostgroup_relation Relation entre les tables hostgroup et hostgroup_relation Les hosts Nous allons commencer par le d\u00e9but&nbsp;: Lister les hosts de la plateforme Comme pour les services le champ register d\u00e9termine si nous avons \u00e0 faire \u00e0 un template ou non. Requ\u00eate<\/p>\n","protected":false},"author":3,"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":[38,39],"tags":[],"class_list":["post-1213","post","type-post","status-publish","format-standard","hentry","category-bdd","category-bdd-centreon"],"_links":{"self":[{"href":"https:\/\/communaute-omr.fr\/index.php?rest_route=\/wp\/v2\/posts\/1213","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\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/communaute-omr.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1213"}],"version-history":[{"count":9,"href":"https:\/\/communaute-omr.fr\/index.php?rest_route=\/wp\/v2\/posts\/1213\/revisions"}],"predecessor-version":[{"id":1233,"href":"https:\/\/communaute-omr.fr\/index.php?rest_route=\/wp\/v2\/posts\/1213\/revisions\/1233"}],"wp:attachment":[{"href":"https:\/\/communaute-omr.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/communaute-omr.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/communaute-omr.fr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}