Page 1 of 1

trouble with nagios core imput script

Posted: Thu Jan 20, 2022 2:31 pm
by benhank
Hello I am trying to follow these instructions:

Code: Select all

https://assets.nagios.com/downloads/nagios-log-server/docs/Sending-Nagios-Core-Logs-To-Nagios-Log-Server.pdf
and when I put in my servers ipaddy and run these commands:

Code: Select all

curl -s -O http://xxx.xxx.xxx.xxx/nagioslogserver/scripts/setup-linux.sh
sudo bash setup-linux.sh -s xxx.xxx.xxx.xxx -p 5544 -f "/usr/local/nagios/var/nagios.log" -t nagios_core
I get this error on three separate nagios core servers:

Code: Select all

setup-linux.sh: line 1: syntax error near unexpected token `newline'
setup-linux.sh: line 1: `<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">'
I am running Nagios Log Server 2.1.10

Re: trouble with nagios core imput script

Posted: Fri Jan 21, 2022 11:00 am
by pbroste
Hello @benhank

Thanks for reaching out, want to verify the user account that you are logged is as and if there is security application blocking things.

Verify that you are root:

Code: Select all

whoami
Selinux is disabled:

Code: Select all

sestatus
Re-run to verify with -x switch: (the 'curl -sS -0 HTTP://..... command downloads the script so it is already in the directory)

Code: Select all

sudo bash -x setup-linux.sh -s xxx.xxx.xxx.xxx -p 5544 -f "/usr/local/nagios/var/nagios.log" -t nagios_core
Please let us know how that looks,
Perry

Re: trouble with nagios core imput script

Posted: Fri Jan 21, 2022 11:21 am
by benhank
Same error after running the modified command running as root and selinux is disabled

Re: trouble with nagios core imput script

Posted: Fri Jan 21, 2022 3:56 pm
by pbroste
Hello @benhank

What does the output on this look like?

Verifying set -e

Code: Select all

set -e
echo $HOME

Code: Select all

sudo bash -x setup-linux.sh -s xxx.xxx.xxx.xxx -p 5544 -f "/usr/local/nagios/var/nagios.log" -t nagios_core
Thanks,
Perry

Re: trouble with nagios core imput script

Posted: Mon Jan 24, 2022 9:43 am
by benhank
hi perry its fixed

I opened the

Code: Select all

/tmp/setup_linux.sh 
file.
Here are the contents:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://myhost.domain.com/nagioslogserver/scripts/setup-linux.sh">here</a>.</p>
</body></html>
So I opened the link, downloaded the file. replaced the

Code: Select all

/tmp/setup_linux.sh 
, with the one in the redirect link.
I then ran the command you gave me and its working now

Re: trouble with nagios core imput script

Posted: Mon Jan 24, 2022 10:34 am
by pbroste
Excellent, thanks for updating the post with the details on how you resolved the issue.

I will go ahead and lock this,
Perry