From 39e504541b76fbf8b4076c0b5790fc60426ffd7b Mon Sep 17 00:00:00 2001 From: laf Date: Mon, 11 May 2015 23:16:55 +0100 Subject: [PATCH 1/2] Added info on migrating from Observium --- scripts/LibreNMS.zip | Bin 0 -> 5256 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 scripts/LibreNMS.zip diff --git a/scripts/LibreNMS.zip b/scripts/LibreNMS.zip new file mode 100644 index 0000000000000000000000000000000000000000..f317bf26178921ccea6727131e52e1a7b2d5f623 GIT binary patch literal 5256 zcmeI0c|276-@u2lH+DiqE~D&Q_MJ?F#!h1y`xuk#43exVBcUM@S{O@i$dV;QB2)HE zV@dWUH#-TbXLN5@zx(L+JbypWnb$dI=8y0Dyv}@<@B8~TH3Cv`0QL@$9~ScM%U_qH zo2tTI+z-bnv?|lWpLS`yAT3;^o6)5SaF;6u;%dh)h`ywTQ@hHNK7Wyl zg%iLe$cgu%+38%dyMrD_nw{Xg+^|LGBsA^XXOfqh*jh}4{i*`$X3UhVQrvq+ zVcoR>G0B>!v@#w*YZ=d#R-v4z_^K1XGn=*Hhf5SAjS`SRl;7i+^NPHtr?_JJF7Fok zIRqwS`EXA9m8{~h_}ia(P0K}zw1x9E2C|2SC4n<)9P609kDgo0Vj#XWadSV zd2V_o41V1eIGtErk(6Hjd&5*;bhC%z2lmo&2N$$phK*yQhhckJ`3wRo8zz0Tgl zmB-2jS8!fx4qI^g<>-dm`ID4ql&Tz~MTCOMCuIzNZ z&XX7c#}hd{fc(g13A`+iN0!oPouyhT+xMJ0 zYa2RiymEGA#V9I9Y}Hp%qE(EWfzWWKCXx6_lXw}X-xT!KanuW8xVCOzH68h}D4Fth z?V7-tX+?G47VUmXWsytDerLv$L;(NZ0SLQJo@90=R9!9pHCz}|mL14G@wD6cbs#l1mTFcIi{ADVl; z{*oWzbNP{W7Amzhes zJ0J#0+DqHxZ&E?B3hCZzYAJ3pOb+$0Z{c76}g=?vG;*O+9-zK^V7s ziJiSR!zO$4%N7kmU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2aZmvX4(8J&i zbfqOHMSzKuGj><}uK+J}jt%fNan04p^>mKRa0Z-(cjg(ako|zob`1oiz$*F;BD6hA z+YBq$=LJWHj5wat2OhcbQO$(x2kIB!oi1(I7WqSffAwP$LryP;AzFryrhS6?+_F=coqPDDypv96?lvR?jes^=VTK{^%> z2kUv+K2Y%%YC3kTu$}!)S^oM0)x2RQ%!hlhK$l?(HT@Ke_$*2M#Pz*s=>SLkv5@%| zF|h_p03d<}0N862e|!BuiuSui?A4#8QNU{%7R?t=Cvxf2ja`BA_H-Jl!oXVwIO8my z8nf0Lt}rhG)PKnMeFO@rmUQ@8(>+yXOyv;qQqn>r*4kWO+`Zy%!q!WMiWDn~0@*Zi zA@_7ywug$(;6+v}fnV!cn7MGpV94YQQtr+;)FXXfLLTkRE@VV<4?Zl#{t2U^FBagO zas*8%m5&bGs%H5Sg zQ1LY7d1i9RcbSXBKuKS1PU~zO$|bm{uZOgqrr1cxBYQ3M3ZbLU`VEN_ggxi-bw>wN;m2aVMi2HVkp^_j7Q& zIs5}H32`d_Y#HXUS3uol5Z7d{+g7l8ok_@VftX4~MjPLURMwkLaNcGL+gCAlW4as{^cds&drJqIEr%5J?Fz2v4W6yG2ncV| z@?tBRtE!(YJHGzW-epY+EypOI|Hg%6OMw2i$db<##SsS#X`<^&n)3?XrQXl}*nc?E zv46?_|JS4c3wk8{FB$N^HX{m34#3a1PsmRqA1r^~_M7g(n2XCkBF(?4X$X7M; z`FH<52=(7KS4@re*$1sF$-uwZ*U5_Zuk7y=#QrMtNBBVtl6`nN^)KMx>+eV8L2|o~ ztfl=0^2dPgV-GgjJ?x*+5+Ymb-+#kDrpSE?9pE6d-DCV2sJ)%ApHcQb_eb7AQ}sS? z;Ly)`-{V4_xPJs5)cy8>Z0st_OKMLf0(_r2E F^ Date: Tue, 12 May 2015 08:54:56 +0100 Subject: [PATCH 2/2] Actually added the doc and contents --- doc/Installation/Migrating-from-Observium.md | 7 +++ .../Standard_Conversion/convert_no_xml.sh | 53 ++++++++++++++++++ .../Standard_Conversion/destwork_no_xml.sh | 28 ++++++++++ .../Migration/Standard_Conversion/mkdir.sh | 26 +++++++++ .../Standard_Conversion/nodelist.txt | 3 ++ scripts/Migration/XML_Conversion/convert.sh | 54 +++++++++++++++++++ scripts/Migration/XML_Conversion/destwork.sh | 41 ++++++++++++++ scripts/Migration/XML_Conversion/mkdir.sh | 26 +++++++++ scripts/Migration/XML_Conversion/nodelist.txt | 3 ++ 9 files changed, 241 insertions(+) create mode 100644 doc/Installation/Migrating-from-Observium.md create mode 100644 scripts/Migration/Standard_Conversion/convert_no_xml.sh create mode 100644 scripts/Migration/Standard_Conversion/destwork_no_xml.sh create mode 100644 scripts/Migration/Standard_Conversion/mkdir.sh create mode 100644 scripts/Migration/Standard_Conversion/nodelist.txt create mode 100644 scripts/Migration/XML_Conversion/convert.sh create mode 100644 scripts/Migration/XML_Conversion/destwork.sh create mode 100644 scripts/Migration/XML_Conversion/mkdir.sh create mode 100644 scripts/Migration/XML_Conversion/nodelist.txt diff --git a/doc/Installation/Migrating-from-Observium.md b/doc/Installation/Migrating-from-Observium.md new file mode 100644 index 000000000..65cc793f3 --- /dev/null +++ b/doc/Installation/Migrating-from-Observium.md @@ -0,0 +1,7 @@ +## Migrating from Observium to LibreNMS + +A LibreNMS user, [Dan](https://twitter.com/thedanbrown), has kindly provided full details and scripts to be able to migrate from Observium to LibreNMS. + +See [his](https://vlan50.com/2015/04/17/migrating-from-observium-to-librenms/) blog for full details. + +We have mirrored the scripts he's provided with consent, these are available in the `scripts` folder of your installation called LibreNMS.zip. diff --git a/scripts/Migration/Standard_Conversion/convert_no_xml.sh b/scripts/Migration/Standard_Conversion/convert_no_xml.sh new file mode 100644 index 000000000..ae732304a --- /dev/null +++ b/scripts/Migration/Standard_Conversion/convert_no_xml.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Observium to LibreNMS conversion + +####################### SCRIPT DESCRIPTION ######################## +# First we SSH to LibreNMS and create necessary directories with # +# the mkdir script. Then the script enters each Observium RRD dir # +# and SCPs the RRD files to the correct directory on LibreNMS. # +# After that we add all of the devices to LibreNMS using the # +# destwork script. # +################################################################### + +########################### DIRECTIONS ############################ +# Run as Root from the Observium server # +# # +# Enter values for DEST, L_RRDPATH, O_RRDPATH, MKDIR, DESTSCRIPT, # +# and NODELIST. The defaults should work if you put the files in # +# the same location. # +################################################################### + +############################# CREDITS ############################# +# LibreNMS work is done by a great group - http://librenms.org # +# Script Written by - Dan Brown - http://vlan50.com # +################################################################### + + +# Enter LibreNMS IP or hostname here +DEST=10.0.253.35 +# Enter LibreNMS RRD path here +L_RRDPATH=/opt/librenms/rrd/ +# Enter Observium RRD path here +O_RRDPATH=/opt/observium/rrd/ +# Enter path to mkdir script here +MKDIR=/tmp/mkdir.sh +# Enter path to destwork script here +DESTSCRIPT=/tmp/destwork.sh +# Enter path to nodelist text file +NODELIST=/tmp/nodelist.txt + +# This line SSHs to LibreNMS server and makes directories based on node list text file +ssh root@$DEST 'bash -s' < $MKDIR + +# Conversion and transfer loop +while read line; + # Enter RRD Directory + do cd $O_RRDPATH"${line%/*}" + # Transfer RRD files to LibreNMS Server + scp *.rrd root@$DEST:$L_RRDPATH"${line%/*}"/ + # Exit to parent dir + cd .. + done < $NODELIST + +# This line SSHs to LibreNMS server and runs the destwork script to finish conversion +ssh root@$DEST 'bash -s' < $DESTSCRIPT \ No newline at end of file diff --git a/scripts/Migration/Standard_Conversion/destwork_no_xml.sh b/scripts/Migration/Standard_Conversion/destwork_no_xml.sh new file mode 100644 index 000000000..40f911b69 --- /dev/null +++ b/scripts/Migration/Standard_Conversion/destwork_no_xml.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# Observium to LibreNMS conversion + +####################### SCRIPT DESCRIPTION ######################## +# A simple script to add each host in text file to LibreNMS # +################################################################### + +########################### DIRECTIONS ############################ +# Enter values for ADDHOST, SNMPSTRING, and NODELIST. The default # +# should work if you put the files in the same location. # +################################################################### + +############################# CREDITS ############################# +# LibreNMS work is done by a great group - http://librenms.org # +# Script Written by - Dan Brown - http://vlan50.com # +################################################################### + +# Enter path to LibreNMS addhost module +ADDHOST=/opt/librenms/addhost.php +# Enter your unique SNMP String +SNMPSTRING=cisconetwork +# Enter path to nodelist text file +NODELIST=/tmp/nodelist.txt + +while read line + # Add each host from the node list file to LibreNMS + do php $ADDHOST "${line%/*}" $SNMPSTRING v2c; +done < $NODELIST \ No newline at end of file diff --git a/scripts/Migration/Standard_Conversion/mkdir.sh b/scripts/Migration/Standard_Conversion/mkdir.sh new file mode 100644 index 000000000..54c769e12 --- /dev/null +++ b/scripts/Migration/Standard_Conversion/mkdir.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Observium to LibreNMS conversion + +####################### SCRIPT DESCRIPTION ######################## +# A simple script to create needed directories on LibreNMS server # +################################################################### + +########################### DIRECTIONS ############################ +# Enter values for NODELIST, L_RRDPATH. The default should work if# +# you put the files in the same location. # +################################################################### + +############################# CREDITS ############################# +# LibreNMS work is done by a great group - http://librenms.org # +# Script Written by - Dan Brown - http://vlan50.com # +################################################################### + +# Enter path to node list text file +NODELIST=/tmp/nodelist.txt +# Enter path to LibreNMS RRD directories +L_RRDPATH=/opt/librenms/rrd/ + +# This loop enters the RRD folder and creates dir based on contents of node list text file +while read line + do mkdir -p $L_RRDPATH"${line%/*}" +done < $NODELIST \ No newline at end of file diff --git a/scripts/Migration/Standard_Conversion/nodelist.txt b/scripts/Migration/Standard_Conversion/nodelist.txt new file mode 100644 index 000000000..c1c041e97 --- /dev/null +++ b/scripts/Migration/Standard_Conversion/nodelist.txt @@ -0,0 +1,3 @@ +example1.yourdomain.net +example2.yourdomain.net +example3.yourdomain.net \ No newline at end of file diff --git a/scripts/Migration/XML_Conversion/convert.sh b/scripts/Migration/XML_Conversion/convert.sh new file mode 100644 index 000000000..12b0d648c --- /dev/null +++ b/scripts/Migration/XML_Conversion/convert.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# Observium to LibreNMS conversion + +####################### SCRIPT DESCRIPTION ######################## +# First we SSH to LibreNMS and create necessary directories with # +# the mkdir script. Then the script enters each Observium RRD dir # +# converts the RRDs to XML and SCPs the XML files to the correct # +# directory on LibreNMS. After that we add all of the devices to # +# to LibreNMS using the destwork script. # +################################################################### + +########################### DIRECTIONS ############################ +# Run as Root from the Observium server # +# # +# Enter values for DEST, L_RRDPATH, O_RRDPATH, MKDIR, DESTSCRIPT, # +# and NODELIST. The defaults should work if you put the files in # +# the same location. # +################################################################### + +############################# CREDITS ############################# +# LibreNMS work is done by a great group - http://librenms.org # +# Script Written by - Dan Brown - http://vlan50.com # +################################################################### + +# Enter LibreNMS IP or hostname here +DEST=10.0.253.35 +# Enter LibreNMS RRD path here +L_RRDPATH=/opt/librenms/rrd/ +# Enter Observium RRD path here +O_RRDPATH=/opt/observium/rrd/ +# Enter path to mkdir script here +MKDIR=/tmp/mkdir.sh +# Enter path to destwork script here +DESTSCRIPT=/tmp/destwork.sh +# Enter path to nodelist text file +NODELIST=/tmp/nodelist.txt + +# This line SSHs to LibreNMS server and makes directories based on node list text file +ssh root@$DEST 'bash -s' < $MKDIR + +# Conversion and transfer loop +while read line; + # Enter RRD Directory + do cd $O_RRDPATH"${line%/*}" + # Convert each RRD to XML + for f in *.rrd; do rrdtool dump ${f} > ${f}.xml; done + # Transfer XML file to LibreNMS Server + scp *.xml root@$DEST:$L_RRDPATH"${line%/*}"/ + # Exit to parent dir + cd .. + done < $NODELIST + +# This line SSHs to LibreNMS server and runs the destwork script to finish conversion +ssh root@$DEST 'bash -s' < $DESTSCRIPT \ No newline at end of file diff --git a/scripts/Migration/XML_Conversion/destwork.sh b/scripts/Migration/XML_Conversion/destwork.sh new file mode 100644 index 000000000..14840cade --- /dev/null +++ b/scripts/Migration/XML_Conversion/destwork.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# Observium to LibreNMS conversion + +####################### SCRIPT DESCRIPTION ######################## +# This script converts the XML files from Observium back to RRD # +# files for use with LibreNMS. It then adds the device using the # +# Addhost function of LibreNMS # +################################################################### + +########################### DIRECTIONS ############################ +# Enter values for L_RRDPATH, ADDHOST, SNMPSTRING, and NODELIST. # +#The default should work if you put the files in the same location# +################################################################### + +############################# CREDITS ############################# +# LibreNMS work is done by a great group - http://librenms.org # +# Script Written by - Dan Brown - http://vlan50.com # +################################################################### + +# Enter path to LibreNMS RRD directories +L_RRDPATH=/opt/librenms/rrd/ +# Enter path to LibreNMS addhost module +ADDHOST=/opt/librenms/addhost.php +# Enter your unique SNMP String +SNMPSTRING=cisconetwork +# Enter path to nodelist text file +NODELIST=/tmp/nodelist.txt + +# Loop enters RRD directory and then each folder based on contents of node list text file +while read line + # Enter the directory + do cd $L_RRDPATH"${line%/*}" + # Convert from XML back to RRD + for f in *.xml; do rrdtool restore ${f} `echo ${f} | cut -f1 -d .`.rrd; done; + # Remove leftover XML files + rm *.xml; + # Add the host to LibreNMS + php $ADDHOST "${line%/*}" $SNMPSTRING v2c; + # Change back to parent directory + cd ..; + done < $NODELIST \ No newline at end of file diff --git a/scripts/Migration/XML_Conversion/mkdir.sh b/scripts/Migration/XML_Conversion/mkdir.sh new file mode 100644 index 000000000..54c769e12 --- /dev/null +++ b/scripts/Migration/XML_Conversion/mkdir.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Observium to LibreNMS conversion + +####################### SCRIPT DESCRIPTION ######################## +# A simple script to create needed directories on LibreNMS server # +################################################################### + +########################### DIRECTIONS ############################ +# Enter values for NODELIST, L_RRDPATH. The default should work if# +# you put the files in the same location. # +################################################################### + +############################# CREDITS ############################# +# LibreNMS work is done by a great group - http://librenms.org # +# Script Written by - Dan Brown - http://vlan50.com # +################################################################### + +# Enter path to node list text file +NODELIST=/tmp/nodelist.txt +# Enter path to LibreNMS RRD directories +L_RRDPATH=/opt/librenms/rrd/ + +# This loop enters the RRD folder and creates dir based on contents of node list text file +while read line + do mkdir -p $L_RRDPATH"${line%/*}" +done < $NODELIST \ No newline at end of file diff --git a/scripts/Migration/XML_Conversion/nodelist.txt b/scripts/Migration/XML_Conversion/nodelist.txt new file mode 100644 index 000000000..c1c041e97 --- /dev/null +++ b/scripts/Migration/XML_Conversion/nodelist.txt @@ -0,0 +1,3 @@ +example1.yourdomain.net +example2.yourdomain.net +example3.yourdomain.net \ No newline at end of file