Ad Widget

Collapse

Инвентаризация (поменять поля)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Aksel
    Senior Member
    • Aug 2014
    • 101

    #1

    Инвентаризация (поменять поля)

    При заходе на страницу ***/zabbix/hostinventories.php?ddreset=1

    Мы видим поля:

    УЗЕЛ СЕТИ-ГРУППА-ИМЯ-ТИП-ОС-СЕРИЙНЫЙ НОМЕР A-ЭТИКЕТКА-MAC АДРЕС A

    как вместо полей (ИМЯ-ТИП-ОС-СЕРИЙНЫЙ НОМЕР A-ЭТИКЕТКА-MAC АДРЕС A), прописать другие поля? Например СЕРИЙНЫЙ НОМЕР B или другие, не важно даже какие?

    или если это не возможно, как добавить другие поля?

    з.ы. zabbix 3.0.2
  • Aksel
    Senior Member
    • Aug 2014
    • 101

    #2
    Разобрался. Можно закрыть.

    Comment

    • Kos
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Aug 2015
      • 3404

      #3
      Originally posted by aksel
      Разобрался. Можно закрыть.
      Молодец, мы рады.

      Но было бы неплохо поделиться с другими своим решением. А то представь: вот кто-нибудь со схожей проблемой найдёт потом поиском эту тему на форуме, вот рад-то будет такой "информативности"...

      Comment

      • fafhrd
        Junior Member
        • Mar 2016
        • 15

        #4
        Originally posted by aksel
        Разобрался. Можно закрыть.
        подскажите пожалуйста подробности, как решил?

        Comment

        • Belfigor
          Member
          • Jul 2016
          • 69

          #5
          Originally posted by fafhrd
          подскажите пожалуйста подробности, как решил?
          Присоединяюсь. Нужно установить дополнительные поля с отличными от стандартных названиями

          Comment

          • Aksel
            Senior Member
            • Aug 2014
            • 101

            #6
            1. Сделать бэкапы файлов!!!
            usr/share/zabbix/include/views/inventory.host.list.php
            usr/share/zabbix/hostinventories.php

            2. Править файлы:

            usr/share/zabbix/include/views/inventory.host.list.php
            править нужно секцию:

            $table = (new CTableInfo())
            <------>->setHeader([
            <------><------>make_sorting_header(_('Host'), 'name', $this->data['sort'], $this->data['sortorder']),
            <------><------>_('Group'),
            <------><------>make_sorting_header(_('Name'), 'pr_name', $this->data['sort'], $this->data['sortorder']),
            <------><------>make_sorting_header(_('Type'), 'pr_type', $this->data['sort'], $this->data['sortorder']),
            <------><------>make_sorting_header(_('OS'), 'pr_os', $this->data['sort'], $this->data['sortorder']),
            <------><------>make_sorting_header(_('Serial number A'), 'pr_serialno_a', $this->data['sort'], $this->data['sortorder']),
            <------><------>make_sorting_header(_('Tag'), 'pr_tag', $this->data['sort'], $this->data['sortorder']),
            <------><------>make_sorting_header(_('MAC address A'), 'pr_macaddress_a', $this->data['sort'], $this->data['sortorder'])
            <------>]);


            например на:

            $table = (new CTableInfo())
            <------>->setHeader([
            <------><------>make_sorting_header(_('Host'), 'name', $this->data['sort'], $this->data['sortorder']),
            <------><------>_('Group'),
            <------><------>make_sorting_header(_('Secondary POC notes'), 'poc_2_notes', $this->data['sort'], $this->data['sortorder']),
            <------><------>make_sorting_header(_('Secondary POC screen name'), 'poc_2_screen', $this->data['sort'], $this->data['sortorder']),
            <------><------>make_sorting_header(_('Secondary POC cell'), 'poc_2_cell', $this->data['sort'], $this->data['sortorder']),
            <------><------>make_sorting_header(_('Serial number A'), 'pr_serialno_a', $this->data['sort'], $this->data['sortorder']),
            <------><------>make_sorting_header(_('MAC address A'), 'pr_macaddress_a', $this->data['sort'], $this->data['sortorder']),
            <------><------>make_sorting_header(_('Primary POC phone A'), 'poc_1_phone_a', $this->data['sort'], $this->data['sortorder']),
            <------><------>make_sorting_header(_('Primary POC phone B'), 'poc_1_phone_b', $this->data['sort'], $this->data['sortorder']),
            <------><------>make_sorting_header(_('Primary POC name'), 'poc_1_name', $this->data['sort'], $this->data['sortorder']),
            <------><------>make_sorting_header(_('Primary POC email'), 'poc_1_email', $this->data['sort'], $this->data['sortorder']),
            <------><------>make_sorting_header(_('Secondary POC phone A'), 'poc_2_phone_a', $this->data['sort'], $this->data['sortorder']),
            <------><------>make_sorting_header(_('Secondary POC phone B'), 'poc_2_phone_b', $this->data['sort'], $this->data['sortorder']),
            <------><------>make_sorting_header(_('Secondary POC name'), 'poc_2_name', $this->data['sort'], $this->data['sortorder']),
            <------><------>make_sorting_header(_('Secondary POC email'), 'poc_2_email', $this->data['sort'], $this->data['sortorder'])
            <------><------>


            далее,

            <------>$row = [
            <------><------>(new CLink($host['name'], '?hostid='.$host['hostid'].url_param('groupid')))
            <------><------><------>->addClass($host['status'] == HOST_STATUS_NOT_MONITORED ? ZBX_STYLE_RED : null),
            <------><------>$hostGroups,
            <------><------>zbx_str2links($host['inventory']['name']),
            <------><------>zbx_str2links($host['inventory']['type']),
            <------><------>zbx_str2links($host['inventory']['os']),
            <------><------>zbx_str2links($host['inventory']['serialno_a']),
            <------><------>zbx_str2links($host['inventory']['tag']),
            <------><------>zbx_str2links($host['inventory']['macaddress_a'])
            <------>];

            на


            <------>$row = [
            <------><------>(new CLink($host['name'], '?hostid='.$host['hostid'].url_param('groupid')))
            <------><------><------>->addClass($host['status'] == HOST_STATUS_NOT_MONITORED ? ZBX_STYLE_RED : null),
            <------><------>$hostGroups,
            <------><------>zbx_str2links($host['inventory']['poc_2_notes']),
            <------><------>zbx_str2links($host['inventory']['poc_2_screen']),
            <------><------>zbx_str2links($host['inventory']['poc_2_cell']),
            <------><------>zbx_str2links($host['inventory']['serialno_a']),
            <------><------>zbx_str2links($host['inventory']['macaddress_a']),
            <------><------>zbx_str2links($host['inventory']['poc_1_phone_a']),
            <------><------>zbx_str2links($host['inventory']['poc_1_phone_b']),
            <------><------>zbx_str2links($host['inventory']['poc_1_name']),
            <------><------>zbx_str2links($host['inventory']['poc_1_email']),
            <------><------>zbx_str2links($host['inventory']['poc_2_phone_a']),
            <------><------>zbx_str2links($host['inventory']['poc_2_phone_b']),
            <------><------>zbx_str2links($host['inventory']['poc_2_name']),
            <------><------>zbx_str2links($host['inventory']['poc_2_email'])
            <------>];


            После того как добавите, нужные вам столбцы нужно править еще:


            usr/share/zabbix/hostinventories.php


            <------>'sort' =><-----><------><------><------>[T_ZBX_STR, O_OPT, P_SYS,
            <------><------><------><------><------><------><------><------>IN('"name","pr_macaddress_a","pr_name","pr_os", "p r_serialno_a","pr_tag","pr_type"'),
            <------><------><------><------><------><------><------><------>null


            на:

            <------>'sort' =><-----><------><------><------>[T_ZBX_STR, O_OPT, P_SYS,
            <------><------><------><------><------><------><------><------>IN('"poc_2_notes","poc_2_screen","poc_2_cell"," se rialno_a","macaddress_a","poc_1_phone_a","poc_1_ph one_b","poc_1_name","poc_1_email","poc_2_phone_a", "poc_2_phone_b","poc_2_n
            <------><------><------><------><------><------><------><------>null





            и еще



            <------>if ($data['pageFilter']->groupsSelected) {
            <------><------>// which inventory fields we will need for displaying
            <------><------>$requiredInventoryFields = [
            <------><------><------>'name',
            <------><------><------>'type',
            <------><------><------>'os',
            <------><------><------>'serialno_a',
            <------><------><------>'tag',
            <------><------><------>'macaddress_a'
            <------><------>];



            на


            <------>if ($data['pageFilter']->groupsSelected) {
            <------><------>// which inventory fields we will need for displaying
            <------><------>$requiredInventoryFields = [
            <------><------><------>'poc_2_notes',
            <------><------><------>'poc_2_screen',
            <------><------><------>'poc_2_cell',
            <------><------><------>'serialno_a',
            <------><------><------>'macaddress_a',
            <------><------><------>'poc_1_phone_a',
            <------><------><------>'poc_1_phone_b',
            <------><------><------>'poc_1_name',
            <------><------><------>'poc_1_email',
            <------><------><------>'poc_2_phone_a',
            <------><------><------>'poc_2_phone_b',
            <------><------><------>'poc_2_name',
            <------><------><------>'poc_2_email',
            <------><------><------>'name',
            <------><------><------>'type',
            <------><------><------>'os',
            <------><------><------>'tag'
            <------><------>];

            Comment

            • A.Nesterov
              Junior Member
              • Sep 2018
              • 1

              #7
              А ещё при желании можно дополнить поля таблицы host_inventory и дополнить нужными колонками отчёт. Надеюсь в новых версиях когда-нибудь допилят этот отчёт из коробки.

              Comment

              Working...