Hi, i made my custom module that receives a OID from servers. It is executed properly during polling, however no data is written do librenms database:
[root@nms polling]# cat ucd-inodes.inc.php
<?php
use LibreNMS\RRD\RrdDefinition;
// SNMP OID for used inodes
$oid = '.1.3.6.1.4.1.2021.9.1.10';
// Perform SNMP walk to get used inodes
$inode_data = snmpwalk_cache_oid($device, 'dskPercentNode', [], 'UCD-SNMP-MIB');
foreach ($inode_data as $index => $entry) {
// You can customize the following condition to filter specific disks if needed
if (strpos($entry['dskPath'], '/dev/') !== false) {
echo $entry['dskPath'] . ' Used Inodes: ' . $entry['dskPercentNode'];
// Define RRD tags and definitions
$tags = [
'rrd_name' => ['ucd_used_inodes', $entry['dskPath']],
'rrd_def' => RrdDefinition::make()
->addDataset('used_inodes', 'GAUGE', 0),
'descr' => $entry['dskPath'],
];
// Define fields to be stored in the database
$fields = [
'used_inodes' => $entry['dskPercentNode'],
];
// Update the database with the collected data
data_update($device, 'ucd_used_inodes', $tags, $fields);
echo "\n";
}
}
unset($inode_data);
I tried to manually create the database table and its schemas, but still no luck. I used the same “data_update” method that is used in another module called ucd-diskio.php which works correctly.
How it can be investigated?
Thank you in advance