Option to monitor or check custom made services in Ubuntu

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
epixelitsupport
Posts: 85
Joined: Fri Nov 08, 2019 2:40 am

Option to monitor or check custom made services in Ubuntu

Post 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
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

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

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
epixelitsupport
Posts: 85
Joined: Fri Nov 08, 2019 2:40 am

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

Post 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
Attachments
monitoringclieentsandservices
monitoringclieentsandservices
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

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

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
epixelitsupport
Posts: 85
Joined: Fri Nov 08, 2019 2:40 am

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

Post 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
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

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

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
epixelitsupport
Posts: 85
Joined: Fri Nov 08, 2019 2:40 am

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

Post 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
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

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

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
epixelitsupport
Posts: 85
Joined: Fri Nov 08, 2019 2:40 am

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

Post 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
Attachments
wheredoi perform this task
wheredoi perform this task
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

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

Post 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/
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked