Where to execute script to add server to Zabbix monitoring system?

1,034 views
Skip to first unread message

JeremyCampbell

unread,
Sep 11, 2012, 7:28:46 PM9/11/12
to puppet...@googlegroups.com
I've written a script which adds a new server to our Zabbix monitoring system using their api. This script contains the api username and password so I wouldn't want it sitting on the puppet clients. I assume to execute it on the puppetmaster side I need to configure the script as a custom function? And to avoid the script from contacting the Zabbix server every run, it could write the host name to a file which it checks beforehand. Would that be the way to go or are there any better approaches?

Florian Koch

unread,
Sep 11, 2012, 11:58:09 PM9/11/12
to puppet...@googlegroups.com
hi, do you use the zabbix agent? if you, the agent can autoregister itself so no custom script is needed

regards flo




Am 12.09.2012 um 01:28 schrieb JeremyCampbell <jeremyca...@gmail.com>:

> I've written a script which adds a new server to our Zabbix monitoring system using their api. This script contains the api username and password so I wouldn't want it sitting on the puppet clients. I assume to execute it on the puppetmaster side I need to configure the script as a custom function? And to avoid the script from contacting the Zabbix server every run, it could write the host name to a file which it checks beforehand. Would that be the way to go or are there any better approaches?
>
> --
> You received this message because you are subscribed to the Google Groups "Puppet Users" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/zpww3ilJjlMJ.
> To post to this group, send email to puppet...@googlegroups.com.
> To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
>

JeremyCampbell

unread,
Sep 12, 2012, 5:57:40 AM9/12/12
to puppet...@googlegroups.com
Hi Flo,

I think you misunderstood my question. Yes, we are using puppet clients running the agent and a central puppetmaster. However, each puppet client also needs to be monitored by our Zabbix monitoring system. I'm trying to figure out the best way to add each puppet client to the Zabbix monitoring system the first time they are configured. Should the script which adds them run on the client or the server? The server seems like the safest choice but Im not sure what would be the best method.

Thanks.

Walter Heck

unread,
Sep 12, 2012, 6:23:34 AM9/12/12
to puppet...@googlegroups.com
Typically you could use exported resources for this. Each client
exports a zabbix custom define, those defines are collected on your
zabbix server by each puppet run. That run then adds those servers to
zabbix if they aren't already there.

cheers,

Walter
> https://groups.google.com/d/msg/puppet-users/-/MngwM5rECMIJ.
>
> To post to this group, send email to puppet...@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.



--
Walter Heck

--
Check out my startup: Puppet training and consulting @ http://www.olindata.com
Follow @olindata on Twitter and/or 'Like' our Facebook page at
http://www.facebook.com/olindata

JeremyCampbell

unread,
Sep 12, 2012, 12:51:25 PM9/12/12
to puppet...@googlegroups.com
Thanks Walter,

At this point in time the Zabbix server is not puppetized. If I could get it puppetized, I'm guessing that the best approach (considering that the only way to add new hosts is through the API) is for each client to export a define with an exec resource which runs the script on the Zabbix server when it realizes the define containing the exec during its own run. Is that right?

Walter Heck

unread,
Sep 12, 2012, 12:59:33 PM9/12/12
to puppet...@googlegroups.com
Yup. If you wanna go fancy you write a custom type that does that,
it's better/more appropriate then a define with an exec.

cheers,

Walter
> https://groups.google.com/d/msg/puppet-users/-/gBkC3QON3FsJ.

Ashley Penney

unread,
Sep 13, 2012, 8:46:21 AM9/13/12
to puppet...@googlegroups.com
You might be able to use generate() for this - it runs the command on
the puppetmaster and returns the result to the client. Should be easy
enough to use safely!

On Tue, Sep 11, 2012 at 7:28 PM, JeremyCampbell
<jeremyca...@gmail.com> wrote:
> I've written a script which adds a new server to our Zabbix monitoring system using their api. This script contains the api username and password so I wouldn't want it sitting on the puppet clients. I assume to execute it on the puppetmaster side I need to configure the script as a custom function? And to avoid the script from contacting the Zabbix server every run, it could write the host name to a file which it checks beforehand. Would that be the way to go or are there any better approaches?
>
Reply all
Reply to author
Forward
0 new messages