Page 1 of 1

Input and output of Plugins

Posted: Sun Jan 18, 2015 9:51 pm
by hungbeo_fm2008
Hello everybody.
I am a newer of Nagios. I want to modify some plugins, but I don't understand the way exchange data between Nagios core with plugins. Why plugins understand all requires from core, and why core understand the output of plugins.
I think have one general file between core and plugins where core and plugins can understand each others, core write demands in file and plugins process this file to take information. Plugins write output results to file and core read from it.
Please help me to know the name of the file and the way exchange data between them.
Thanks all.

Re: Input and output of Plugins

Posted: Mon Jan 19, 2015 3:44 pm
by abrist
Plugins are run as shell commands. There is a standard format for plugin output:
https://nagios-plugins.org/doc/guidelines.html#AEN200
A standard check will run the command for a check through a fork (3.x.x) or through a worker (4.x.x). Either of these will return the output directly to core. Passive checks can be returned in a number of ways depending on the agent, including using the command pipe:
http://nagios.sourceforge.net/docs/3_0/extcommands.html
nagios.sourceforge.net/docs/3_0/configmain.html#command_file
http://old.nagios.org/developerinfo/ext ... ndlist.php

Re: Input and output of Plugins

Posted: Mon Jan 19, 2015 9:13 pm
by hungbeo_fm2008
Thanks for your answer but I still confuse.
Could you explain more details about the input and output of plugins for me? I think they must have a common enviroment to understand each other, because they are seperate processes, so must have standard data between them.
Follow me:
All demands are defined in .conf, when nagios start, they are written in temp buffer, plugins will access the buffer to take the demands.
And outputs are similar, they are written in buffer and Nagios core will take results of buffer.
I drawed a diagram about exchange process between Nagios core and plugins. Could you check it and repair it for me?
Please help me.
Thank you very much.

Re: Input and output of Plugins

Posted: Tue Jan 20, 2015 5:08 pm
by abrist
When a plugin runs - Core executes the defined command, replacing macro were their object-relevant values. Core will keep the connection open (or communicate through a worker) and wait for the plugin to return properly formatted string which can then be parsed as a check result. As long as nagios can run the command, you can use and plugin/programming language you wish. All ore expects back is a properly formatted string.

Please read the docs I linked in my last post, especially the nagios plugins guidelines. They will make this *very* clear.

Re: Input and output of Plugins

Posted: Wed Jan 21, 2015 5:03 pm
by hungbeo_fm2008
I understood.
Thanks for all your help.

Re: Input and output of Plugins

Posted: Wed Jan 21, 2015 5:22 pm
by slansing
Let us know if you have any further questions on this topic, or if we are good to lock the thread up, thanks!