Page 1 of 1
NagiosXI Local check script
Posted: Thu Feb 13, 2020 3:09 pm
by dslaughter
I have a check that logs into an email account and retrieves mail. Based on the content of the email it could be one of 2 services. Both emails could be in the mailbox at the same time so I don't know if the mail will be for a particular service until I parse it. After the mail is checked it is moved to a backup folder in the mailbox. I don't think I can have a check script for each service to check the mailbox without missing an email that needs to be parsed since all mail is pulled when script logs in to the email account.
Is it possible to write a local check script that could send its output to multiple services?
Re: NagiosXI Local check script
Posted: Thu Feb 13, 2020 4:21 pm
by jdunitz
You should be able to have a script that will pull the mail, parse, and then send the results to multiple passive XI services using NRDP.
Submitting results to NRDP can be done with curl for example:
Code: Select all
curl -XPOST 1.2.3.4/nrdp/ -d 'cmd=submitcheck&token=NRDP_TOKEN&JSONDATA={
"checkresults": [
{
"checkresult": {
"type": "service",
"checktype": "1"
},
"hostname": "somehost",
"servicename": "someservice",
"state": "1",
"output": "WARNING: Danger Will Robinson! | perfdata=1;"
}
]
}
'
Where hostname and service name are the names of passive service checks you've put in place in the CCM or setup with the passive config wizard.
Re: NagiosXI Local check script
Posted: Thu Feb 13, 2020 4:59 pm
by dslaughter
I had considered that but since I was running local I wanted the option to force check. If you think passive is the best way to locally send to multiple services I will set it up for testing.
Unless you can think of any other way to accomplish this then go ahead and lock it.
Thanks!
Re: NagiosXI Local check script
Posted: Fri Feb 14, 2020 8:16 am
by scottwilkerson
dslaughter wrote:I had considered that but since I was running local I wanted the option to force check. If you think passive is the best way to locally send to multiple services I will set it up for testing.
Unless you can think of any other way to accomplish this then go ahead and lock it.
Thanks!
Locking thread