Started integrating external systems
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
// Computerdatenbank interface
|
||||
// $config_ext['computerdb']
|
||||
|
||||
class Cdb {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
// Loginventory interface
|
||||
// $config_ext['loginventory']
|
||||
|
||||
class Loginventory {
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
// Topdesk interface
|
||||
// $config_ext['topdesk']
|
||||
|
||||
class Topdesk {
|
||||
}
|
||||
|
||||
/*
|
||||
Topdesk-Infos / Interessante Tabellen
|
||||
object
|
||||
type
|
||||
asset_typ_id
|
||||
asset_summary
|
||||
asset_status
|
||||
ref_name
|
||||
asset_type
|
||||
unid 16 Byte GUID
|
||||
name
|
||||
am_entity
|
||||
object.asset_id = am_entity.unid
|
||||
|
||||
am_field
|
||||
id
|
||||
displayname
|
||||
properties (JSON)
|
||||
|
||||
am_value
|
||||
entityid
|
||||
fieldname
|
||||
textvalue
|
||||
numvalue
|
||||
valuetype
|
||||
|
||||
am_relation
|
||||
sourceId
|
||||
targetId
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
// Zabbix interface
|
||||
// $config_ext['zabbix']
|
||||
|
||||
class Zabbix {
|
||||
}
|
||||
|
||||
// $smarty->assign('zabbix', print_r($config_ext['zabbix']['host'],true));
|
||||
if ($config_ext['zabbix']['enabled']) {
|
||||
$smarty->assign("zabbix", true);
|
||||
$sql = "SELECT extlink_refid FROM extlink WHERE extlink_type='zabbix' AND asset_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$id]);
|
||||
$refid = $sth->fetchColumn();
|
||||
|
||||
// TODO fetch ext data here
|
||||
$zbxconn = false;
|
||||
try {
|
||||
$zbx = new PDO('mysql:host='.$config_ext['zabbix']['host'].';dbname='.$config_ext['zabbix']['db'].';', $config_ext['zabbix']['user'], $config_ext['zabbix']['pass']);
|
||||
$zbx->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$zbx->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
||||
$zbxconn = true;
|
||||
} catch (Exception $e) {
|
||||
$refid = "not_connected:" . $e->getMessage();
|
||||
}
|
||||
|
||||
if ($zbxconn) {
|
||||
$sql = "SELECT host FROM hosts WHERE hostid=?";
|
||||
$sth = $zbx->prepare($sql);
|
||||
$sth->execute([$refid]);
|
||||
$zbx_hostname = $sth->fetchColumn();
|
||||
$smarty->assign('zbx_hostname', $zbx_hostname);
|
||||
$zbx = NULL; // close
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user