Clean up migration scripts by doing a chown on destination folders and files to the LibreNMS user and group, remove leftover XML files from source directories, and allow user to specify the SNMP version string in the 'settings' section of . (#4792)

This commit is contained in:
Scott Armitage
2016-10-14 16:48:04 -07:00
committed by Neil Lathwood
parent 5b96c67ec5
commit 075c94d2eb
3 changed files with 30 additions and 16 deletions

View File

@@ -6,11 +6,11 @@
###################################################################
########################### DIRECTIONS ############################
# Enter values for ADDHOST, SNMPSTRING, and NODELIST. The default #
# Enter values for ADDHOST, SNMPSTRING, and NODELIST. The default #
# should work if you put the files in the same location. #
###################################################################
############################# CREDITS #############################
############################# CREDITS #############################
# LibreNMS work is done by a great group - http://librenms.org #
# Script Written by - Dan Brown - http://vlan50.com #
###################################################################
@@ -19,10 +19,16 @@
ADDHOST=/opt/librenms/addhost.php
# Enter your unique SNMP String
SNMPSTRING=cisconetwork
# Enter SNMP version of all clients in nodelist text file
SNMPVERSION=v2c
# Enter path to nodelist text file
NODELIST=/tmp/nodelist.txt
# Enter user and group of LibreNMS installation
L_USRGRP=librenms
while read line
while read line
# Change ownership to LibreNMS user and group
chown -R $L_USRGRP:$L_USRGRP .;
# Add each host from the node list file to LibreNMS
do php $ADDHOST "${line%/*}" $SNMPSTRING v2c;
done < $NODELIST
do php $ADDHOST "${line%/*}" $SNMPSTRING $SNMPVERSION;
done < $NODELIST