When there is a failover, the master hostname is changed since the hostname belongs to the Routing Engine. Is this correct?
Yes. You can configure the same hostname or different hostnames. Either would work.
If you configure only the master IP address (for example, 192.168.2.5), and the sysDescr.0 object has the same string configured on both of the Routing Engines, then even after a switchover, the sysDescr.0 object returns the same value.
The following sample shows results from entering the snmpget command:
bng-junos-pool02: /c/svivek/PR_BRANCH/src> snmpget -c jnpr -v2c 192.168.2.5sysDescr.0 system.sysDescr.0 = foo
For more information, click Configuring SNMP on devices running Junos OS.