Help configure custom plugin under Nagios Core

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Help defining plugin in Nagios Core

Postby gmills » Fri Feb 14, 2020 12:21 pm

Hello and thank you in advance!

I have created a plugin linux shell script for checking the status of AWS cloud services. however, I am confused in defining the host for the service.

it works like this.. pass it the token URL and the api URL to check.

./check_api_cloud_service.sh -t https://a8a2ffc4-b04e-4ec1-bfed-7a51dd4 ... auth/token -s https://ims-ums-case-reporting-preprod. ... .io/health

Usage: ./check_api_cloud_service.sh -t Access_Token_URL -s Service_API_URL

the commands.cfg
# Custom plugins commands...
define command{
command_name check_api_cloud_service
command_line $USER1$/check_api_cloud_service.sh -t $ARG1$ -s $ARG2$
}

#Case reporting service
define service{
use generic-service
host_name
service_description Job MGMT Service
check_command check_api_cloud_service!https://a8a2ffc4-b04e-4ec1-bfed-7a51dd408725-uaa.run.aws-usw02-pr.ice.io/oauth/token!https://ims-ums-job-management-preprod.run.aws-usw02-pr.ice.io/health!
notifications_enabled 0
}

I do not know how to define the host definition because there really isn't a host, as it is passed as parameter?
can I define a host without an address?
sorry I'm still new to Nagios and this is my first plugin.

my plugin is attached.
Attachments
check_api_cloud_service.sh
my first plugin
(3.16 KiB) Not downloaded yet
gmills
 
Posts: 95
Joined: Wed Jun 12, 2019 2:08 pm

Help configure custom plugin under Nagios Core

Postby gmills » Fri Feb 14, 2020 1:17 pm

Hello and thank you in advance! I did also asked this question on the Plugin developement forum but not sure about response on that forum.

I have created a plugin linux shell script for checking the status of AWS cloud services. however, I am confused in defining the host for the service.

it works like this.. pass it the token URL and the api URL to check.

./check_api_cloud_service.sh -t https://a8a2ffc4-b04e-4ec1-bfed-7a51dd4 ... auth/token -s https://ims-ums-case-reporting-preprod. ... .io/health

Usage: ./check_api_cloud_service.sh -t Access_Token_URL -s Service_API_URL

the commands.cfg
# Custom plugins commands...
define command{
command_name check_api_cloud_service
command_line $USER1$/check_api_cloud_service.sh -t $ARG1$ -s $ARG2$
}

#Case reporting service
define service{
use generic-service
host_name
service_description Job MGMT Service
check_command check_api_cloud_service!https://a8a2ffc4-b04e-4ec1-bfed-7a51dd408725-uaa.run.aws-usw02-pr.ice.io/oauth/token!https://ims-ums-job-management-preprod.run.aws-usw02-pr.ice.io/health!
notifications_enabled 0
}

I do not know how to define the host or service definitions because there really isn't a host, as it is passed as parameter?
can I define a host without an address? can you suggest how I can achieve this? thank you !!

sorry I'm still new to Nagios ( always finding something I don't know about ) and this is my first plugin.

my plugin is attached.
Attachments
check_api_cloud_service.sh
my custom plugin
(3.16 KiB) Downloaded 1 time
gmills
 
Posts: 95
Joined: Wed Jun 12, 2019 2:08 pm

Re: Help defining plugin in Nagios Core

Postby scottwilkerson » Fri Feb 14, 2020 2:19 pm

You need to create a host definition, even if it is a dummy host that is going to hold these services.

All services need to be assigned to a host

You could use localhost if you have that defined already
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 17542
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Help configure custom plugin under Nagios Core

Postby lmiltchev » Fri Feb 14, 2020 2:46 pm

This is how you define a host:

https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/objectdefinitions.html#host

If you had a host config as such:
Code: Select all
define host {
   host_name   myhost
   ...
}

then you service config would be:
Code: Select all
#Case reporting service
define service{
use generic-service
host_name   myhost
service_description Job MGMT Service
check_command check_api_cloud_service!https://a8a2ffc4-b04e-4ec1-bfed-7a51dd408725-uaa.run.aws-usw02-pr.ice.io/oauth/token!https://ims-ums-job-management-preprod.run.aws-usw02-pr.ice.io/health!
notifications_enabled 0
}
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!
User avatar
lmiltchev
QA Manager
 
Posts: 12975
Joined: Mon May 23, 2011 12:15 pm

Re: Help configure custom plugin under Nagios Core

Postby gmills » Fri Feb 14, 2020 2:53 pm

thank you! let me give this a try.
gmills
 
Posts: 95
Joined: Wed Jun 12, 2019 2:08 pm

Re: Help configure custom plugin under Nagios Core

Postby lmiltchev » Fri Feb 14, 2020 3:13 pm

Sure, let us know if you have any further questions.
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!
User avatar
lmiltchev
QA Manager
 
Posts: 12975
Joined: Mon May 23, 2011 12:15 pm


Return to Nagios Core

Who is online

Users browsing this forum: froehl, mcapra, source888 and 39 guests