Bug: Netscaler orphaned vserver not being deleted

We have vserver entry that was removed from the configuration in the Netscaler but Librenms still see them as their last status.

Polling module see that those vserver aren’t there anymore because it put an “-” before the line:

-vs_cxapps.interne.ssq.ca_def_dev_httpSQL[DELETE FROM netscaler_vservers WHERE vsvr_id = ? [{“vsvr_id”:2552,“device_id”:22,“vsvr_name”:“vs_xxxx.xxxx.xxx_def_dev_http”,“vsvr_ip”:“0.0.0.0”,“vsvr_port”:80,“vsvr_type”:“http”,“vsvr_state”:“up”,“vsvr_clients”:0,“vsvr_server”:0,“vsvr_req_rate”:0,“vsvr_bps_in”:0,“vsvr_bps_out”:0}] 0.2ms]

If we enable mysql queries logging we do see this in the log:

                21 Prepare	DELETE FROM `netscaler_vservers` WHERE `vsvr_id` =  ?
	    21 Execute	DELETE FROM `netscaler_vservers` WHERE `vsvr_id` =  'Array'
	    21 Close stmt	

Looks like something being missed between the polling modules and mysql because the “Array” value isn’t being translated in the vsrv_id.

The auto creation of new vserver works as expected.

Trying to figure out the issue myself, but asking for help from the community.

Thanks!

Validate.php

====================================

Component Version
LibreNMS
DB Schema 271
PHP 7.2.13
MySQL 10.3.11-MariaDB
RRDTool 1.4.8
SNMP NET-SNMP 5.7.2

====================================

[OK] Composer Version: 1.8.3
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
fatal: Not a git repository (or any parent up to mount point /app)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: Not a git repository (or any parent up to mount point /app)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: Not a git repository (or any parent up to mount point /app)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
usage: git diff [–no-index]
[WARN] Your local git branch is not master, this will prevent automatic updates.
[FIX]:
You can switch back to master with git checkout master
[FAIL] You need to run this script as root or librenms
[FAIL] Some folders have incorrect file permissions, this may cause issues.
[FIX]:
sudo chown -R librenms:librenms /app/librenms
sudo setfacl -d -m g::rwx /app/librenms/rrd /app/librenms/logs /app/librenms/bootstrap/cache/ /app/librenms/storage/
sudo chmod -R ug=rwX /app/librenms/rrd /app/librenms/logs /app/librenms/bootstrap/cache/ /app/librenms/storage/
Files:
/app/librenms/storage/framework/views/29721d4721d98a0c1e85451cc3afa43c

Found out the solution, needs to modify a line in the netscaler-vsvr.inc.php incorrect array value were sent to the dbdelete function.

To who I can speak with to modify this in the code? Thanks

@Bob81

Its best if you submit your code changes as PR in github.

https://github.com/librenms/librenms/pulls

1 Like