Skip to content

Commit

Permalink
Ported on zabbix 3.2
Browse files Browse the repository at this point in the history
First probably working version.
  • Loading branch information
mickvav committed May 23, 2017
1 parent 2eae157 commit 52df21b
Show file tree
Hide file tree
Showing 315 changed files with 447,276 additions and 32 deletions.
13 changes: 12 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ Download

Version number of snmpbuilder with same with zabbix version for that it works.

SnmpBuilder 1.8.1
SnmpBuilder 3.2


Change log:

* Ported to zabbix 3.2
* Fix undefined index warnings.
* Include danrog's fix for non-numeric indexes.
* From 1.8.1, zabbix not accept specified chars in key name. So I must replace them with underscore.
Expand Down Expand Up @@ -56,6 +58,15 @@ Like this:
)
)

* Open jsLoader.php. Add some values to $availableJScripts to make lines around line 51 look array like this:

$availableJScripts = [
// snmp_builder
'../snmp_builder/Tree.js' => '',
'../snmp_builder/snmp_builder.js' => '',
'../snmp_builder/DynTable.js' => '',
// /snmp_builder

It for integrate snmp_builder.php as a menu item under Administration tab and between Locales and Install menu. In fact, you can add it in any place.

* Open Zabbix, select Administation tab, you should see SNMP Builder in menu.
Expand Down
58 changes: 31 additions & 27 deletions snmp_builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
?>
<?php

define('MIBS_ALL_PATH', '/home/zabbix/public_html/snmp_builder/mibs:/usr/share/snmp/mibs');
define('MIBS_ALL_PATH', '/var/www/html/zabbix/snmp_builder/mibs:/usr/share/snmp/mibs');

require_once('include/config.inc.php');

Expand Down Expand Up @@ -322,7 +322,7 @@
}

$form->addItem(array('MIB:'.SPACE,$cmbMibs,SPACE));

$form->addItem((new CTag('br')));
// server textbox
$ipbServer = new CTextBox('server_ip',$server_ip);
$form->addItem(array('Server:'.SPACE,$ipbServer,SPACE));
Expand All @@ -331,7 +331,9 @@
$tbCommunity = new CTextBox('community',$community);
$form->addItem(array('Community:'.SPACE,$tbCommunity ,SPACE));

$snmp_wdgt->addHeader('SNMP Builder', $form);
#$snmp_wdgt->addHeader('SNMP Builder', $form);
$snmp_wdgt->setTitle('SNMP Builder');
$snmp_wdgt->setControls($form);

//Body
$outer_table = new CTable();
Expand All @@ -344,9 +346,10 @@
//Left panel
$left_tab = new CTable();
//Oid tree
$oid_tree_w = new CWidget();
/* $oid_tree_w = new CWidget();
$oid_tree_w->setClass('header');
$oid_tree_w->addHeader("Oid Tree");
$oid_tree_w->addHeader("Oid Tree");*/
$oid_tree_w = new CColHeader("Oid Tree");

$oid_tree_div = new CDiv();
$oid_tree_div->setAttribute("id","oidtree");
Expand All @@ -358,9 +361,7 @@
$left_tab->addRow($oid_tree_w);

//Oid description
$oid_info_w = new CWidget();
$oid_info_w->setClass('header');
$oid_info_w->addHeader("Information");
$oid_info_w = new CColHeader("Information");

$oid_info_div = new CDiv();
$oid_info_div->setAttribute("id","oidinfo");
Expand All @@ -371,21 +372,18 @@
//Right panel
$right_tab = new CTable();
//Oidview
$oid_view_w = new CWidget();
$oid_view_w->setClass('header');
$oid_view_w->addHeader(array("Oid View - click to view as table:",new CCheckBox('viewtype','no','onViewType()',1)));
$oid_view_w = (new CColHeader(
( (new CCheckBox('viewtype'))->onClick('onViewType()') ) ));
// $oid_view_w->addHeader(array("Oid View - click to view as table:",));


$oid_view_div = new CDiv();
$oid_view_div->setAttribute("id","oidview");
$oid_view_div ->addStyle("overflow: auto; max-height: 250px; width: 800px");
$oid_view_w->addItem($oid_view_div);
$right_tab->addRow($oid_view_w);

//Itemlist
$item_list_w = new CWidget();
$item_list_w->setClass('header');
$item_list_w->addHeader("Item List");
$item_list_w = new CColHeader('Item List');

$item_list_div = new CDiv();
$item_list_div->setAttribute("id","itemlist");
Expand All @@ -394,16 +392,13 @@
$right_tab->addRow($item_list_w);

//Action srow
$action_w= new CWidget();
$action_w->setClass('header');

$action_w->addHeader(array(new CButton('save','Save','javascript: onSaveItems()'), SPACE, new CButton('clear','Clear List','javascript: onClearItems()')));
//$action_div = new CDiv();
//$action_w->addItem($action_div);
$right_tab->addRow($action_w);


$action_w= (new CButton('save',_('Save')))->addStyle("margin: 10px;")->onClick('onSaveItems()');
$action_c= (new CButton('clear',_('Clear')))->addStyle("margin: 10px;")->onClick('onClearItems()');

$right_tab->addRow([$action_w,$action_c ]);

// Left panel

$td_l = new CCol($left_tab);
$td_l->setAttribute('valign','top');
$td_l->setAttribute('width','300px');
Expand Down Expand Up @@ -561,11 +556,20 @@ function get_templates()
'nopermissions' => 1
);
$template = array();
foreach (CTemplate::get($options) as $key => $value)
$templateget = API::Template()->get([
'output' => ['templateid', 'name'],
'preservekeys' => true
]);

# foreach (CTemplate::get($options) as $key => $value)
# {
# array_push($template, array('key' => $key, 'host' => $value['host']));
# }
#
foreach ($templateget as $key => $value)
{
array_push($template, array('key' => $key, 'host' => $value['host']));
array_push($template, array('key' => $key, 'host' => $value['name']));
}

return $template;

}
Expand Down
12 changes: 8 additions & 4 deletions snmp_builder/Tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -3392,9 +3392,13 @@ TafelTreeBaseBranch.prototype = {
if (this.objDrag) {
this.objDrag.destroy();
}
Droppables.remove(this.txt);
// Droppables.remove(this.txt);
for (var i = 0; i < this.children.length; i++) {
try {
this.children[i].removeDragDrop();
} catch (err) {
console.log(err.message);
};
}
},

Expand Down Expand Up @@ -3978,9 +3982,9 @@ TafelTreeBaseBranch.prototype = {
Element.addClassName(this.txt, this.tree.classDrag);
}
}
if (this.struct.acceptdrop) {
/* if (this.struct.acceptdrop) {
Droppables.add(this.txt, {hoverclass: this.tree.classDragOver, onDrop: this.setDrop.bindAsEventListener(this)});
}
}*/
if (this.struct.tooltip) {
Event.observe(event, 'mouseover', this.evt_showTooltip.bindAsEventListener(this), false);
Event.observe(event, 'mouseout', this.evt_hideTooltip.bindAsEventListener(this), false);
Expand Down Expand Up @@ -5871,4 +5875,4 @@ function TafelTreeInitBase (ev) {
}
};

Event.observe(window, 'load', TafelTreeInitBase, false);
Event.observe(window, 'load', TafelTreeInitBase, false);
Loading

0 comments on commit 52df21b

Please sign in to comment.