Input and output of Plugins

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
hungbeo_fm2008
Posts: 3
Joined: Thu Jan 15, 2015 2:58 am

Input and output of Plugins

Post 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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Input and output of Plugins

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
hungbeo_fm2008
Posts: 3
Joined: Thu Jan 15, 2015 2:58 am

Re: Input and output of Plugins

Post 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.
Attachments
Diagram about exchanging data between Nagios core and Plugins
Diagram about exchanging data between Nagios core and Plugins
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Input and output of Plugins

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
hungbeo_fm2008
Posts: 3
Joined: Thu Jan 15, 2015 2:58 am

Re: Input and output of Plugins

Post by hungbeo_fm2008 »

I understood.
Thanks for all your help.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Input and output of Plugins

Post 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!
Locked