Started integrating external systems

This commit is contained in:
2026-07-23 14:48:30 +02:00
parent 8e218fd4ba
commit 4abb94b88c
21 changed files with 485 additions and 33 deletions
+6
View File
@@ -0,0 +1,6 @@
<?php
// Computerdatenbank interface
// $config_ext['computerdb']
class Cdb {
}
+6
View File
@@ -0,0 +1,6 @@
<?php
// Loginventory interface
// $config_ext['loginventory']
class Loginventory {
}
+38
View File
@@ -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
*/
+36
View File
@@ -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
}
}