Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make this Nagios compatible #63

Open
riahc3 opened this issue Sep 21, 2019 · 5 comments
Open

Make this Nagios compatible #63

riahc3 opened this issue Sep 21, 2019 · 5 comments
Labels
enhancement New feature or request

Comments

@riahc3
Copy link

riahc3 commented Sep 21, 2019

Hello

I think this is a great script. Really thorough checking.

That being said, I think it should be Nagios compatible (or even fork it, although sync issues might occur). The script should be ran from a domain controller.

You can read the entire documentation here: https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/pluginapi.html but the TL;DR is that your last line should be:

Write-Host "Whatever you want Nagios to display as text"
exit $variableholdingexitcode # 0 for OK, 1 for WARNING, 2 for CRITICAL and 3 for UNKNOWN

$variableholdingexitcode should be:

0 - OK
1 - WARNING
2 - CRITICAL
3 - UNKNOWN

OK is obviously that all checks have gone fine.

I think WARNING and CRITICAL should be defined by you and/or the user. You can, for example, decide that if there are six domain controllers and two cannot be reached, it is a WARNING status but if it cannot reach four, it should be a CRITICAL.

Not being able to resolve DNS against DCs should be a CRITICAL automatically with no WARNING state possible.

etc, etc....

And the user should also be able to -IncludeAsWarnings and pass a string array with checks he wants to be warnings if they fail or -ExcludeAsWarnings with again a string array with check he wants to ignore if they fail

Same with -IncludeAsCritical and -ExcludeAsCritical

Also -CompletelyInclude and -CompletelyExclude

UNKNOWN is mainly if the script fails for some reason out of your control....Running it on a 2003 DC if it isnt supported, should return a UNKNOWN for example.

I hope this gives you some ideas and Im sure plently more with input with even better ideas.

Thanks!

@PrzemyslawKlys
Copy link
Member

Is there something that prevents you from using that now?

$Results = Invoke-Testimo -ReturnResults
if ($Results.Status -contains $false) {
    Write-Host "Errors happend"
    Exit 2
} else {
    Exit 0
}

Or is there something I'm missing?

@PrzemyslawKlys PrzemyslawKlys added enhancement New feature or request question Further information is requested labels Sep 21, 2019
@riahc3
Copy link
Author

riahc3 commented Sep 22, 2019

Is there something that prevents you from using that now?

$Results = Invoke-Testimo -ReturnResults
if ($Results.Status -contains $false) {
    Write-Host "Errors happend"
    Exit 2
} else {
    Exit 0
}

Or is there something I'm missing?

There is a lot of code but entering a few .ps1 files I dont see anywhere where there is a "final" Write-Host and Exit

Besides, looking at the code I doubt "Exit 0" would be used and it would be "Exit $LastStatusCode" or "$StatusOK=0 ; Exit $StatusOK"

I think the best way to is to setup a additional .ps1 with all the test but ending in a Nagios plugin logic.

@PrzemyslawKlys
Copy link
Member

PrzemyslawKlys commented Sep 22, 2019

I mean you don't have to modify code. I'm trying to say, what you can do is do Install-Module Testimo, and then create your own .ps1, and then run the code I pasted. When you plug that into Nagios it should work as expected as far as I understand what you said? Testimo will deliver results, and you just need to "deliver" whatever you want to Nagios.

I can, of course, incorporate this at some point, but just trying to understand if the above would work?

@riahc3
Copy link
Author

riahc3 commented Sep 30, 2019

I mean you don't have to modify code. I'm trying to say, what you can do is do Install-Module Testimo, and then create your own .ps1, and then run the code I pasted. When you plug that into Nagios it should work as expected as far as I understand what you said? Testimo will deliver results, and you just need to "deliver" whatever you want to Nagios.

I can, of course, incorporate this at some point, but just trying to understand if the above would work?

I think you mean that I make a wrapper where inside I just call your functions and depending what they reply, I handle it to reply to Nagios.

There are a lot of checks you do so Im not sure which are critical or not, sorry.

@PrzemyslawKlys
Copy link
Member

I understand. I have some ideas for that. Will take a while but hopefully will get implemented.

@PrzemyslawKlys PrzemyslawKlys removed the question Further information is requested label Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants