Push Custom Plugins
-
- Posts: 39
- Joined: Mon Mar 21, 2022 7:53 am
Push Custom Plugins
I know how to create custom plugins for bash and powershell and have copied them to the hosts that we have in the environment. The question is, does XI have a way to maintain these? So if I put a new one somewhere on the XI server, will it copy it to all of the hosts being managed/monitored via ncpa?
If so, how? If not built-in, has anyone done this without puppet or ansible - we don't have that running in the domain yet; I keep complaining.
If so, how? If not built-in, has anyone done this without puppet or ansible - we don't have that running in the domain yet; I keep complaining.
Re: Push Custom Plugins
Hey @AngeloMiletoAngeloMileto wrote: ↑Fri Nov 29, 2024 3:41 pm I know how to create custom plugins for bash and powershell and have copied them to the hosts that we have in the environment. The question is, does XI have a way to maintain these? So if I put a new one somewhere on the XI server, will it copy it to all of the hosts being managed/monitored via ncpa?
If so, how? If not built-in, has anyone done this without puppet or ansible - we don't have that running in the domain yet; I keep complaining.
Unfortunately I don't believe XI has a way to do this without any modification. I'll dive into it a bit more but what comes to mind initially is that you would probably need to make a script to distribute the plugins to the hosts NCPA is reaching out to. This is a little out of my wheelhouse but you may be able to make a drive and store the plugin on that drive as long as all the ncpa servers have access to that drive and then configure NCPA to look in that location for plugins. I don't know the process for that or if it would work but could be an ideal to attempt. I'll keep looking and get back if I find something else.
-
- Posts: 120
- Joined: Thu Feb 09, 2017 5:07 pm
Re: Push Custom Plugins
Hi @AngeloMileto,
XI ships with Ansible, as we use it to distribute NCPA, so in that sense you have Ansible in your environment. If you need some ideas to get started you could visit https://github.com/NagiosEnterprises/au ... er/ansible.
Aaron
XI ships with Ansible, as we use it to distribute NCPA, so in that sense you have Ansible in your environment. If you need some ideas to get started you could visit https://github.com/NagiosEnterprises/au ... er/ansible.
Aaron
Re: Push Custom Plugins
AngeloMileto,
I'll also offer the option of writing a component for your XI for managing such scripts. We have documentation on how to do so here: https://assets.nagios.com/downloads/nag ... ios-XI.pdf
As Aaron mentioned, you could hook into the existing Ansible installation we use for deploying NCPA. Then if you're up to it, you could post it on the Nagios Exchange for others to use.
Best Regards,
Cory Norell
I'll also offer the option of writing a component for your XI for managing such scripts. We have documentation on how to do so here: https://assets.nagios.com/downloads/nag ... ios-XI.pdf
As Aaron mentioned, you could hook into the existing Ansible installation we use for deploying NCPA. Then if you're up to it, you could post it on the Nagios Exchange for others to use.
Best Regards,
Cory Norell
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
- Posts: 39
- Joined: Mon Mar 21, 2022 7:53 am
Re: Push Custom Plugins
Thanks for the reply. That's kinda what I was thinking but hoping there was a better/cleaner/more polished way. I basically already am using the /home/nagios/ncpa/plugins/ directory on the XI host itself as the "master" copy of the plugins. So that's the drive/place to look in for the plugins. I was thinking of creating a custom command to basically rsync - works for linux but not for windows - the files from /home/nagios/ncpa/plugins/*sgardil wrote: ↑Mon Dec 02, 2024 12:11 pm Hey @AngeloMileto
Unfortunately I don't believe XI has a way to do this without any modification. I'll dive into it a bit more but what comes to mind initially is that you would probably need to make a script to distribute the plugins to the hosts NCPA is reaching out to. This is a little out of my wheelhouse but you may be able to make a drive and store the plugin on that drive as long as all the ncpa servers have access to that drive and then configure NCPA to look in that location for plugins. I don't know the process for that or if it would work but could be an ideal to attempt. I'll keep looking and get back if I find something else.
I'll poke around a bit more and see what I can come up with. My only limitations would be reporting the status but could figure something out for that too.
Re: Push Custom Plugins
I'd think it would be pretty easy to make a script (plugin) to scp files to a monitored (linux) host and run it as a nagios service. I'm not much help for Windows though.
-
- Posts: 39
- Joined: Mon Mar 21, 2022 7:53 am
Re: Push Custom Plugins
I didn't want to make a blanket rsync/scp that basically ran every time the host was checked though. That's a waste of time and network bandwidth. I had found https://support.nagios.com/kb/article/f ... der_exists and was trying to find a way to leverage that using the "master" directory and loop through everything in the master and if it doesn't exist on the destination/host, then trigger an event to copy it.
Does that sound doable? If so, any help would be appreciated.
Does that sound doable? If so, any help would be appreciated.
-
- Posts: 120
- Joined: Thu Feb 09, 2017 5:07 pm
Re: Push Custom Plugins
Well depending on how you are managing your plugin code, you could use a git hook that does the work to update when you push to the default branch for the plugin code. That way you would only update when there is an actual update.
Otherwise you might set up a Nagios plugin and check that runs once a day, and if the timestamp of the plugin file on your XI is less than 24 hours different than the time the check runs, you would run an event handler that pushes out the new code via rsync.
Or even if you want you could run it on the timestamp of the directory, since rsync is pretty smart and will only update individual files if there is a diff, and that way you don't have to loop through every plugin in the directory.
Otherwise you might set up a Nagios plugin and check that runs once a day, and if the timestamp of the plugin file on your XI is less than 24 hours different than the time the check runs, you would run an event handler that pushes out the new code via rsync.
Or even if you want you could run it on the timestamp of the directory, since rsync is pretty smart and will only update individual files if there is a diff, and that way you don't have to loop through every plugin in the directory.
-
- Posts: 39
- Joined: Mon Mar 21, 2022 7:53 am
Re: Push Custom Plugins
That's where my mind was originally going but that doesn't work for Windows I don't know of a powershell equivalent to rsync but if there is one, I'm open to using it.DoubleDoubleA wrote: ↑Wed Dec 04, 2024 11:20 am Or even if you want you could run it on the timestamp of the directory, since rsync is pretty smart and will only update individual files if there is a diff, and that way you don't have to loop through every plugin in the directory.
- jmichaelson
- Posts: 265
- Joined: Wed Aug 23, 2023 1:02 pm
Re: Push Custom Plugins
You might be able to use cygwin https://cygwin.com/ to get at rsync. Windows Services for Linux is also an option to get at rsync. There's also robocopy https://learn.microsoft.com/en-us/windo ... s/robocopy if you'd like a fully native Windows tool.
Please let us know if you have any other questions or concerns.
-Jason
-Jason