{"id":106,"date":"2017-01-26T05:55:33","date_gmt":"2017-01-26T05:55:33","guid":{"rendered":"http:\/\/blog.lns.com\/?p=106"},"modified":"2020-01-21T20:09:03","modified_gmt":"2020-01-21T20:09:03","slug":"librenms-api","status":"publish","type":"post","link":"https:\/\/blog.lns.com\/?p=106","title":{"rendered":"Librenms&#8217; API"},"content":{"rendered":"<p><a href=\"http:\/\/www.librenms.org\/\" target=\"_blank\" rel=\"noopener\">Librenms<\/a> is a very flexible network and server monitoring and alerting system. \u00a0I have it deployed at a number of companies based on the ease of installation, the fact that it auto discovers devices, it is updated frequently (<a href=\"https:\/\/github.com\/librenms\/librenms\/graphs\/commit-activity\" target=\"_blank\" rel=\"noopener\">typically multiple times a week<\/a>) and supports pretty much every network device you can think of.<\/p>\n<p>On top of that, the alerting can be tuned to match very specific cases as the back end is MySQL so you alerting conditions can match almost anything you can write a SQL query for. \u00a0A good example would be to only alert on certain interfaces that have a specific description in them such as &#8220;TRANSIT&#8221; where the device has a hostname of &#8220;edge&#8221; and is only a 10Gbs connection (the interface name is &#8216;xe&#8217;). \u00a0Because you can group things by description or part of a hostname, you can just say anything with the string &#8220;edge&#8221; in the hostname should be considered a &#8220;edge router&#8221; so a group &#8220;ER&#8221; can be created for these devices. \u00a0With autodiscovery, as soon as you add a device, it will get automatically be put into the group that the rule\/regular expression matches it.<\/p>\n<p>One of the more interesting features is <a href=\"http:\/\/docs.librenms.org\/API\/API-Docs\/\" target=\"_blank\" rel=\"noopener\">Libre&#8217;s API<\/a>. \u00a0You can get pretty much any detail you want out of what Libre has collected and stored in the DB. \u00a0It will also create graphs for you on the fly. \u00a0One case I have had in the past is to create daily and weekly total bandwidth graphs for a set of specific ports on a group of switches. \u00a0The switch ports have a particular unique string I can match on so I was able to create a &#8220;group&#8221; called &#8220;peering&#8221; that included these ports over all of the switches.<\/p>\n<p>I wrote this simple script called <a href=\"https:\/\/github.com\/pozar\/sysadmin_scripts\/blob\/master\/create_public_graphs.sh\" target=\"_blank\" rel=\"noopener\">create_public_graphs.sh<\/a>\u00a0that asked for a graph for daily and weekly time frames. \u00a0I also added various options to the request such as don&#8217;t show the legend of interfaces and make the in and out directions all one color. \u00a0The other option is to make different colors for each interface. \u00a0We wanted a clean look so we went for a solid color. \u00a0The API doesn&#8217;t do everything you may want such as titling the graph. \u00a0This is where I use the &#8220;convert&#8221; program from\u00a0<span class=\"s1\"><a href=\"https:\/\/www.imagemagick.org\" target=\"_blank\" rel=\"noopener\">imagemagick<\/a> to overlay some text at the top of the graph. \u00a0You can see the final result at the <a href=\"https:\/\/sfmix.org\/services\/statistics\" target=\"_blank\" rel=\"noopener\">SFMIX site<\/a>.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Librenms is a very flexible network and server monitoring and alerting system. \u00a0I have it deployed at a number of companies based on the ease of installation, the fact that it auto discovers devices, it is updated frequently (typically multiple times a week) and supports pretty much every network device you can think of. On &hellip; <a href=\"https:\/\/blog.lns.com\/?p=106\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Librenms&#8217; API&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,13],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.lns.com\/index.php?rest_route=\/wp\/v2\/posts\/106"}],"collection":[{"href":"https:\/\/blog.lns.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.lns.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.lns.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.lns.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=106"}],"version-history":[{"count":3,"href":"https:\/\/blog.lns.com\/index.php?rest_route=\/wp\/v2\/posts\/106\/revisions"}],"predecessor-version":[{"id":176,"href":"https:\/\/blog.lns.com\/index.php?rest_route=\/wp\/v2\/posts\/106\/revisions\/176"}],"wp:attachment":[{"href":"https:\/\/blog.lns.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.lns.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.lns.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}