Network Management

 View Only
Expand all | Collapse all

CLI Script with hostname variable

This thread has been viewed 3 times
  • 1.  CLI Script with hostname variable

    Posted Jan 29, 2018 09:36 AM

    Hi everyone,

    is there a way to run f.e. the following command:

     

    copy command-output "sh tech all" tftp 192.168.10.10 tech_all_${hostname}_20180129.txt 

    Where ${hostname} is the hostname of the device the script is running on?
    I can configure variables per device, but then I could as well just type the script in every device per hand. 

     

    The tooltip states I could enter MIB variables, but I can't find a way to use that.

    2.Input MIB parameter, according with $(mibName|mibVariable|index).
    For example: $(H3C-SYS-MAN-MIB|h3cSysImageSize|65537) or $(H3C-SYS-MAN-MIB|h3cSysImageSize|@(H3C-SYS-MAN-MIB|h3cSysReloadImage|65536)).

    Thanks



  • 2.  RE: CLI Script with hostname variable

    Posted Jan 29, 2018 11:59 AM

    You could try using the sysName MIB.

    Something like this I think: 

    $(SNMPv2-MIB|sysName|0)


  • 3.  RE: CLI Script with hostname variable

    Posted Jan 31, 2018 10:34 AM

    Hi,

    it works, thanks a lot ^^