<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Python Netmiko to get hostname in Controllers</title>
    <link>https://community.cisco.com/t5/controllers/python-netmiko-to-get-hostname/m-p/4068531#M2209</link>
    <description>&lt;P&gt;There is no "show hostname" on 3725&lt;/P&gt;&lt;PRE&gt;R1#show hostname
            ^
% Invalid input detected at '^' marker.

R1#
R1#show host?
hosts  

R1#&lt;/PRE&gt;</description>
    <pubDate>Sat, 18 Apr 2020 00:48:06 GMT</pubDate>
    <dc:creator>write_erase</dc:creator>
    <dc:date>2020-04-18T00:48:06Z</dc:date>
    <item>
      <title>Python Netmiko to get hostname</title>
      <link>https://community.cisco.com/t5/controllers/python-netmiko-to-get-hostname/m-p/4068132#M2206</link>
      <description>&lt;P&gt;I was able to get device hostname with the following netmiko code.&lt;/P&gt;&lt;PRE&gt;&amp;gt;&amp;gt;&amp;gt; print(net_connect.find_prompt())
Cisco#
&amp;gt;&amp;gt;&amp;gt;

&amp;gt;&amp;gt;&amp;gt; print(net_connect.send_command('show running-config | include hostname'))
hostname Cisco
&amp;gt;&amp;gt;&amp;gt;&lt;/PRE&gt;&lt;P&gt;Would it be possible to remove `#` and `hostname` from the output?&lt;/P&gt;&lt;P&gt;Desired Output&lt;/P&gt;&lt;PRE&gt;&amp;gt;&amp;gt;&amp;gt; print(net_connect.find_prompt()) &amp;lt;= need to do something here
Cisco
&amp;gt;&amp;gt;&amp;gt;

&amp;gt;&amp;gt;&amp;gt; print(net_connect.send_command('sh run | i host')) &amp;lt;= need to do something here
Cisco
&amp;gt;&amp;gt;&amp;gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Apr 2020 14:12:32 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/python-netmiko-to-get-hostname/m-p/4068132#M2206</guid>
      <dc:creator>write_erase</dc:creator>
      <dc:date>2020-04-17T14:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: Python Netmiko to get hostname</title>
      <link>https://community.cisco.com/t5/controllers/python-netmiko-to-get-hostname/m-p/4068142#M2207</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;
&lt;P&gt;Try the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&amp;gt;&amp;gt;&amp;gt; print(net_connect.find_prompt()[:-1])

&amp;gt;&amp;gt;&amp;gt; print(net_connect.send_command('sh run | i host').split()[1])&lt;/PRE&gt;
&lt;P&gt;cheers,&lt;/P&gt;
&lt;P&gt;Seb.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2020 14:21:47 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/python-netmiko-to-get-hostname/m-p/4068142#M2207</guid>
      <dc:creator>Seb Rupik</dc:creator>
      <dc:date>2020-04-17T14:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: Python Netmiko to get hostname</title>
      <link>https://community.cisco.com/t5/controllers/python-netmiko-to-get-hostname/m-p/4068249#M2208</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Instead of parsing the running-config (which means additional execution time for your script until the running-config is collected), why not getting the hostname directly using 'show hostname' command?&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;print(net_connect.send_command('show hostname'))&lt;/PRE&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Sergiu&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2020 16:05:35 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/python-netmiko-to-get-hostname/m-p/4068249#M2208</guid>
      <dc:creator>alexandru.bogdan1</dc:creator>
      <dc:date>2020-04-17T16:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: Python Netmiko to get hostname</title>
      <link>https://community.cisco.com/t5/controllers/python-netmiko-to-get-hostname/m-p/4068531#M2209</link>
      <description>&lt;P&gt;There is no "show hostname" on 3725&lt;/P&gt;&lt;PRE&gt;R1#show hostname
            ^
% Invalid input detected at '^' marker.

R1#
R1#show host?
hosts  

R1#&lt;/PRE&gt;</description>
      <pubDate>Sat, 18 Apr 2020 00:48:06 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/python-netmiko-to-get-hostname/m-p/4068531#M2209</guid>
      <dc:creator>write_erase</dc:creator>
      <dc:date>2020-04-18T00:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: Python Netmiko to get hostname</title>
      <link>https://community.cisco.com/t5/controllers/python-netmiko-to-get-hostname/m-p/4310511#M2210</link>
      <description>&lt;P&gt;I run 'show version | in uptime' which is way more faster than parsing running config.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 15:38:07 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/python-netmiko-to-get-hostname/m-p/4310511#M2210</guid>
      <dc:creator>voipleo</dc:creator>
      <dc:date>2021-03-19T15:38:07Z</dc:date>
    </item>
  </channel>
</rss>

