device_remove hook, working but then blank screeb

Discussions on developing plugins for the Cacti Plugin Architecture

Moderators: Moderators, Developers

Post Reply
Author
Message
Rno
Cacti User
Posts: 325
Joined: Wed Dec 07, 2011 9:19 am

device_remove hook, working but then blank screeb

#1 Post by Rno » Mon Jan 30, 2017 5:08 am

Hello,
I setup the device_remove hook, to be able to clean up my table when a device is removed!
It's executed, but then it got me a blank screen, nothing on cacti.log file, but this on the apache error log:
[Mon Jan 30 11:05:14.955649 2017] [:error] [pid 31020] [client 10.85.116.130:53200] PHP Warning: Cannot modify header information - headers already sent in /usr/share/cacti/host.php on line 311, referer: http://lslcact01.lausanne.ch/cacti/host.php


and this is my hook:
function linkdiscovery_device_remove( $hosts_id ){
//array(1) { [0]=> string(4) "1921" } device remove :
foreach( $hosts_id as $host_id) {
// remove host from plugin_linkdiscovery_hosts and plugin_linkdiscovery_intf
db_execute("DELETE FROM plugin_linkdiscovery_hosts where id=".$host_id );
db_execute("DELETE FROM plugin_linkdiscovery_intf where host_id_dst=".$host_id );
db_execute("DELETE FROM plugin_linkdiscovery_intf where host_id_src=".$host_id );
}

return;
}


any clue what is wrong ?
thanks
CentOS
Production
Cacti 0.8.8h
Spine 0.8.8h
PIA 3.1
Aggregate 0.75
Monitor 1.3
Settings 0.71
Weathermap 0.98
Thold 0.5
rrdclean 0.41

Own plugin: LinkDiscovery 0.3, Map 0.4

Test
Cacti 1.2.1
Spine 1.2.1
thold 1.0.6
monitor 2.3.5
php 7.2.11
mariadb 5.5.56
Own plugin:
ExtendDB 1.1.2
LinkDiscovery 1.2.4
Map 1.2.5

Post Reply