<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Pynetbox on Aaron&#39;s Worthless Words</title>
    <link>https://a996c8ee.aww-3cz.pages.dev/tags/pynetbox/</link>
    <description>Recent content in Pynetbox on Aaron&#39;s Worthless Words</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Wed, 23 Aug 2023 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://a996c8ee.aww-3cz.pages.dev/tags/pynetbox/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Generating Network Diagrams from Netbox with Pynetbox</title>
      <link>https://a996c8ee.aww-3cz.pages.dev/posts/2023/08/generating-network-diagrams-from-netbox-with-pynetbox/</link>
      <pubDate>Wed, 23 Aug 2023 00:00:00 +0000</pubDate>
      <guid>https://a996c8ee.aww-3cz.pages.dev/posts/2023/08/generating-network-diagrams-from-netbox-with-pynetbox/</guid>
      <description>&lt;p&gt;Here&amp;rsquo;s my typical disclaimer: I&amp;rsquo;m not a developer. I have the ability to make code give me an expected output, but I do not do anything &amp;ldquo;the right way.&amp;rdquo;&lt;/p&gt;&#xA;&lt;p&gt;All the code I write for these blog posts is in &lt;a href=&#34;https://github.com/aconaway1/blog-pynetbox&#34;&gt;my Github repo&lt;/a&gt; that you can and should freely copy and modify. Here&amp;rsquo;s the environment I&amp;rsquo;m running this stuff in. Python. &lt;a href=&#34;https://github.com/netbox-community/pynetbox&#34;&gt;Pynetbox&lt;/a&gt;. You know the drill by now.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Python         :  3.9.10&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Pynetbox       :  7.0.0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Netbox version :  3.5.8&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We&amp;rsquo;ve been working through some stuff, and, at this point, we have a lot of stuff in our &lt;a href=&#34;https://docs.netbox.dev/en/stable/&#34;&gt;Netbox&lt;/a&gt; instance. Let&amp;rsquo;s step up the game a little, though, and see if we can&amp;rsquo;t generate a network diagram based on that data. Let&amp;rsquo;s set some expectations, though. This is not going to be comparable to that Visio diagram you&amp;rsquo;ve managed by hand for the last 8 years. This is going to be a very simple diagram with subnet, nodes, and IP addresses &amp;ndash; enough for an auditor or for some architect who doesn&amp;rsquo;t know what&amp;rsquo;s in their own data centers.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Sending Slack Messages with Python</title>
      <link>https://a996c8ee.aww-3cz.pages.dev/posts/2023/03/sending-slack-messages-with-python/</link>
      <pubDate>Wed, 15 Mar 2023 00:00:00 +0000</pubDate>
      <guid>https://a996c8ee.aww-3cz.pages.dev/posts/2023/03/sending-slack-messages-with-python/</guid>
      <description>&lt;p&gt;Here&amp;rsquo;s a quick summary of what we&amp;rsquo;ve talked about in the last few posts &amp;ndash; all with &lt;a href=&#34;https://www.python.org/&#34;&gt;Python&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;We&amp;rsquo;ve &lt;a href=&#34;https://aconaway.com/2022/12/11/querying-netbox-with-pynetbox/&#34;&gt;asked Netbox to provide some info&lt;/a&gt; using &lt;a href=&#34;https://pynetbox.readthedocs.io/en/latest/&#34;&gt;pynetbox&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;We&amp;rsquo;ve &lt;a href=&#34;https://aconaway.com/2023/01/17/adding-stuff-to-netbox-with-pynetbox/&#34;&gt;added stuff to Netbox&lt;/a&gt; using pynetbox.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;We&amp;rsquo;ve &lt;a href=&#34;https://aconaway.com/2023/01/25/updating-stuff-on-netbox-with-pynetbox/&#34;&gt;updated&lt;/a&gt; and &lt;a href=&#34;https://aconaway.com/2023/02/24/deleting-stuff-from-netbox-with-pynetbox/&#34;&gt;deleted stuff&lt;/a&gt; in Netbox using pynetbox.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;We&amp;rsquo;ve &lt;a href=&#34;https://aconaway.com/2023/02/26/using-python-logging-to-figure-out-what-you-did-wrong/&#34;&gt;logged our messages with Python logging&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This is all fine and dandy, but I would guess that you&amp;rsquo;re not the only engineer in the company and production maintenance scripts don&amp;rsquo;t run off of your laptop. We need a way to let a group of people know what&amp;rsquo;s happening when one of your scripts is run. And please don&amp;rsquo;t say email. Email has been worthless for alerting for over a decade, and there are better ways to do it. Search your feelings&amp;hellip;you know it to be true!&lt;/p&gt;</description>
    </item>
    <item>
      <title>Deleting Stuff from Netbox with Pynetbox</title>
      <link>https://a996c8ee.aww-3cz.pages.dev/posts/2023/02/deleting-stuff-from-netbox-with-pynetbox/</link>
      <pubDate>Fri, 24 Feb 2023 00:00:00 +0000</pubDate>
      <guid>https://a996c8ee.aww-3cz.pages.dev/posts/2023/02/deleting-stuff-from-netbox-with-pynetbox/</guid>
      <description>&lt;p&gt;As a warning to everyone, I am not a developer. I am a network engineer who is trying to do some automation stuff. Some of what I’m doing sounds logical to me, but I would not trust my own opinions for production work. I’m sure you can find a &lt;a href=&#34;https://netdev.chat/&#34;&gt;Slack channel&lt;/a&gt; or &lt;a href=&#34;https://infosec.exchange/explore&#34;&gt;Mastodon instance&lt;/a&gt; with people who can tell you how to do things properly.&lt;/p&gt;&#xA;&lt;p&gt;We&amp;rsquo;ve added stuff and updated stuff, so let&amp;rsquo;s delete some stuff. &amp;ldquo;Hey, man&amp;hellip;you already did that,&amp;rdquo; you say? You&amp;rsquo;re right! When &lt;a href=&#34;https://aconaway.com/2023/01/12/using-pynetbox-to-create-netbox-api-tokens/&#34;&gt;we started creating API tokens based on user/pass&lt;/a&gt;, we made sure to delete the token at the end. That means we should all be professional &lt;a href=&#34;https://pynetbox.readthedocs.io/en/latest/&#34;&gt;pynetbox&lt;/a&gt; deleters, then, right? :)&lt;/p&gt;</description>
    </item>
    <item>
      <title>Updating Stuff on Netbox with Pynetbox</title>
      <link>https://a996c8ee.aww-3cz.pages.dev/posts/2023/01/updating-stuff-on-netbox-with-pynetbox/</link>
      <pubDate>Wed, 25 Jan 2023 00:00:00 +0000</pubDate>
      <guid>https://a996c8ee.aww-3cz.pages.dev/posts/2023/01/updating-stuff-on-netbox-with-pynetbox/</guid>
      <description>&lt;p&gt;Let&amp;rsquo;s see. We&amp;rsquo;ve &lt;a href=&#34;https://aconaway.com/2022/12/11/querying-netbox-with-pynetbox/&#34;&gt;queried stuff&lt;/a&gt; on &lt;a href=&#34;https://docs.netbox.dev/en/stable/&#34;&gt;Netbox&lt;/a&gt; and &lt;a href=&#34;https://aconaway.com/2023/01/17/adding-stuff-to-netbox-with-pynetbox/&#34;&gt;added stuff&lt;/a&gt; to Netbox. Now let&amp;rsquo;s update stuff.&lt;/p&gt;&#xA;&lt;p&gt;Netbox, like all sources of truth, needs to be kept up-to-date if it&amp;rsquo;s going to be useful. Without doing some maintenance on the data, it will wind up being like that one Visio diagram that you give the auditors &amp;ndash; it might have been accurate at one point but gets further and further from the truth every day. We&amp;rsquo;ll need to keep our stuff updated today in order to use it more effectively tomorrow.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Adding Stuff to Netbox with Pynetbox</title>
      <link>https://a996c8ee.aww-3cz.pages.dev/posts/2023/01/adding-stuff-to-netbox-with-pynetbox/</link>
      <pubDate>Tue, 17 Jan 2023 00:00:00 +0000</pubDate>
      <guid>https://a996c8ee.aww-3cz.pages.dev/posts/2023/01/adding-stuff-to-netbox-with-pynetbox/</guid>
      <description>&lt;p&gt;As a warning to everyone, I am not a developer. I am a network engineer who is trying to do some automation stuff. Some of what I’m doing sounds logical to me, but I would not trust my own opinions for production work. I’m sure you can find a &lt;a href=&#34;https://netdev.chat/&#34;&gt;Slack channel&lt;/a&gt; or &lt;a href=&#34;https://infosec.exchange/explore&#34;&gt;Mastodon instance&lt;/a&gt; with people who can tell you how to do things properly.&lt;/p&gt;&#xA;&lt;p&gt;I think there&amp;rsquo;s a theme in the last few posts. I can&amp;rsquo;t quite put my finger on it, though. :) We&amp;rsquo;ve talked about querying &lt;a href=&#34;https://docs.netbox.dev/en/stable/&#34;&gt;Netbox&lt;/a&gt;, but it&amp;rsquo;s pretty useless without data actually in it. Let&amp;rsquo;s look at how to get stuff in there using &lt;a href=&#34;https://github.com/netbox-community/pynetbox&#34;&gt;pynetbox&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Query Filtering with Pynetbox</title>
      <link>https://a996c8ee.aww-3cz.pages.dev/posts/2023/01/query-filtering-with-pynetbox/</link>
      <pubDate>Mon, 16 Jan 2023 00:00:00 +0000</pubDate>
      <guid>https://a996c8ee.aww-3cz.pages.dev/posts/2023/01/query-filtering-with-pynetbox/</guid>
      <description>&lt;p&gt;As a warning to everyone, I am not a developer. I am a network engineer who is trying to do some automation stuff. Some of what I’m doing sounds logical to me, but I would not trust my own opinions for production work. I’m sure you can find a &lt;a href=&#34;https://netdev.chat/&#34;&gt;Slack channel&lt;/a&gt; or &lt;a href=&#34;https://infosec.exchange/explore&#34;&gt;Mastodon instance&lt;/a&gt; with people who can tell you how to do things properly.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://aconaway.com/2022/12/11/querying-netbox-with-pynetbox/&#34;&gt;A bit ago&lt;/a&gt;, we talked about getting information out of Netbox with Pynetbox. The example was very simple, but I&amp;rsquo;m afraid the real world dictates that querying every device every time is not very efficient or manageable. At some point, we&amp;rsquo;ll need to ask for a subset of everything, so let&amp;rsquo;s look at filtering.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Using Pynetbox to Create Netbox API Tokens</title>
      <link>https://a996c8ee.aww-3cz.pages.dev/posts/2023/01/using-pynetbox-to-create-netbox-api-tokens/</link>
      <pubDate>Thu, 12 Jan 2023 00:00:00 +0000</pubDate>
      <guid>https://a996c8ee.aww-3cz.pages.dev/posts/2023/01/using-pynetbox-to-create-netbox-api-tokens/</guid>
      <description>&lt;p&gt;As a warning to everyone, I am not a developer. I am a network engineer who is trying to do some automation stuff. Some of what I&amp;rsquo;m doing sounds logical to me, but I would not trust my own opinions for production work. I&amp;rsquo;m sure you can find a &lt;a href=&#34;https://netdev.chat/&#34;&gt;Slack channel&lt;/a&gt; or &lt;a href=&#34;https://infosec.exchange/explore&#34;&gt;Mastodon instance&lt;/a&gt; with people who can tell you how to do things properly.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://aconaway.com/2022/12/11/querying-netbox-with-pynetbox/&#34;&gt;The last time&lt;/a&gt;, I talked about using &lt;a href=&#34;https://github.com/netbox-community/pynetbox&#34;&gt;pynetbox&lt;/a&gt; to make queries to &lt;a href=&#34;https://github.com/netbox-community/netbox&#34;&gt;Netbox&lt;/a&gt;. This was a very simple example, and one of the things that bugged me the most about it was the &lt;a href=&#34;https://docs.netbox.dev/en/stable/integrations/rest-api/#tokens&#34;&gt;API token&lt;/a&gt;. In that post, we used a statically-assigned API token where I went into the Netbox GUI and generated one for myself. I think I may have even noted that this was definitely not the best way to handle those things. A possibly-better way to do it is to use your username and password on Netbox to generate a token for yourself. This would a token that you then delete when you&amp;rsquo;re done.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
