Page 1 of 2

2 equal services on the same host

Posted: Mon Sep 11, 2017 5:18 pm
by h4doukeeN
Hello, I query on a server I have 2 services with the same name, today we had a fall and nagios was not able to report status, in the web interface you see that there are 2 services with the same name and in the service was added only once in the nagios CFG, as you could differentiate both the only thing I have are different ports of these services on the same host

Ex:

01-Sv-10.72
NSClient++ Version
Notifications for this service have been disabled
OK 09-11-2017 19:18:16 6d 5h 7m 40s 1/1 NSClient++ 0.5.0.62 2016-09-14
Servicio Ax32Serv
OK 09-11-2017 19:18:17 0d 7h 55m 24s 1/1 Ax32Serv.exe: Running, Ax32Serv.exe: Running

Re: 2 equal services on the same host

Posted: Tue Sep 12, 2017 2:26 pm
by tmcdonald
You could add the port to the end of the service description like some_service_100 and some_service_200 or whatever the ports are. Otherwise if it is one service assigned to two hosts it should be clear which one is having the issue because the hostname should be next to the service name.

Re: 2 equal services on the same host

Posted: Tue Sep 12, 2017 3:50 pm
by h4doukeeN
tmcdonald wrote:You could add the port to the end of the service description like some_service_100 and some_service_200 or whatever the ports are. Otherwise if it is one service assigned to two hosts it should be clear which one is having the issue because the hostname should be next to the service name.
I will test and report, thank you very much

Re: 2 equal services on the same host

Posted: Tue Sep 12, 2017 4:03 pm
by h4doukeeN
h4doukeeN wrote:
tmcdonald wrote:You could add the port to the end of the service description like some_service_100 and some_service_200 or whatever the ports are. Otherwise if it is one service assigned to two hosts it should be clear which one is having the issue because the hostname should be next to the service name.
I will test and report, thank you very much
I think my question was not well understood or I did not understand the answer. as seen in the images in the host 01-Sv-10.72 is shown twice the same service and is because there are two services on the same host with the same name. What I need is to separate them that are not shown together or how to make nagios recognize that they are not the same since yesterday we had a fall and in that server that is added once in the cfg and shows 2 by the web did not pass the state a critical

Image
Image

Re: 2 equal services on the same host

Posted: Tue Sep 12, 2017 4:23 pm
by tmcdonald
Those are two separate services. One is called Servicio Ax32Serv and the other is called NSClient++ Version. The service_description field is the name of the service. The host_name is the host to which the service is attached.

I understand now. You mean "service" as in "services.msc" on the Windows machine, not a Nagios service. In this case unfortunately the plugin can only look at the service/process name, and if that is identical then Nagios has no way to differentiate them, unless you can somehow find the PID of each and make the distinction that way.

Re: 2 equal services on the same host

Posted: Tue Sep 12, 2017 4:28 pm
by h4doukeeN
tmcdonald wrote:Those are two separate services. One is called Servicio Ax32Serv and the other is called NSClient++ Version. The service_description field is the name of the service. The host_name is the host to which the service is attached.

I understand now. You mean "service" as in "services.msc" on the Windows machine, not a Nagios service. In this case unfortunately the plugin can only look at the service/process name, and if that is identical then Nagios has no way to differentiate them, unless you can somehow find the PID of each and make the distinction that way.

ignores the NSClient, I only speak for Ax32Serv, it is 2 times on the same line 1-Ax32Serv: Running, 2- Ax32Serv: Running

Re: 2 equal services on the same host

Posted: Tue Sep 12, 2017 4:41 pm
by h4doukeeN
same services same server, I need to separate them to monitor them since both running does not warn if it falls one or the other I imagine that it will warn only if they fall the 2
Image
Image

Re: 2 equal services on the same host

Posted: Tue Sep 12, 2017 4:54 pm
by tacolover101
h4doukeeN wrote:
tmcdonald wrote:Those are two separate services. One is called Servicio Ax32Serv and the other is called NSClient++ Version. The service_description field is the name of the service. The host_name is the host to which the service is attached.

I understand now. You mean "service" as in "services.msc" on the Windows machine, not a Nagios service. In this case unfortunately the plugin can only look at the service/process name, and if that is identical then Nagios has no way to differentiate them, unless you can somehow find the PID of each and make the distinction that way.

ignores the NSClient, I only speak for Ax32Serv, it is 2 times on the same line 1-Ax32Serv: Running, 2- Ax32Serv: Running
this usually means two processes are running at the same time. in the past though, i've seen this be a bug with NSClient++.

Re: 2 equal services on the same host

Posted: Wed Sep 13, 2017 6:23 am
by h4doukeeN
tmcdonald wrote:Those are two separate services. One is called Servicio Ax32Serv and the other is called NSClient++ Version. The service_description field is the name of the service. The host_name is the host to which the service is attached.

I understand now. You mean "service" as in "services.msc" on the Windows machine, not a Nagios service. In this case unfortunately the plugin can only look at the service/process name, and if that is identical then Nagios has no way to differentiate them, unless you can somehow find the PID of each and make the distinction that way.
I found a way to do so I did some tests with another service and at the moment it goes well when I do on the server I will confirm. the method was to enter HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services

look for the service change the name to which we want to one of the obvious 2 and then enter the installation path and change the name also to start the service, for the changes to take effect restart the host and then edit the name of the service in the nagios CFG obviously.
I did the tests on my desktop host as I need it on a production server when I can reboot it I will do it and I will inform you if someone else can serve you.

I leave pictures as I use google translator to communicate with you and I speak Spanish. sorry for not being able to write better

Image
Image
Image

Re: 2 equal services on the same host

Posted: Wed Sep 13, 2017 11:43 am
by tmcdonald
Changing the name of the executable would certainly work, but I would caution people against this as changing the name could cause things to break if another process is expecting a certain name.