I'm creating a script to bulk load switch ports into the tree. I grabbed this line from Gandalf's add_linux_host script. I can drive the cacti cli ok but I need to amned this line...
$status = array_rekey(db_fetch_assoc("select snmp_index from host_snmp_cache where host_id = $host_id and field_name ='ifOperStatus' and field_value='Up' order by CAST(snmp_index AS UNSIGNED)"),"snmp_index","snmp_index");
I would like to do the same thing (i..e fill an array with valid interfaces) - but have an array of interfaces but with "ifName" rather than "ifindex". I can then search that array easily and add matching interfaces I want ("vlan xxx" or "Gig1/x" etc. I dont want to check for ifindex - just have all interfaces for that host in an array of "ifname"s
Can anyone help with the relevant sql line ?
SQL Help
Moderators: Developers, Moderators
Ok - I'll take a look at the plugin. In the immediate term I have my script now doing what I need to initially bulk load certain ports with...
$if = "Te1/";
$status = array_rekey(db_fetch_assoc("select field_value from host_snmp_cache where host_id = $host_id and field_name ='ifName' and field_value like 'if%' order by CAST(snmp_index AS UNSIGNED)"),"field_value","field_value");
$if = "Te1/";
$status = array_rekey(db_fetch_assoc("select field_value from host_snmp_cache where host_id = $host_id and field_name ='ifName' and field_value like 'if%' order by CAST(snmp_index AS UNSIGNED)"),"field_value","field_value");
Who is online
Users browsing this forum: No registered users and 4 guests