I've been trying my best to understand how to set up threshold and generate performance data on my own nagios script.
My script's supposed to check how many files are generated every hours. These files have different categories.
I need to have the following nagios command working:
/usr/local/nagios/libexec/check_v -w 200,150,150,1,2 -c 500,200,200,5,20
200 is FileCategory1 150 is FileCategory 2 and so on and so forth.
So for FileCategory1, if there were 200 files generated at that hour, It will generate a WARNING alarm. And if there's 500 files generated at that hour, a CRITICAL alarm will be activated on Nagios.
I have a jar file that generates a text file where all of the needed data output are in. I just have to know how can I make my nagios command work. I know how to make nagios alarm, with all of the exit codes and such but I'm not so sure how the $args1 etc etc works? Like what should my .sh output be besides the exit codes? Do i even have to have the exit codes anymore since I already have the -w and -c on the nagios command? And where will nagios supposed to read the numbers? (200,150,150,1,2) In which file should I put in the performance data syntax with the pipe (|)?
I hope my question is clear. I've read the documentation but I'm still confused as hell.
Set up up threshold and generating performance data
-
shericaocbania
- Posts: 6
- Joined: Wed Nov 22, 2017 1:49 pm
Re: Set up up threshold and generating performance data
The Nagios Plugins development guidelines should be useful:
http://nagios-plugins.org/doc/guidelines.html
[I'm simplifying a lot of things here] When Nagios Core receives a plugin's output it only has a concept of 2 things: The status output (received via STDOUT) and the status code (received via the unix exit code). The performance data is included as part of the status output and parsed later according to your Nagios Core's performance data configuration/settings.
The Plugin Output section of the above document details what can/should exist in a Nagios Plugin's output.
The plugin development guidelines set forth range/threshold standards for the sake of keeping range/comparison syntax consistent across plugins, but you could structure it however the heck you want as long as a STDOUT message and an exit code is produced by your plugin.
So If I wanted to append "% CPU Usage" performance data to my plugin's output with the following criteria:
http://nagios-plugins.org/doc/guidelines.html
[I'm simplifying a lot of things here] When Nagios Core receives a plugin's output it only has a concept of 2 things: The status output (received via STDOUT) and the status code (received via the unix exit code). The performance data is included as part of the status output and parsed later according to your Nagios Core's performance data configuration/settings.
A simple human-readable status via stdout. Additional performance data if relevant.shericaocbania wrote:Like what should my .sh output be besides the exit codes?
The Plugin Output section of the above document details what can/should exist in a Nagios Plugin's output.
I'm not entirely sure what you mean by this. Nagios Core itself has no concept of "thresholds"; Just the aforementioned status output and status code. How you determine that status output and status code should be done through the plugin itself. Maybe warning/critical thresholds are appropriate for one type of check, maybe you don't need thresholds and just want to know if a connection is established or not. This sort of logic all happens within the plugins.shericaocbania wrote:Do i even have to have the exit codes anymore since I already have the -w and -c on the nagios command?
[I'm again simplifying a lot of things here] Nagios doesn't read the thresholds provided to any plugin. It looks at a command, runs it via popen, then retrieves the STDOUT (status output) and exit code (status code) of the command.shericaocbania wrote:And where will nagios supposed to read the numbers? (200,150,150,1,2)
The plugin development guidelines set forth range/threshold standards for the sake of keeping range/comparison syntax consistent across plugins, but you could structure it however the heck you want as long as a STDOUT message and an exit code is produced by your plugin.
The specification for performance data states that performance data must follow the status output after a | character in the expected format:shericaocbania wrote:In which file should I put in the performance data syntax with the pipe (|)?
Code: Select all
'label'=value[UOM];[warn];[crit];[min];[max]- Current usage -- 50%
- Warning value -- 80%
- Critical value -- 90%
Code: Select all
'percent_usage'=50%;80;90
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
shericaocbania
- Posts: 6
- Joined: Wed Nov 22, 2017 1:49 pm
Re: Set up up threshold and generating performance data
Thanks everyone! It was very helpful! Was able to solve my problemkyang wrote:Thanks for the help @mcapra!
shericaocbania, let us know if you have any more questions.
-
kyang
Re: Set up up threshold and generating performance data
Sounds good! I'll be closing this thread!
If you have any more questions, feel free to create another thread.
Thanks for using the Nagios Support Forum!
If you have any more questions, feel free to create another thread.
Thanks for using the Nagios Support Forum!