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/LibreNMS.zip b/scripts/LibreNMS.zip new file mode 100644 index 000000000..f317bf261 Binary files /dev/null and b/scripts/LibreNMS.zip differ 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