Ad Widget

Collapse

Frontend module for integrated web page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • markfree
    Senior Member
    • Apr 2019
    • 868

    #1

    Frontend module for integrated web page

    Internally, I have instances of Zabbix for different areas.
    Sometimes there is specific documentation created for these Zabbix instances and these docs are often created on an internal GitLab.

    To make the information more accessible, I tried to publish it within the Zabbix frontend.
    I tried to use the official frontend module tutorial to integrate PicoCMS into Zabbix, but the problem is that I'm not good with PHP.

    So, has anyone ever created a module that could publish some extra data from the Zabbix frontend?
    Last edited by markfree; 11-10-2023, 17:15.
  • dimir
    Zabbix developer
    • Apr 2011
    • 1080

    #2
    Would this help? https://youtu.be/cdkjmIPRkXk?t=110

    The module from the presentation: https://github.com/dimir/zabbix-exte.../my-address​

    Comment

    • markfree
      Senior Member
      • Apr 2019
      • 868

      #3
      Here's what I've came up with so far.

      The steps I took:

      1. Created a directory inside `/usr/share/zabbix/modules`.
      Code:
      $ cd /usr/share/zabbix/modules/
      $ sudo mkdir test_doc
      2. Created the manifest file inside the new directory.
      Code:
      $ cat test_doc/manifest.json
      {
      "manifest_version": 2.0,
      "id": "test_doc",
      "name": "Test Doc",
      "namespace": "testdoc",
      "version": "1.0",
      "author": "diasdm",
      "description": "Basic Markdown documentation",
      "url": "https://github.com/diasdmhub"
      }
      3. Downloaded PicoCMS and extracted it inside the `test_doc` directory.
      Code:
      $ cd test_doc/
      $ sudo tar -xzf ../pico-release-v2.1.4.tar.gz
      4. Created a `Module.php` file in the root of the module. That created a new menu item called 'Test Doc'.
      Code:
      $ cat Module.php
      <?php
      namespace Modules\testdoc;
      use Zabbix\Core\CModule,
      APP,
      CMenuItem;
      class Module extends CModule {
      public function init(): void {
      $menuItem = new CMenuItem(_('Test Doc'));
      $menuItem->setAction('open_test_doc');
      $menuItem->setTarget('/usr/share/zabbix/modules/test_doc/index.php');
      APP::Component()->get('menu.main')
      ->add($menuItem);
      }
      }
      When I click on the new item, I get a "page not found" error. And that's it.

      I tried to adapt those actions and views from the "my-address" example, but could not make sense of them.
      The final action I wanted to achieve was to open PicoCMS index and let it run it's engine, but all within the Zabbix frontend.

      I'm not sure if this would be a good option, but for the sake of experimentation...
      You see... I mainly wanted to integrate this tittle CMS into Zabbix's frontend to take advantage of Zabbix's login feature.
      Last edited by markfree; 12-10-2023, 01:36.

      Comment


      • markfree
        markfree commented
        Editing a comment
        The forum text editor broke the code indentation.
    • tim.mooney
      Senior Member
      • Dec 2012
      • 1427

      #4
      My first thought was that maybe the default Zabbix http config wasn't including /usr/share/zabbix/modules in the list of directories where .php (and .phar) files would be proxied to the PHP-FPM backend. But that guess was wrong (at least for the Apache httpd zabbix.conf), PHP should work for /usr/share/zabbix/modules by default, with no config changes needed.

      If you increase your web server's log level temporarily, do you get anything useful in either the access log or error log? It doesn't sound like the error is even getting as far as PHP, but is there anything in your PHP or zabbix pool's logs?

      Comment

      • cyber
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2006
        • 4806

        #5
        Originally posted by markfree

        You see... I mainly wanted to integrate this tittle CMS into Zabbix's frontend to take advantage of Zabbix's login feature.
        I am not much of a coder, but I seriously doubt this module would automatically forward any entered username/password... It would need modification to CMS code to work with zabbix logins...

        Comment


        • markfree
          markfree commented
          Editing a comment
          Me neither.
      • gcalenko
        Zabbix developer
        • Mar 2017
        • 27

        #6
        As far as i know PicoCMS do not use any authentication because content is managed manually editing markdown files. Do you use some additional extensions for PicoCMS?
        I am not sure is it a good approach to show PicoCMS HTML files within Zabbix at least there can be conflicts in styles. Probably it would be better to implement module able to render HTML from .md files, as PicoCMS does.

        Comment

        • markfree
          Senior Member
          • Apr 2019
          • 868

          #7
          My hypothesis is that by implementing PicoCMS as a module within Zabbix, there would be no need for an authentication plugin, since the module remains within the frontend. Unfortunately I was not able to test this.
          I'll have a look at the logs to see if I can find more data.

          Comment

          Working...