Page 1 of 5

Option to monitor or check custom made services in Ubuntu

Posted: Fri Nov 08, 2019 3:08 am
by epixelitsupport
Option to monitor or check custom made services in Ubuntu,

I am using a nagios Core latest version, I need to monitor services which I have custom made in client machine.
I have a created a service in systemd , is there any option to monitor those services whether it is running or stopped,
let me get a solution for it

Re: Option to monitor or check custom made services in Ubunt

Posted: Fri Nov 08, 2019 11:29 am
by mbellerue
You can always write a simple bash script to run systemctl status servicename, and then return the proper exit code based on the result. That script can then be called using the check_by_ssh plugin from the Nagios server.

Or if you want a more robust solution, check out the Nagios Cross Platform Agent. You can install this on Windows, Linux, MacOS, AIX, or Solaris, and you will have access to a host of built in monitoring features, as well as a way to execute custom plugins.
https://www.nagios.org/ncpa/
https://www.nagios.org/ncpa/getting-started.php

Re: Option to monitor or check custom made services in Ubunt

Posted: Sat Nov 09, 2019 8:57 am
by epixelitsupport
Thanks for your reply and suggestion.
As you can in the attachment my Nagios server monitoring a lot of client machines and each client machines having different types of services, I just want to create a notification here as we seen here like services here already like apache, users and disks so if the services stopped I will get a mail notification as well... now some services are stopping in the client machines without any notification and I came to know about the issue only after informed by the client and Can you suggest me a solution to get rid of this issue which I'm facing now
Thank you in advance for your kind support

Re: Option to monitor or check custom made services in Ubunt

Posted: Mon Nov 11, 2019 12:18 pm
by mbellerue
Either of the options mentioned above will be able to monitor a custom service. For simplicity, it may be easiest to use NCPA. NCPA will handle listing out the services, and all you have to do is tell Nagios which service you want to make sure is running.

Re: Option to monitor or check custom made services in Ubunt

Posted: Wed Nov 13, 2019 1:46 am
by epixelitsupport
So can I integrate NCPA with Nagios Core?
Means can I monitor from my Nagios page as itself? or do I need to create a different URL to access NCPA?

and also can you please give me an example for this one? You can always write a simple bash script to run systemctl status servicename, and then return the proper exit code based on the result. That script can then be called using the check_by_ssh plugin from the Nagios server.


Thank you for your support

Re: Option to monitor or check custom made services in Ubunt

Posted: Wed Nov 13, 2019 11:08 am
by mbellerue
Yes, you can use NCPA with Nagios Core. NCPA is just an agent that will run on the server that you want to monitor. On your Nagios server, you should have /usr/local/nagios/libexec/check_ncpa.py which will be used to check various aspects of the remote server. Make sure to read the getting started documentation for NCPA so you know how to configure it.
https://www.nagios.org/ncpa/getting-started.php#linux

Example bash script

Code: Select all

#!/bin/bash

systemctl status yourservicename

exit $?
Put that script on the remote server in /usr/local/ncpa/plugins/ and then test out the check_ncpa.py command on Nagios, like so.

/usr/local/nagios/libexec/check_ncpa.py -H HostNameOrIP -t secretpassword -M plugins/example_script.sh

Re: Option to monitor or check custom made services in Ubunt

Posted: Wed Nov 20, 2019 7:32 am
by epixelitsupport
Do i need to install ncpa on both systems? like Nagios server and Client machine?
Im already installed everything in the nagios core server machine ..
Please give me an instruction to install NCPA on Nagios Ser machine and Client (host) machine


Im using an ubuntu 18.04 machine as a nagios server

Re: Option to monitor or check custom made services in Ubunt

Posted: Wed Nov 20, 2019 10:24 am
by mbellerue
You will only need NCPA on the client machine that you want to monitor. Nagios Core will reach out to that server and query NCPA for information.

Here are the instructions for installing NCPA on Linux.
https://www.nagios.org/ncpa/getting-started.php#linux

Re: Option to monitor or check custom made services in Ubunt

Posted: Wed Nov 20, 2019 10:51 am
by epixelitsupport
I see, So i just want to install it in https://www.nagios.org/ncpa/getting-started.php#linux client machine only right?
so how the Nagios machine will contact the Client machine?

Where do i perform the task as i mentioned in attachment

Re: Option to monitor or check custom made services in Ubunt

Posted: Wed Nov 20, 2019 1:15 pm
by mbellerue
Yes, NCPA is only installed on the client machine.

The tasks in that attachment have you working with your Nagios configuration files. By default they are in /usr/local/nagios/etc/ and /usr/local/nagios/etc/objects/