OpenNMS and Grafana setup - marko4449/Documentation2 GitHub Wiki
Prerequisites
Before adding OpenNMS and Grafana there are some packages that we must install.
PostgreSQL
Oracle JDK
UFW
Apache(for Grafana)
Postgresql installation
apt-get install postgresql
Then we have to allow root to access the database. This is done by editing the pg_hba.conf file in /etc/postgresql/9.x/main/pg_hba.conf
. Next we will change the following lines
local all all local
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
to
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
If this is done restart postgres and enable it to start on boot
systemctl restart postgresql
systemctl enable postgresql
Installing Java
Downloading the package to use the apt-get-repository command.
apt-get install software-properties-common
Adding the java repository
add-apt-repository "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main"
Next we update
apt-get update
Now we install Oracle JDK
apt-get install oracle-java8-installer
Setup Oracle Java8 to be the default Java VM
apt-get install oracle-java8-set-default
usr/share/opennms/bin/runjava -s
Installing OpenNMS
Firstly we will add the OpenNMS repository to the /etc/apt/sources.list.d directory.
vim /etc/apt/sources.list.d/opennms.list
Adding the following lines
deb http://debian.opennms.org stable main
deb-src http://debian.opennms.org stable main
Next is adding the OpenNMS key
wget -O - http://debian.opennms.org/OPENNMS-GPG-KEY | apt-key add -
now to update the repository list
apt-get update
and install OpenNMS
apt-get install default-mta opennms
/usr/share/opennms/bin/install -dis
Now we start the opennms and enable it to start on boot
systemctl start opennms
Setting firewall
installing ufw
apt-get install ufw
adding rules so we can access OpenNMS web UI, ssh and opening the ports for traps
ufw allow 8980
ufw allow ssh
ufw allow 161
ufw allow 162
Accessing the Web UI
$ip:8980/opennms
Username:admin
Password:admin
Installing Grafana
Firstly to use Grafana you need to have apache installed
apt-get install apache2
Then we download the Grafana package and unpack it.
wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_4.6.2_amd64.deb
sudo dpkg -i grafana_4.6.2_amd64.deb
enabling grafana to start at boot time and starting the server
systemctl start grafana-server
systemctl enable grafana-server.service
Accessing the Web UI
$IP:3000
Username:admin
Password:admin
Setting up Grafana for OpenNMS
Firstly add the OpenNMS plugin.
grafana-cli plugins install opennms-datasource
Then restart grafana and it should say that OpenNMS plugin is installed.
systemctl restart grafana-server
Now add a data source. Give it a name, choose the type to be OpenNMS, insert the OpenNMS URL, access stays proxy, authentication basic auth, lastly add the username and password.
Next we will create API keys for OpenNMS. Grafana logo > Admin > API keys. Add a name and press create.
Important notice dont forget to write the key down somewhere.
Now we will add the key to the OpenNMS.
vim /etc/opennms/opennms.properties
Remove the comments from grafana hostname(server $ip), port, apikey(also add the api key to this line), protocol, timeout, dashboardlimit. Save it and restart OpenNMS.
Now access the Web UI and do the following:
admin > configure OpenNMS > Ops Board Configuration
Add a new dashlet called Grafana.