[SOLVED] NDOUtils Nagios and MySQL Server on different hosts

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: NDOUtils - Nagios and MySQL Server on different hosts

Post by abrist »

My apologies. I need the ndo2db.cfg file instead.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
sebastiaopburnay
Posts: 105
Joined: Sun Oct 31, 2010 1:40 pm
Location: Lisbon, Portugal

Re: NDOUtils - Nagios and MySQL Server on different hosts

Post by sebastiaopburnay »

Both files have been extracted in 'binary mode' so that they will show if something is wrong
Attachments
ndo2db.cfg
(4.42 KiB) Downloaded 501 times
ndomod.cfg
(5.01 KiB) Downloaded 421 times
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: NDOUtils - Nagios and MySQL Server on different hosts

Post by abrist »

You know, sockets actually have a trailing equals sign, it is just normally hidden, but can be listed with "ls -F". Maybe your "ll" alias includes "-F". What is the output of:

Code: Select all

alias -p
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
sebastiaopburnay
Posts: 105
Joined: Sun Oct 31, 2010 1:40 pm
Location: Lisbon, Portugal

Re: NDOUtils - Nagios and MySQL Server on different hosts

Post by sebastiaopburnay »

You're right,

I thought that ll was just an 'ls -l' but is seems to be 'ls -alF':

Code: Select all

root@myServer:~# alias -p
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'
When I ran 'ls -l' I got rid of the '='

Code: Select all

root@myServer:/usr/local/nagios/var# ls -l
total 1544
drwxrwxr-x 2 nagios nagios    4096 Dec  4 00:00 archives
-rw-r--r-- 1 nagios nagios       6 Dec  4 15:42 nagios.lock
-rw-rw-r-- 1 nagios nagios 1507298 Dec  4 18:22 nagios.log
srwxr-xr-x 1 nagios nagios       0 Dec  3 17:16 ndo.sock
-rw-rw-rw- 1 nagios nagios       0 Nov 29 17:07 ndo2db.debug
-rw-r--r-- 1 nagios nagios       4 Dec  3 17:16 ndo2db.lock
-rw-r--r-- 1 nagios nagios   13840 Dec  4 15:42 objects.cache
-rw------- 1 nagios nagios   14877 Dec  4 17:42 retention.dat
drwxrwsr-x 2 nagios nagcmd    4096 Dec  4 15:42 rw
drwxr-xr-x 3 root   root      4096 Jul  4 19:18 spool
-rw-rw-r-- 1 nagios nagios   15473 Dec  4 18:22 status.dat
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: NDOUtils - Nagios and MySQL Server on different hosts

Post by abrist »

Well, dang. There is most likely nothing wrong with the socket. Lets check to see if you can log into the remote database. From the nagios core server, run:

Code: Select all

mysql -u nagios -p'<PASSWORD>' -h <IP_ADDRESS_OF_MYSQL_SERVER> 
Make sure to replace <PASSWORD> and <IP_ADDRESS_OF_MYSQL_SERVER>.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
sebastiaopburnay
Posts: 105
Joined: Sun Oct 31, 2010 1:40 pm
Location: Lisbon, Portugal

Re: NDOUtils - Nagios and MySQL Server on different hosts

Post by sebastiaopburnay »

abrist wrote:Well, dang. There is most likely nothing wrong with the socket. Lets check to see if you can log into the remote database. From the nagios core server, run:

Code: Select all

mysql -u nagios -p'<PASSWORD>' -h <IP_ADDRESS_OF_MYSQL_SERVER> 
Make sure to replace <PASSWORD> and <IP_ADDRESS_OF_MYSQL_SERVER>.
Yes, at first, I thought that was my problem,

But I can actually use CLI to connect to MySQL server from Nagos Core Server

Code: Select all

root@myServer:/usr/local/nagios/etc# mysql -u nagios  -h 172.20.81.135 -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 194
Server version: 5.5.31-0ubuntu0.12.04.2-log (Ubuntu)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use ndoutils
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> SELECT * FROM nagios_hosts;
Empty set (0.00 sec)

mysql> 
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: NDOUtils - Nagios and MySQL Server on different hosts

Post by abrist »

From your ndo2db.cfg:

Code: Select all

# DATABASE USERNAME/PASSWORD
# This is the username/password that will be used to authenticate to the DB.
# The user needs at least SELECT, INSERT, UPDATE, and DELETE privileges on
# the database.

db_user=nagios
db_pass=nagios
Is the pass actually 'nagios'? Does the nagios db user have the correct privileges?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
sebastiaopburnay
Posts: 105
Joined: Sun Oct 31, 2010 1:40 pm
Location: Lisbon, Portugal

Re: NDOUtils - Nagios and MySQL Server on different hosts

Post by sebastiaopburnay »

abrist wrote:From your ndo2db.cfg:
Is the pass actually 'nagios'? Does the nagios db user have the correct privileges?
Yes, I kept it like that unill I could figure the communications properly,

About the privilleges, I've done a:

Code: Select all

GRANT ALL ON ndoutils.* TO 'nagios'@'172.20.82.134' IDENTIFIED BY 'nagios';
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
So, I guess that the user even has more privileges than it needs
User avatar
sebastiaopburnay
Posts: 105
Joined: Sun Oct 31, 2010 1:40 pm
Location: Lisbon, Portugal

Re: NDOUtils - Nagios and MySQL Server on different hosts

Post by sebastiaopburnay »

sebastiaopburnay wrote:
abrist wrote:From your ndo2db.cfg:
Is the pass actually 'nagios'? Does the nagios db user have the correct privileges?
Yes, I kept it like that unill I could figure the communications properly,

About the privilleges, I've done a:

Code: Select all

GRANT ALL ON ndoutils.* TO 'nagios'@'172.20.82.134' IDENTIFIED BY 'nagios';
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
So, I guess that the user even has more privileges than it needs
I'm now wondering if I should try to reinstall NDOUtils on my Nagios Core server.

I don't need anything else than MySQL server, NDOUtils database and correct privileges on my MySQL Server, do I?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: NDOUtils - Nagios and MySQL Server on different hosts

Post by abrist »

sebastiaopburnay wrote:I don't need anything else than MySQL server, NDOUtils database and correct privileges on my MySQL Server, do I?
Nope, that is all you need on the remote system.
Any logs worth mentioning from the remote db?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked