Adding hosts through addhost.php on SNMP v3

I am trying to add the hosts from a file of hostnames using ./addhost.php in bash script what parameters does this file accept for v3?

Right now I have the syntax as:
sudo php addhost.php $hostname v3 librenmsUser MD5 password DES password

But I keep geeting this error after I run it
Unsupported SNMP Version “librenms”, must be v1, v2c, or v3

It seems the documentation is missing this part here:

I am happy to help out with any documentation work after, cheers.

try ./addhost.php without any parameters :slight_smile:

LibreNMS Add Host Tool

    Usage (SNMPv1/2c): ./addhost.php [-g <poller group>] [-f] [-p <port assoc mode>] <hostname> [community] [v1|v2c] [port] [udp|udp6|tcp|tcp6]
    Usage (SNMPv3)   :  Config Defaults : ./addhost.php [-g <poller group>] [-f] [-p <port assoc mode>] <hostname> any v3 [user] [port] [udp|udp6|tcp|tcp6]
    No Auth, No Priv : ./addhost.php [-g <poller group>] [-f] [-p <port assoc mode>] <hostname> nanp v3 [user] [port] [udp|udp6|tcp|tcp6]
       Auth, No Priv : ./addhost.php [-g <poller group>] [-f] [-p <port assoc mode>] <hostname> anp v3 <user> <password> [md5|sha] [port] [udp|udp6|tcp|tcp6]
       Auth,    Priv : ./addhost.php [-g <poller group>] [-f] [-p <port assoc mode>] <hostname> ap v3 <user> <password> <enckey> [md5|sha] [aes|dsa] [port] [udp|udp6|tcp|tcp6]

        -g <poller group> allows you to add a device to be pinned to a specific poller when using distributed polling. X can be any number associated with a poller group
        -f forces the device to be added by skipping the icmp and snmp check against the host.
        -p <port assoc mode> allow you to set a port association mode for this device. By default ports are associated by 'ifIndex'.
                             For Linux/Unix based devices 'ifName' or 'ifDescr' might be useful for a stable iface mapping.
                             The default for this installation is 'ifIndex'
                             Valid port assoc modes are: ifIndex, ifName, ifDescr, ifAlias

    Remember to run discovery for the host afterwards.

Hey @murrant thanks for your response, I am trying to leverage addhost.php in a bash script which means I will need the parameters to add the devices. How did you manage to display the parameters list? :slight_smile:

./addhost.php as I mentioned :wink:

1 Like

@murrant Great thanks all working! I am happy to help with adding this to the online docs

1 Like