Can anyone please assist on solving this issue? I'm really stuck on this and don't know what to do..
When I load the installation part on web browser I get the following error message.. firstly it was blank and I have enable display errors on php to make it happen.
Warning: require(install/functions/prepend_install.php): failed to open stream: No such file or directory in /usr/local/nagios/share/webadmin/install/index.php on line 43
Fatal error: require(): Failed opening required 'install/functions/prepend_install.php' (include_path='.:/opt/cpanel/ea-php74/root/usr/share/pear') in /usr/local/nagios/share/webadmin/install/index.php on line 43
I'm currently testing on cPanel server now.
Php v7.4
Centos 7.9
Also tested on 5.6,7.2 php versions.
Thanks!
Last edit: Jithin Jacob 2021-11-12
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It seems that your web server does not supply the environment variable SCRIPT_FILENAME correctly, which is why the variable $preBasePath is then empty. Can you explain this in more detail - usually this works reliably.
As you can see here in the code, line 22 defines the variable and then it is used several times (but not on line 43 but 37). Have you installed the same install/index.php files as showed in the link above?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for your response.
I have re-downloaded the same index that you have provided, but still, I'm seeing the blank page and when I enabled the display errors on code it shows me the same error message.
As you said, the env variable is used before and not showing the error that made me more confusing.
Do you think it's related to directory or path?
My installation of nagios goes to /usr/local/nagios/ and web files in share folder, for nagiosQL it goes to same share folder ie, /usr/local/nagios/share/webadmin
Yesterday I change the path that you have mentioned in the script to real one for the prepend_install.php, but it then shows me another error or missing file like Autoload.php. I believe all files are present on appropriate directories and while running the script it stops in the middle.
I couldn't find the exact problem.
Can you please spot me?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If the error still exists - change the code of install/index.php and output the varibale for control on line 23:
echo "VAR: " . $preBasePath;
This should print the absolute path of your nagiosql installation to the top of the screen - like:
VAR: /usr/local/nagios/share/webadmin
while the changed file is in:
/usr/local/nagios/share/webadmin/install/index.php
A Blank page has mostly the reason, that php_pear is not installed on the system. Please check.
Martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Since the output of the variable is empty, I assume that your web server does not support the environment variable SCRIPT_FILENAME. So it is incompatible with NagiosQL at the moment.
Generally, a standard Apache installation is recommended - other web servers may or may not work. The environment variable must be supported.
Martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I decided to try it on a plain server, as you suggested.
Can I use Centos 7.9 and php 7.4?
Also, I have an old setup with Nconf, can we migrate all the servers and checks to nagiosQL?
Do you have any suggestions?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unfortunately I don't know cPanel - so I can't help much.
Centos and PHP 7.4 will basically work. Some users have reported problems with SELinux on Centos - especially regarding writing configuration files and accessing Nagios files. But this should be configurable.
You can import standard Nagios configuration files into NagiosQL - no matter from which configuration tool they were written before. Of course they have to be valid configuration files :)
Martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The installation process is completed now.
Can you please guide me how can I migrate all the checks from old to new nagios?
I have checked the DB of old and new, but seem it has different methods.
I have got commands.cfg file from old server but pasting in new server not getting reflected. Also, I can see a table in database named tbl_command, is there any way I can insert the checks to the database?
I'm talking about 1700+ check commands.
Can you please help me out?
Last edit: Jithin Jacob 2021-11-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for pointing that out.
While trying to import services.cfg, I'm getting an error "File upload error: "
Also, my sevicegroups.cfg is empty.
It seems to be some kind of miss match on the fields.
Also, all the hosts are present on backend and nagiosql frontend, but it is not showing on Nagios front end.
There is huge number of service check in that file, do you have any idea how to correct this?
Thank you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can't support individual nagios installations - that would be too much work, because it would take too much time and you would have to know exactly about the environment.
Based on the error message, it could be that the services.cfg is too big. You could split it into smaller files and then import them.
Some configurations have dependencies - so they have to be imported in the right order, e.g. servicegroup after services.
Matin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry to bother you again..
I have imported all checks, hosts and services as you guided. But I have seen an "imp_" tag with all my service configuration name.
Can you please help me to get rid of it? It's harder to search on services list for a host. What change I need to be done on script. So that I can reimport all the service configurations.
Thank you!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The reason for this is that there is no data field "service configuration name" in Nagios. But to find the services and list them clearly NagiosQL tries to generate a name during import. This name starts with imp_ so that no possibly already existing service configuration names are overwritten.
Since the service configuration name is not used by Nagios, this mechanism has no negative effect.
You can change the name manually or in the database at any time.
There is a trick to add this service configuration name already in the configuration file before the import - this is probably the fastest way to a clean import:
In this case the service configuration name will be like this: hpmfplaser.domain
NagiosQL will write this value into each configuration to easily import and assign it later on.
One more addition - you can use the same service configuration name for all services of e.g. a host - so you can easily find all services from a host while set the configuration name filter.
Martin
Last edit: Martin 2021-11-19
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just one more thing..
I have imported and setup all the things as you said. Once I push restart nagios after all writing config files, its not restarting nagios service. Its still up and running on background without any downtime. I think it should show like uptime 2sec ago or like that.
Is it something I need to care about?
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
NagiosQL sends a text command to the Nagios command pipe for restarting the nagios daemon. Its path is specified in the settings of the configuration domain (Nagios command file).
check the path
make sure that the webserver demon is allowed to write into the command pipe (rights)
check the nagios logfile, if the RESTART command is visible
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Also, I could see the RESTART is passed and, It didn't restart the service until I manually restart the service.
Do you have any idea regarding the same?
Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The function does not restart the Nagios demon - it is a soft restart, which only re-reads the configuration. It is not necessary with Nagios to restart the demon after every configuration change.
PROGRAM_RESTART event encountered, restarting...
means, that this "graceful" restart was successful.
The question is - can you see the configuration changes after a soft restart in Nagios or not, e.g. a newly added service or host?
Martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Please ignore the previous reply.
Something weird was going on with DB, I just ran a mysqlcheck and its going well now.
It takes place quickly.
So the demon will be restarted in graceful mode right? no hard restart, that's fine then.
Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Can anyone please assist on solving this issue? I'm really stuck on this and don't know what to do..
When I load the installation part on web browser I get the following error message.. firstly it was blank and I have enable display errors on php to make it happen.
Warning: require(install/functions/prepend_install.php): failed to open stream: No such file or directory in /usr/local/nagios/share/webadmin/install/index.php on line 43
Fatal error: require(): Failed opening required 'install/functions/prepend_install.php' (include_path='.:/opt/cpanel/ea-php74/root/usr/share/pear') in /usr/local/nagios/share/webadmin/install/index.php on line 43
I'm currently testing on cPanel server now.
Php v7.4
Centos 7.9
Also tested on 5.6,7.2 php versions.
Thanks!
Last edit: Jithin Jacob 2021-11-12
Hello Jacob
It seems that your web server does not supply the environment variable SCRIPT_FILENAME correctly, which is why the variable $preBasePath is then empty. Can you explain this in more detail - usually this works reliably.
https://gitlab.com/wizonet/nagiosql/-/blob/3.4.1/install/index.php
As you can see here in the code, line 22 defines the variable and then it is used several times (but not on line 43 but 37). Have you installed the same install/index.php files as showed in the link above?
Hi Martin,
Thank you for your response.
I have re-downloaded the same index that you have provided, but still, I'm seeing the blank page and when I enabled the display errors on code it shows me the same error message.
As you said, the env variable is used before and not showing the error that made me more confusing.
Do you think it's related to directory or path?
My installation of nagios goes to /usr/local/nagios/ and web files in share folder, for nagiosQL it goes to same share folder ie, /usr/local/nagios/share/webadmin
Yesterday I change the path that you have mentioned in the script to real one for the prepend_install.php, but it then shows me another error or missing file like Autoload.php. I believe all files are present on appropriate directories and while running the script it stops in the middle.
I couldn't find the exact problem.
Can you please spot me?
Hello Jacob
First - download the whole project from:
https://gitlab.com/wizonet/nagiosql/-/tree/3.4.1
Should theoretically be the same code, but so we are safe
If the error still exists - change the code of install/index.php and output the varibale for control on line 23:
echo "VAR: " . $preBasePath;
This should print the absolute path of your nagiosql installation to the top of the screen - like:
VAR: /usr/local/nagios/share/webadmin
while the changed file is in:
/usr/local/nagios/share/webadmin/install/index.php
A Blank page has mostly the reason, that php_pear is not installed on the system. Please check.
Martin
Hi Martin,
As you said, I have added echo "VAR: " . $preBasePath; on 23th line but it seems to be returning VAR and blank space.
Also pear is available on server
pear version
PEAR Version: 1.10.12
PHP Version: 7.3.32
Zend Engine Version: 3.3.32
Running on: Linux 149-28-194-189.cprapid.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
Is there anything we can do?
Please assist..
Thanks
Hi Martin,
Also found that php pear is installed for the php version, by putting following code is separate php file.
<?php
require_once 'System.php';
var_dump(class_exists('System', false));
?>
Resulted in : bool(true)
Which I referenced from the official pear page.
https://pear.php.net/manual/en/installation.checking.php#installation.checking.cli.modifyingphpini
Do you have any idea what else I need to check?
I'm pretty much clueless now.
Is there any file that checks pear presence or path on the nagiosQL?
My pear found under here
which pear
/usr/local/bin/pear
Please note that my server is cPanel server, the installations may differ from plain server.
Is this the same path on plain server?
Thanks.
Last edit: Jithin Jacob 2021-11-13
Hello Jacob
Since the output of the variable is empty, I assume that your web server does not support the environment variable SCRIPT_FILENAME. So it is incompatible with NagiosQL at the moment.
Generally, a standard Apache installation is recommended - other web servers may or may not work. The environment variable must be supported.
Martin
Hi Martin,
Is there any way I can specify the SCRIPT_FILENAME env variable manually on my system, so that it can capture it while on installation.
Thanks.
Hi Martin,
I decided to try it on a plain server, as you suggested.
Can I use Centos 7.9 and php 7.4?
Also, I have an old setup with Nconf, can we migrate all the servers and checks to nagiosQL?
Do you have any suggestions?
Hi Jacob
Unfortunately I don't know cPanel - so I can't help much.
Centos and PHP 7.4 will basically work. Some users have reported problems with SELinux on Centos - especially regarding writing configuration files and accessing Nagios files. But this should be configurable.
You can import standard Nagios configuration files into NagiosQL - no matter from which configuration tool they were written before. Of course they have to be valid configuration files :)
Martin
Hi Martin,
Thank you for your kind support.
I will try on the plain server and will update here.
It will be helpful to others also.
Thank you!
Hi Martin,
You are right!
It worked well on Centos 7 and php 7.4
As you said, it was some kind of issues with cPanel.
It's great to see you are keeping this project live!
Thank you so much for the support.
Have a great day :)
Hi Martin,
The installation process is completed now.
Can you please guide me how can I migrate all the checks from old to new nagios?
I have checked the DB of old and new, but seem it has different methods.
I have got commands.cfg file from old server but pasting in new server not getting reflected. Also, I can see a table in database named tbl_command, is there any way I can insert the checks to the database?
I'm talking about 1700+ check commands.
Can you please help me out?
Last edit: Jithin Jacob 2021-11-14
Hello Jacob
If you have never used NagiosQL before, I recommend to read the documentation carefully:
https://sourceforge.net/projects/nagiosql/files/nagiosql/Documentation/
You should point the Nagios import directory in settings to the local directory with your old Nagios *.cfg files
After that, you can simply select and import all those files. (Tools -> Data import)
Martin
Hi Martin,
Thank you for pointing that out.
While trying to import services.cfg, I'm getting an error "File upload error: "
Also, my sevicegroups.cfg is empty.
It seems to be some kind of miss match on the fields.
Sample
define service {
service_description check_ping
check_command check_ping!3000,80%!5000,90%
host_name mysite.com
check_period 24x7
notification_period 24x7
notification_interval 4
notification_options w,u,c,r
max_check_attempts 3
check_interval 3
retry_interval 1
active_checks_enabled 1
passive_checks_enabled 0
notifications_enabled 1
check_freshness 1
freshness_threshold 86400
contact_groups admins
}
Also, all the hosts are present on backend and nagiosql frontend, but it is not showing on Nagios front end.
There is huge number of service check in that file, do you have any idea how to correct this?
Thank you.
Hello Jacob
I can't support individual nagios installations - that would be too much work, because it would take too much time and you would have to know exactly about the environment.
Based on the error message, it could be that the services.cfg is too big. You could split it into smaller files and then import them.
Some configurations have dependencies - so they have to be imported in the right order, e.g. servicegroup after services.
Matin
Hi Martin,
Sorry to bother you again..
I have imported all checks, hosts and services as you guided. But I have seen an "imp_" tag with all my service configuration name.
Can you please help me to get rid of it? It's harder to search on services list for a host. What change I need to be done on script. So that I can reimport all the service configurations.
Thank you!
Hello Jacob
The reason for this is that there is no data field "service configuration name" in Nagios. But to find the services and list them clearly NagiosQL tries to generate a name during import. This name starts with imp_ so that no possibly already existing service configuration names are overwritten.
Since the service configuration name is not used by Nagios, this mechanism has no negative effect.
You can change the name manually or in the database at any time.
There is a trick to add this service configuration name already in the configuration file before the import - this is probably the fastest way to a clean import:
In this case the service configuration name will be like this: hpmfplaser.domain
NagiosQL will write this value into each configuration to easily import and assign it later on.
One more addition - you can use the same service configuration name for all services of e.g. a host - so you can easily find all services from a host while set the configuration name filter.
Martin
Last edit: Martin 2021-11-19
Hi Martin,
Just one more thing..
I have imported and setup all the things as you said. Once I push restart nagios after all writing config files, its not restarting nagios service. Its still up and running on background without any downtime. I think it should show like uptime 2sec ago or like that.
Is it something I need to care about?
Thanks.
Hello Jacob
NagiosQL sends a text command to the Nagios command pipe for restarting the nagios daemon. Its path is specified in the settings of the configuration domain (Nagios command file).
Hi Martin,
Please see the files and permissions.
[root@var]# ll /usr/local/nagios/var/rw/nagios.cmd
prw-rw---- 1 nagios nagcmd 0 Dec 4 17:14 /usr/local/nagios/var/rw/nagios.cmd
[root@var]# grep nagios.cmd /usr/local/nagios/etc/nagios.cfg
command_file=/usr/local/nagios/var/rw/nagios.cmd
Also, RESTART command is passed when I press restart on NagiosQL.
[1638618264] EXTERNAL COMMAND: RESTART_PROGRAM;
[1638618264] PROGRAM_RESTART event encountered, restarting...
[1638618265] Nagios 4.4.6 starting... (PID=8325)
[1638618265] Local time is Sat Dec 04 17:14:25 IST 2021
[1638618265] LOG VERSION: 2.0
[1638618265] qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized
[1638618265] qh: core query handler registered
[1638618265] qh: echo service query handler registered
[1638618265] qh: help for the query handler registered
But see,
[root@ var]# service nagios status
Redirecting to /bin/systemctl status nagios.service
● nagios.service - Nagios Core 4.4.6
Loaded: loaded (/usr/lib/systemd/system/nagios.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2021-12-04 17:11:36 IST; 8min ago
Docs: https://www.nagios.org/documentation
Process: 8318 ExecStopPost=/usr/bin/rm -f /usr/local/nagios/var/rw/nagios.cmd (code=exited, status=0/SUCCESS)
Process: 8312 ExecStop=/usr/bin/kill -s TERM ${MAINPID} (code=exited, status=0/SUCCESS)
Process: 8324 ExecStart=/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS)
Process: 8321 ExecStartPre=/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS)
Main PID: 8325 (nagios)
CGroup: /system.slice/nagios.service
Until I manually restart the service, It will be the same.
Do you see any problems?
Thanks!
Hi Martin,
Please see the files and rights.
[root@64 var]# id nagios
uid=1000(nagios) gid=1000(nagios) groups=1000(nagios),1001(nagcmd)
[root@64 var]# id apache
uid=48(apache) gid=48(apache) groups=48(apache),1000(nagios),1001(nagcmd)
prw-rw---- 1 nagios nagcmd 0 Dec 4 17:14 /usr/local/nagios/var/rw/nagios.cmd
[root@64 var]# grep nagios.cmd /usr/local/nagios/etc/nagios.cfg
command_file=/usr/local/nagios/var/rw/nagios.cmd
Also, I could see the RESTART is passed and, It didn't restart the service until I manually restart the service.
Do you have any idea regarding the same?
Thanks!
Hello Jacob
The function does not restart the Nagios demon - it is a soft restart, which only re-reads the configuration. It is not necessary with Nagios to restart the demon after every configuration change.
PROGRAM_RESTART event encountered, restarting...
means, that this "graceful" restart was successful.
The question is - can you see the configuration changes after a soft restart in Nagios or not, e.g. a newly added service or host?
Martin
Hi Martin,
I can see the hosts or services not immediately but definitely in 3 -5 mins, If I restart nagios demon it will be in secs.
Thanks
Hi Martin,
Please ignore the previous reply.
Something weird was going on with DB, I just ran a mysqlcheck and its going well now.
It takes place quickly.
So the demon will be restarted in graceful mode right? no hard restart, that's fine then.
Thanks!