Page 3 of 3

Re: nagios service restart failed.

Posted: Tue Aug 01, 2017 2:35 pm
by bolson
We will leave it open. Check back with us after you've configured your additional hosts.

Thank you!

Re: nagios service restart failed.

Posted: Thu Aug 03, 2017 8:26 am
by anoopjeev
I added a new host and tried to restart nagios service. it failed.

These are the steps i followed to add host:
install agent on windows server and enabled nrpe listener.
Edited windows.cfg and added host name and IP, saved it and tried to restart nagios

## [root@localhost etc]# service nagios restart
Restarting nagios (via systemctl): Job for nagios.service failed because the control process exited with error code. See "systemctl status nagios.service" and "journalctl -xe" for details.
[FAILED]

## [root@localhost objects]# systemctl -l status nagios.service
● nagios.service - LSB: Starts and stops the Nagios monitoring server
Loaded: loaded (/etc/rc.d/init.d/nagios; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2017-08-02 16:10:28 EDT; 16h ago
Docs: man:systemd-sysv-generator(8)
Process: 21221 ExecStop=/etc/rc.d/init.d/nagios stop (code=exited, status=0/SUCCESS)
Process: 21336 ExecStart=/etc/rc.d/init.d/nagios start (code=exited, status=8)

Aug 02 16:10:28 localhost.localdomain nagios[21336]: Check your configuration file(s) to ensure that they contain valid
Aug 02 16:10:28 localhost.localdomain nagios[21336]: directives and data definitions. If you are upgrading from a previous
Aug 02 16:10:28 localhost.localdomain nagios[21336]: version of Nagios, you should be aware that some variables/definitions
Aug 02 16:10:28 localhost.localdomain nagios[21336]: may have been removed or modified in this version. Make sure to read
Aug 02 16:10:28 localhost.localdomain nagios[21336]: the HTML documentation regarding the config files, as well as the
Aug 02 16:10:28 localhost.localdomain nagios[21336]: 'Whats New' section to find out what has changed.
Aug 02 16:10:28 localhost.localdomain systemd[1]: nagios.service: control process exited, code=exited status=8
Aug 02 16:10:28 localhost.localdomain systemd[1]: Failed to start LSB: Starts and stops the Nagios monitoring server.
Aug 02 16:10:28 localhost.localdomain systemd[1]: Unit nagios.service entered failed state.
Aug 02 16:10:28 localhost.localdomain systemd[1]: nagios.service failed.
[root@localhost objects]#



## [root@localhost objects]# journalctl -xe
-- Unit session-1282.scope has finished starting up.
--
-- The start-up result is done.
Aug 03 09:10:01 localhost.localdomain systemd[1]: Starting Session 1282 of user root.
-- Subject: Unit session-1282.scope has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/li ... temd-devel
--
-- Unit session-1282.scope has begun starting up.
Aug 03 09:10:01 localhost.localdomain CROND[30523]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Aug 03 09:20:01 localhost.localdomain systemd[1]: Started Session 1283 of user root.
-- Subject: Unit session-1283.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/li ... temd-devel
--
-- Unit session-1283.scope has finished starting up.
--
-- The start-up result is done.
Aug 03 09:20:01 localhost.localdomain systemd[1]: Starting Session 1283 of user root.
-- Subject: Unit session-1283.scope has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/li ... temd-devel
--
-- Unit session-1283.scope has begun starting up.
Aug 03 09:20:01 localhost.localdomain CROND[30627]: (root) CMD (/usr/lib64/sa/sa1 1 1)
lines 3351-3375/3375 (END)

Am i missing something that i need to do before i edit nagios.cfg or did i do something wrong? pls help

Re: nagios service restart failed.

Posted: Thu Aug 03, 2017 8:33 am
by anoopjeev
windows.cfg

Code: Select all

###############################################################################
# WINDOWS.CFG - SAMPLE CONFIG FILE FOR MONITORING A WINDOWS MACHINE
#
#
# NOTES: This config file assumes that you are using the sample configuration
#        files that get installed with the Nagios quickstart guide.
#
###############################################################################




###############################################################################
###############################################################################
#
# HOST DEFINITIONS
#
###############################################################################
###############################################################################

# Define a host for the Windows machine we'll be monitoring
# Change the host_name, alias, and address to fit your situation

define host{
	use             windows-server  ; Inherit default values from a template
        host_name	IA0CW007        ; The name we're giving to this host
        alias           IA0CW007        ; A longer name associated with the host
        address         10.52.94.31     ; IP address of the host
        }

define host{
	use             windows-server  ; Inherit default values from a template
       host_name	    IA0FS001        ; The name we're giving to this host
        alias           IA0FS001        ; A longer name associated with the host
        address         10.52.95.129     ; IP address of the host
        }


###############################################################################
###############################################################################
#
# HOST GROUP DEFINITIONS
#

###############################################################################
###############################################################################


# Define a hostgroup for Windows machines
# All hosts that use the windows-server template will automatically be a member of this group

define hostgroup{
        hostgroup_name  windows-servers ; The name of the hostgroup
        alias           Windows Servers ; Long name of the group
        }


###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################

# Create a service for monitoring the version of NSCLient++ that is installed
# Change the host_name to match the name of the host you defined above

define service{
       	use                     generic-service
        host_name               IA0CW007,IA0FS001
       	service_description     NSClient++ Version
        check_command           check_nt!CLIENTVERSION
        }



# Create a service for monitoring the uptime of the server
# Change the host_name to match the name of the host you defined above

define service{
        use                     generic-service
        host_name               IA0CW007,IA0FS001
        service_description     Uptime
        check_command           check_nt!UPTIME
        }
# Create a service for monitoring CPU load
# Change the host_name to match the name of the host you defined above

define service{
        use                     generic-service
        host_name               IA0CW007,IAOFS001
        service_description     CPU Load
        check_command           check_nt!CPULOAD!-l 5,80,90
        }

# Create a service for monitoring memory usage
# Change the host_name to match the name of the host you defined above

define service{
        use                     generic-service
        host_name               IA0CW007,IA0FS001
        service_description     Memory Usage
        check_command           check_nt!MEMUSE!-w 80 -c 90
        }

# Create a service for monitoring C:\ disk usage
# Change the host_name to match the name of the host you defined above

define service{
        use                     generic-service
        host_name               IA0CW007,IA0FS001
        service_description     C:\ Drive Space
        check_command           check_nt!USEDDISKSPACE!-l c -w 80 -c 90
        }
# Create a service for monitoring E:\ disk usage
# Change the host_name to match the name of the host you defined above

define service{
        use                     generic-service
        host_name               IA0CW007
        service_description     E:\ Drive Space
        check_command           check_nt!USEDDISKSPACE!-l c -w 80 -c 90
        }

# Create a service for monitoring F:\ disk usage
# Change the host_name to match the name of the host you defined above

define service{
        use                     generic-service
        host_name               IA0CW007
        service_description     F:\ Drive Space
        check_command           check_nt!USEDDISKSPACE!-l c -w 80 -c 90
        }
# Create a service for monitoring H:\ disk usage
# Change the host_name to match the name of the host you defined above

define service{
        use                     generic-service
        host_name               IA0CW007
        service_description     H:\ Drive Space
        check_command           check_nt!USEDDISKSPACE!-l c -w 80 -c 90
        }
# Create a service for monitoring T:\ disk usage
# Change the host_name to match the name of the host you defined above

define service{
        use                     generic-service
        host_name               IA0FS001
        service_description     T:\ Drive Space
        check_command           check_nt!USEDDISKSPACE!-l c -w 80 -c 90
        }
# Create a service for monitoring X:\ disk usage
# Change the host_name to match the name of the host you defined above

define service{
        use                     generic-service
        host_name               IA0FS001
        service_description     X:\ Drive Space
        check_command           check_nt!USEDDISKSPACE!-l c -w 80 -c 90
        }

# Create a service for monitoring the W3SVC service
# Change the host_name to match the name of the host you defined above

define service{
        use                     generic-service
        host_name               IA0CW007,IA0FS001
        service_description     W3SVC
        check_command           check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
        }
# Create a service for monitoring the Explorer.exe process
# Change the host_name to match the name of the host you defined above

define service{
        use                     generic-service
        host_name               IA0CW007,IA0FS001
        service_description     Explorer
        check_command           check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe
        }

Re: nagios service restart failed.

Posted: Thu Aug 03, 2017 11:27 am
by bolson
Please look through this guide:

https://assets.nagios.com/downloads/nag ... ndows.html

Create separate service definitions for each host you're adding. When you've finished adding a second host, run this command:

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Re: nagios service restart failed.

Posted: Tue Aug 08, 2017 12:18 pm
by anoopjeev
its working now, thanks. it showed me the errors when i ran this command

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg 
all the servers have nagios agent already on them. What i want to do now is to add the new server to config file.
When i try to make changes to the nsclient file in C:\programfiles\NSClient++, it says access denied.

how can i add the ip address of the new server to the nsclinet.ini file. I can't restart the server to do a fresh install as this is production server.

Re: nagios service restart failed.

Posted: Tue Aug 08, 2017 12:37 pm
by bolson
Do you not have admin rights to the Windows host?

Re: nagios service restart failed.

Posted: Tue Aug 08, 2017 1:14 pm
by anoopjeev
yes, i do have admin rights.
I also tried to run the agent again, and when presented with three options: change, repair or remove.
I clicked on change, entered the new host ip in "allowed hosts" field , and clicked on next. but this throws a pop up
box saying "The specified account already exists". and cancel the installation.

Re: nagios service restart failed.

Posted: Wed Aug 09, 2017 9:23 am
by bolson
Your next step would probably be to remove and reinstall nsclient++

Re: nagios service restart failed.

Posted: Wed Aug 23, 2017 11:52 pm
by anoopjeev
re-installing client did the trick.
I am having trouble configuring check command for sql serivce. It has $ sign in it.
something like these:
MSSQL$VIM_SQLEXP
MSSQL$SQLEXP

please suggest.

Re: nagios service restart failed.

Posted: Thu Aug 24, 2017 9:45 am
by bolson
re-installing client did the trick.
I am having trouble configuring check command for sql serivce. It has $ sign in it.
something like these:
MSSQL$VIM_SQLEXP
MSSQL$SQLEXP

please suggest.
Please open a new topic as this is an unrelated issue. I'll be closing this topic as resolved. Thank you!