Automation and device naming

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
redneckgeek
Posts: 19
Joined: Mon Dec 05, 2011 11:31 am

Automation and device naming

Post by redneckgeek »

I've searched and had no joy. Way.. along time ago.. when automation was a plugin.. It would use retrieved DNS for the device name. Since 1.x I've not been able to get it to do this. I've got several thousand cable modems in an old cacti system and want to change servers, start clean etc. I can't for the life of me figure out how to get Automation to not use the device provided name. I've got ISC DHCP setting dns names for the devices, and need automation to use these names when it puts them into the trees. Everything else works a charm, but for some reason all I get is SNMP recovered device name and I can't figure out if there is selection or a way to change it.

/thanks
/rh
redneckgeek
Posts: 19
Joined: Mon Dec 05, 2011 11:31 am

Re: Automation and device naming

Post by redneckgeek »

Apologies..

Ok, running through the code... what I want to change is not the hostname.. It's the description field (or what shows up in the tree for the host).
I want the description to be the dnsname. Oddly enough now that I've run through it a little I remember making this same mistake.. years ago (hostname/description).. sigh old age..

So running debug on the discovery, it obviously knows what the dnsname is..

2021/04/26 01:07:02 - AUTOM8 [PID: 39233] Device: 10.14.96.19, Checking DNS: Found 'Test-Modem3-VL383'

It looks like it's using the snmp_sysName for Description, which I can't change on these devices via dhcp.

So been poking around poller_automation.php to see where I can get the $device['snmp_sysName'] = $dnsname;

Can someone point me in the right direction to change this without breaking tons of stuff.

/thanks
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: Automation and device naming

Post by cigamit »

I haven't tested it, but you could try changing this line

https://github.com/Cacti/cacti/blob/1.2 ... .php#L2955
to
$description = ($device['dnsname'] != '' ? $device['dnsname'] : ($snmp_sysName != '' ? $snmp_sysName : ($device['hostname'] == '' ? $device['ip'] : $device['hostname'])));
redneckgeek
Posts: 19
Joined: Mon Dec 05, 2011 11:31 am

Re: Automation and device naming

Post by redneckgeek »

You are a scholar and a gentleman.. seems to work perfect. Hopefully I can manage any other tweaks from here.

/thanks very much
/rh
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest