• Sy chevron_right

      Местонахождение устройства в панели проблем Zabbix 3.4

      pubsub.slavino.sk / sysadmblog · Sunday, 13 September, 2020 - 08:00 edit · 1 minute

    На стартовой странице веб-интерфейса Zabbix по умолчанию отображается список актуальных проблем. Самая важная информация в этом списке - это время начала проблемы, узел сети, срабтавший триггер и длительность проблемы, но нет никакой информации о местоположении устройства. Если у вас небольшая сеть, расположенная не более чем по нескольким десяткам адресов, то хорошая система именования устройств может решить проблему поиска местонахождения устройства. Если же количество адресов, по которым находятся устройства, достигает нескольких тысяч, то правильное именование устройств становится трудной задачей.

    В Zabbix'е к каждому устройству можно прикрепить так называемые «инвентарные данные», среди которых есть поле адреса. Было бы неплохо показывать это поле в списке проблем, чтобы можно было без лишних телодвижений определить адрес устройства. К сожалению, Zabbix не предоставляет для этого штатных средств. Но к счастью, это можно сделать, внеся в исходный текст веб-интерфейса Zabbix небольшую правку.

    Интересующий нас виджет находится в файле frontends/php/app/views/monitoring.widget.problems.view.php

    Этот виджет фигурирует в списке маршрутов в файле frontends/php/include/classes/mvc/CRouter.php:
    'widget.problems.view'  => ['CControllerWidgetProblemsView',    'layout.widget',                'monitoring.widget.problems.view'],
    Класс CControllerWidgetProblemsView описан в файле frontends/php/app/controllers/CControllerWidgetProblemsView.php. Именно в этом классе готовятся данные, которые потом будут использованы в виджете для отображения. Данные об узлах, связанных с триггерами, в этом классе формируется при помощи функции getTriggersHostsList.

    Определение функции getTriggersHostsList находится в файле frontends/php/include/triggers.inc.php, для получения списка узлов с триггерами используется метод API host.get :
    $db_hosts = $hostids
    ? API::Host()->get([
    'output' => ['hostid', 'name', 'status', 'maintenanceid', 'maintenance_status', 'maintenance_type'],
    'selectGraphs' => API_OUTPUT_COUNT,
    'selectScreens' => API_OUTPUT_COUNT,
    'hostids' => array_keys($hostids),
    'preservekeys' => true
    ])
    : [];
    Внесём правку, которая добавит в этот список строку местоположения устройства из его инвентарных данных:
    Index: zabbix-3.4.12-1+buster/frontends/php/include/triggers.inc.php
    ===================================================================
    --- zabbix-3.4.12-1+buster.orig/frontends/php/include/triggers.inc.php
    +++ zabbix-3.4.12-1+buster/frontends/php/include/triggers.inc.php
    @@ -2170,6 +2170,7 @@ function getTriggersHostsList(array $tri
    'output' => ['hostid', 'name', 'status', 'maintenanceid', 'maintenance_status', 'maintenance_type'],
    'selectGraphs' => API_OUTPUT_COUNT,
    'selectScreens' => API_OUTPUT_COUNT,
    + 'selectInventory' => ['location'],
    'hostids' => array_keys($hostids),
    'preservekeys' => true
    ])
    Теперь эти данные нужно отобразить в виджете. Внесём соответствующую правку в файл frontends/php/app/views/monitoring.widget.problems.view.php:
    Index: zabbix-3.4.12-1+buster/frontends/php/app/views/monitoring.widget.problems.view.php
    ===================================================================
    --- zabbix-3.4.12-1+buster.orig/frontends/php/app/views/monitoring.widget.problems.view.php
    +++ zabbix-3.4.12-1+buster/frontends/php/app/views/monitoring.widget.problems.view.php
    @@ -54,6 +54,7 @@ $table = (new CTableInfo())
    $show_recovery_data ? _('Status') : null,
    _('Info'),
    ($data['sortfield'] === 'host') ? [_('Host'), $sort_div] : _('Host'),
    + ($data['sortfield'] === 'location') ? [_('Location'), $sort_div] : _('Location'),
    [
    ($data['sortfield'] === 'problem') ? [_('Problem'), $sort_div] : _('Problem'),
    ' • ',
    @@ -198,11 +199,19 @@ foreach ($data['data']['problems'] as $e
    ];
    }

    + $trigger_hosts = array_values($data['data']['triggers_hosts'][$trigger['triggerid']]);
    + $locations = array();
    + foreach($trigger_hosts as $host)
    + {
    + $locations[] = $host['inventory']['location'];
    + }
    +
    $table->addRow(array_merge($row, [
    $show_recovery_data ? $cell_r_clock : null,
    $show_recovery_data ? $cell_status : null,
    makeInformationList($info_icons),
    $triggers_hosts[$trigger['triggerid']],
    + join(', ', $locations),
    $description,
    (new CCol(
    ($problem['r_eventid'] != 0)
    Как видно, в правке:
    1. в таблицу был добавлен заголовок новой колонки Location,
    2. по каждому из триггеров формируется строка со списком адресов узлов, на значения элементов данных из которых опирается этот триггер,
    3. строки с адресами через запятую с пробелом склеиваются в одну строку,
    4. полученная строка добавляется в строку таблицы, в колонку Location.
    Готовую заплатку можно взять по ссылке zabbix3_4_12_frontend_location.patch .

    Značky: #3.4, #debian, #zabbix, #linux, #Linux, #buster, #php

    • chevron_right

      MediaWiki and OAuth2

      Warlord · pubsub.slavino.sk / warlord0blog · Tuesday, 21 July, 2020 - 16:22 edit

    With a move to a more joined up authentication using Single Sign On (SSO) I deployed a Keycloak service in a docker container – that should probably form part of a later article. Keycloak provides the bridge between OAuth2/SAML and LDAP authentication. Rather than relying on the same passwords and having to type the same &ellipsisRead the full post »

    Značky: #Linux, #php, #Web, #authentication, #security, #single-sign-on, #Linux

    • chevron_right

      Movim 0.16.1 – Cesco

      Timothée Jaussoin · pubsub.movim.eu / Movim · Friday, 6 December, 2019 - 09:50 · 1 minute

    Only a few weeks after the 0.16 release here is the 0.16.1 one!

    This release includes several fixes and a few new features.

    Features

    You can now share posts to your connected chatrooms :)

    Chatroom post sharing

    Communities layout were a bit redesigned, publication rules are now displayed clearly in the right column and the header shows more information on mobile.

    Communities redesigned

    All the messages that you sent in the one to one discussions can now be edited.

    Message edition for the whole history

    The videoconferencing feature was heavily refactored and several issues were fixed during this process. A new XEP was also used partially to improve the call negociation flow, XEP-0353: Jingle Message Initiation.

    Fixes

    In the database an index was added on the key that was tracking contacts avatars. This sounds maybe a bit technical to you but this small fix boost quite a lot the performances during the login process, when you join a chatroom (especially that one) or when a contact updates his/her avatar. Because it's a database change you should run the database migrations when updating from 0.16 to 0.16.1.

    All the entities that are on the XMPP network needs to declare what they are capable of to the others. This allows feature discovery and negociation and is specified in the #XMPP extension XEP-0115: Entity Capabilities. After the big code refactor of the handling of those #capabilities within the Movim codebase some other small improvements and fixes were done to wrap up properly this feature.

    Presences sent to MUC are now generated the same way than those sent to contacts, this fixes #711.

    DNS resolution errors an timeout are now handled properly displayed during the authentication flow (#368).

    The SQL_DATE constant was renamed to MOVIM_SQL_DATE to prevent some naming conflicts (#820).

    What's next?

    PHP 7.4 was released a few days ago, so the upcoming version will focus on fixing issues to make Movim fully compatible with that version.

    This new PHP release also includes an exciting feature that allows #PHP developpers to call directly C libraries in their codes. This could allow #Movim to directly use the libsignal C library and therefore (finally) allow OMEMO end-to-end-encryption to be implemented. This will be a lot of work and verifications so we're not promissing anything anytime soon. Stay calm please!

    That's all folks!

    #omemo #videoconference #jingle #release

    • chevron_right

      Little delay for the 0.14 release

      Timothée Jaussoin · pubsub.movim.eu / Movim · Saturday, 27 October, 2018 - 20:39 edit

    As you may have noticed, the 0.14 #release of #Movim is not there yet. We just found out that Movim had serious issues running with #PHP 7.3 RC2, this seems to be caused by some bugs regarding the #sockets management in this new PHP version.

    We are currently investigating that and hope that it will be fixed for the final PHP 7.3 release.

    Update: The issue seems to come from a bug between php-zmq and PHP 7.3, there is some work in progress to fix the issue, more info there mkoppanen/php-zmq - Fix for PHP 7.3.

    • chevron_right

      How to add custom sticker packs to Movim

      Timothée Jaussoin · pubsub.movim.eu / Movim · Tuesday, 18 July, 2017 - 05:59 edit · 2 minutes

    Original article written by kawaii.

    Movim is a decentralized social network, written in #PHP and HTML5 and based on the XMPP standard protocol. One of my faviourite features in Movim is that you can send #stickers to your friends. By default #Movim comes bundled with a few sticker packs but if like me you'd like to extend this and add your own then it's surprisingly not too difficult! There are three main components to creating your own sticker pack:

    You'll need to find the following directory on your Movim server filesystem:

    /var/www/movim/app/widgets/Stickers/stickers/
    

    Within this directory you will see the default Movim sticker packs i.e. 'mochi' and 'racoon'. Create a new directory here, for this example call it 'mystickers' or something. Within this directory create a new file called 'info.ini'. The contents of this file describe some basic information about the sticker pack. Here is an example from the 'racoon' set:

    author      = Corine Tea 
    license     = CreativeCommon BY SA
    url         = https://lechocobo.wordpress.com/
    

    Edit and enter the relevant details into the file and then save it. Now we need to add our 'icon.png' to this directory. This is a small image that will be displayed in the list of sticker packs within the Movim client itself. You must name this file exactly 'icon.png' or it will not be displayed. Finally, your actual sticker images themselves. Movim will not simply load any image within the directory. Your images must be converted so that the filename is the SHA1 hash of the file contents, plus the file extension (PNG). You can use the following #Python script created by James Curtis to rename any image files (except icon.png) into an acceptable format for use within Movim:

    import hashlib
    import os
    from glob import glob
    
    image_file_list = glob('*.png')
    
    for image in image_file_list:
        if not image == "icon.png":
            image_hash = hashlib.sha1(open(image, 'rb').read()).hexdigest()
            os.rename(image, "{image_hash}.png".format(image_hash=image_hash))
    

    Any image with the '.png' extension within your new sticker pack directory will have been converted so that the filename is the correct SHA1 hash which Movim will accept and display. Enjoy your new stickers! :)

    Special thanks to Jaussoin Timothée for creating Movim and to James Curtis for providing the Python script used to convert the image filenames to the required SHA1 hash.

    • chevron_right

      Movim, des nouvelles de la 0.9.1

      Timothée Jaussoin · Saturday, 19 March, 2016 - 20:24 edit · 2 minutes

    Voilà un mois que Movim 0.9 - Tchouri est sorti et déjà plein de nouvelles fonctionnalités ont été intégrées pour la prochaine version !

    Le travail effectué sur la 0.9.1 (qui n'a pas encore de nom pour le moment) se concentre essentiellement sur la partie chat du projet.

    Il est déjà possible d'éditer le précédent message envoyé (en utilisant l'extension XEP-0308: Last Message Correction de XMPP) mais aussi de savoir quand un message a été reçu par le destinataire (voir XEP-0184: Message Delivery Receipts).

    Petit surprise pour les movimiens: le support des stickers (voir la page Wikipedia pour comprendre de quoi il s'agit) a été ajouté dans le projet (via l'intégration de XEP-0231: Bits of Binary). Ce qui est intéressant avec cette fonctionnalité, c'est qu'il n'y a pas de restriction sur la liste des stickers envoyés ou reçus et qu'il est déjà possible d'envoyer des stickers de Movim vers Pidgin ou Gajim. Un cache est créé par Movim pour éviter de transférer plusieurs fois l'image sur le réseau.

    Je travaille également avec des dessinateurs (et dessinatrices !) pour intégrer des stickers exclusifs au projet ! Un premier pack, créé par Corine Tea, est déjà disponible sous licence Creative Commons BY-NC-SA. Je donnerai plus d'informations prochainement là dessus ;)

    Dans le reste du projet, quelques retouches esthétiques mineures. La page "Accueil" a été supprimée et son contenu a été fusionné avec la page "Actualité". Plein de petits bugs ont été corrigés ici et là dont un sur la gestion des étiquettes des publications (qui supportent désormais les accents et certains caractères spéciaux !).

    Une mise à jour de la librairie Modl a permis d'appliquer de meilleures restrictions sur la base de données et ainsi de la rendre plus cohérente.

    Une nouvelle version de l'application bureau de Movim est également sortie pour Debian et Ubuntu. Elle est disponible, comme toujours, sur le dépôt APT officiel du projet apt.movim.eu. Elle corrige certains soucis de navigation et les liens externes sont maintenant ouverts dans le navigateur par défaut.

    Le pod nl.movim.eu est passé à la version PHP 7.0 ainsi qu'au HTTP/2 avec un gain de performances à la clef ! N'hésitez pas à utiliser ce pod qui possède exactement les mêmes fonctionnalités que pod.movim.eu.

    Il reste encore un petit peu de travail à faire avant la sortie de la 0.9.1. N'hésitez pas à venir discuter avec nous sur le salon officiel du projet, à me poser des questions et à ouvrir des bugs si vous en trouvez !