{"id":18497694,"url":"https://github.com/centreon/centreon-dummy","last_synced_at":"2026-01-17T07:46:29.878Z","repository":{"id":44223717,"uuid":"55161851","full_name":"centreon/centreon-dummy","owner":"centreon","description":"A dummy module in order to explain how to create your own module","archived":true,"fork":false,"pushed_at":"2023-03-15T05:19:23.000Z","size":1528,"stargazers_count":4,"open_issues_count":5,"forks_count":3,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-03-02T22:43:56.390Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/centreon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-31T15:32:40.000Z","updated_at":"2024-12-26T11:30:06.000Z","dependencies_parsed_at":"2024-11-06T18:16:24.837Z","dependency_job_id":null,"html_url":"https://github.com/centreon/centreon-dummy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centreon%2Fcentreon-dummy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centreon%2Fcentreon-dummy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centreon%2Fcentreon-dummy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centreon%2Fcentreon-dummy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/centreon","download_url":"https://codeload.github.com/centreon/centreon-dummy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247949671,"owners_count":21023366,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T13:35:23.727Z","updated_at":"2026-01-17T07:46:29.864Z","avatar_url":"https://github.com/centreon.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Centreon Dummy Module\n\nA dummy module in order to explain how to create your own module\n\n## Quick Start :rocket:\n\n```shell\ncp -R www/modules/dummy /usr/share/centreon/www/modules/dummy\nchown -R apache. /usr/share/centreon/www/modules/dummy\n\ncp -R backend/config /usr/share/centreon/config\ncp -R backend/src /usr/share/centreon/src\nsu - apache -s /bin/bash -c \"/usr/share/centreon/bin/console cache:clear\"\n\ncd frontend\nnpm install # or npm install --legacy-peer-deps if you are using npm v7\nnpm run build\nrm -rf /usr/share/centreon/www/modules/dummy/static\ncp -R www/modules/dummy/static /usr/share/centreon/www/modules/dummy/static\n```\n\nThen, go to the Centreon UI in `Administration \u003e Extensions \u003e Manager` and install the dummy extension.\n\nA new counter will appear in the top bar, and a new menu is accessible in `Home \u003e Dummy Menu Entry`\n\n## Installation :pick:\n\nCurrently, Centreon modules are stored in `/usr/share/centreon/www/modules/\u003cmodule_name\u003e`.\nSo, to use this dummy module, copy the module folder in the proper folder :\n```shell\ncp -R www/modules/dummy /usr/share/centreon/www/dummy\nchown -R apache. /usr/share/centreon/www/dummy\n```\n\nModule configuration can be updated in `www/modules/dummy/conf.php`.\nThis file is properly commented to know how to fill it.\nMain properties are the name and the version (mod_release).\n\nIf you need to manipulate the database during module installation or deletion, you can insert directly the queries in the following files :\n* **www/modules/dummy/sql/install.sql**\n* **www/modules/dummy/sql/uninstall.sql**\n\nIf you need to do advanced manipulation during module installation or deletion, you can write php script in the following files :\n* **www/modules/dummy/php/install.php**\n* **www/modules/dummy/php/uninstall.php**\n\n## Frontend :sparkles:\n\nFrontend code is stored in `www/modules/dummy/react` folder.\n  \u003e :memo: You have to install NodeJS 16\n\nDependencies can be installed using following command :\n```shell\nnpm ci\n# or\nnpm ci --legacy-peer-deps\n```\n\nFrontend components can be built using following command :\n```shell\nnpm run build # production build\nnpm run start:dev # development build with watch mode\n```\n\nDon't forget to run ESLint\n```shell\nnpm run eslint:fix\n```\n\nThere are two concepts in Centreon to integrate module frontend :\n* **Page**\n* **Hook**\n\nEach of those concepts corresponds to a React component.\nCentreon Web will load dynamically those components using [systemjs](https://github.com/systemjs/systemjs).\n\nYou can include your own dependencies in package.json and use it in your components.\nThere are no limitation, cause your react component will be managed as a totally separated bundle.\n\n### Page :page_facing_up:\n\nA page is used to integrate a module page to as react component to centreon-web.\n\nThe directory structure corresponds to the page route.\nExample: `/usr/share/centreon/www/modules/dummy/static/pages/home/dummy/index.js` will be accessible on following route : `\u003ccentreon_url\u003e/home/dummy`\n\nwebpack file contains already a configuration to build a hook : https://github.com/centreon/centreon-dummy/blob/master/frontend/webpack.config.js#L16\n\nIf you want the page to be accessible using left menu, you need to insert topology in database.\nAn example is given here : https://github.com/centreon/centreon-dummy/blob/master/www/modules/dummy/sql/install.sql#L7-L8\n* **topology_name** : menu entry\n* **topology_parent** : parent menu (1 = home, 2 = monitoring, 3 = reporting, 5 = admnistration, 6 = configuration)\n* **topology_page** : page number (must be unique, contain 3 numbers and should begin by the number of its parent. ex: 111 if the parent is home)\n* **topology_order** : page priority (if the entry will be at the top or bottom when opening the menu)\n* **topology_group** : menu group (sublevel menus can be grouped)\n* **topology_url** : route url (ex: /home/dummy)\n* **topology_url_opt** : optional query parameters (not especially used)\n\n![Listing](/doc/images/listing.png)\n\n### Hook :magnet:\n\nA hook is used to integrate a react component in a specific location of centreon-web.\nCurrently, the only available location is the top counter.\n\nTo do this, you need to build a js file inside following directory : `/usr/share/centreon/www/modules/dummy/static/hooks/header/topCounter/`\nwebpack file contains already a configuration to build a hook : https://github.com/centreon/centreon-dummy/blob/master/frontend/webpack.config.js#L17\n\n![Top Counter](/doc/images/top_counter.png)\n\n## Backend :gear:\n\nBackend code used to generate api is stored in `backend` folder.\nThe framework which is used is Symfony. Please refer to the [documentation](https://symfony.com/doc/current/index.html) to get more explanation about configuration and implementation.\n\n`backend/config` files contain configuration files to manage :\n* global configuration : `backend/config/packages/prod/CentreonDummy.yaml` (extensions, autoload, dependency injection...)\n* serialization : `backend/config/packages/serializer/CentreonDummy/` (used in Controller to serialize data before sending response)\n* api routes : `backend/config/routes/CentreonDummy.yaml`\n  \u003e :warning: routes are linked to the file `www/modules/dummy/routes/CentreonDummy.yaml`\n  \u003e\n  \u003e during module installation, content of `www/modules/dummy/routes/CentreonDummy.yaml.wait` is copied to `www/modules/dummy/routes/CentreonDummy.yaml` in order to add the new routes to the configuration\n\nBackend configuration files must be copied to `/usr/share/centreon/config`.\n\n\u003e :warning: when configuration files are updated on Centreon server, it is mandatory to reload symfony cache :\n\u003e ```shell\n\u003e su - apache -s /bin/bash -c \"/usr/share/centreon/bin/console cache:clear\"\n\u003e ```\n\n`backend/src` files contain api implementation :\n* controllers which are the entrypoints of the api : `backend/src/CentreonDummy/Application/Controller/DummyController.php`\n* services which are called by the controller and contain the business logic : `backend/src/CentreonDummy/Domain/*`\n* repositories which interact with external components like the database : `backend/src/CentreonDummy/Infrastructure/DummyRepositoryRDB.php`\n\nBackend source files must be copied to `/usr/share/centreon/src`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcentreon%2Fcentreon-dummy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcentreon%2Fcentreon-dummy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcentreon%2Fcentreon-dummy/lists"}