···
________________________________________
From: checkmk-en [checkmk-en-bounces@lists.mathias-kettner.de] on behalf of Paraic O'Ceallaigh [poceallaigh@fexco.com]
Sent: 15 March 2017 22:02
To: Mathieu Levi; Matthew Laub
Cc: mlist@libero.it; checkmk-en@lists.mathias-kettner.de
Subject: Re: [Check_mk (english)] R: Re: Triggering a script on aremote server
Hi Matthew
http://mathias-kettner.com/cms_alert_handlers.htmlhttp://mathias-kettner.com/cms_alert_handlers.html - see Section 8 at the end which seems to describe what you are looking for.
The caveat is it's for Enterprise edition and also only available in version 1.4 on, so maybe not going to fit for you.
Rgds
Paraic
________________________________
From: checkmk-en [checkmk-en-bounces@lists.mathias-kettner.de] on behalf of Mathieu Levi [mlevi+cmk@collective.com]
Sent: 15 March 2017 21:54
To: Matthew Laub
Cc: checkmk-en@lists.mathias-kettner.de; mlist@libero.it
Subject: Re: [Check_mk (english)] R: Re: Triggering a script on aremote server
I'm curious about this myself. Something tells me this would happen somewhere off of the 'Notifications' workflow. Having thought about this (I'd love to hear feedback from the CMK devs), it feels like it could happen via a Notification Method plugin in Notifications. For example, you have a Pagerduty, SMS, ASCII text and other 'methods'. There's no reason why someone couldn't write a 'run this command' on 'this host' type 'plugin' (if it's even called a plugin). I'm curious what's involved at that, and if there's any documentation somewhere that exposes that possibility. Taking a look at the Pagerduty plugin as an example, I see it run a script out of $OMD_ROOT/local/share/check_mk/notifications, which takes the parameters specified in WATO. It's got everything you'd need in terms of variables being passed to a script.
I'm probably oversimplifying, but I'm curious if there's any documentation out there for custom notification methods. "Remote Run" would be kind of cool to have as a Notification Method.
That said, there's some documentation out there for some of that extensible behavior, except for the event console config. https://mathias-kettner.de/checkmk_mkeventd_actions.html . Maybe if all the notifications went to Event Console ("Send notifications to Event Console in Global Settings in WATO) were enabled, it wouldn't be so hard. I haven't tested that yet.
I can't think of another clean way. You probably don't want the check_mk_agent script local to the host doing anything that isn't really idempotent, and it's not its job anyway to run scripts that make system changes, so that's out. One could configure standard e-mail alerts using ASCII, to an e-mail box where a postfix or some utility parses the inbound e-mails and then runs whatever script you want, but that'll be disjointed from the Check_MK instance.
Matt
On Wed, Mar 15, 2017 at 4:30 PM, Matthew Laub <mjlaub@mmm.com<mailto:mjlaub@mmm.com>> wrote:
Hi,
I certainly appreciate the replies! But I guess I wasn’t very clear, or I am still not understanding.
My goal is to trigger a script on a monitored server via CMK, based off an already configured check. Not create a remote script to create a check in CMK.
For example,
• Setup a basic active website check --> “Check HTTP Service” , call it “ApacheWebPage”
• “ApacheWebPage” check is now configured and green for server “x” httpd service.
• “ApacheWebPage” check moves to red for server “x”. (The website is down)
• CMK notifications can trigger a local script in the “/omd/sites/<site>/local/share/check_mk/notifications/” directory off of this check.
Can you trigger a script locally on server “x” using the agent on server “x”.
I am currently prototyping a method to use CMK notifications to trigger a script that remotely starts services on server “x”, unattended.
It would be a heck of a lot easier if the agent just allowed you to trigger a remote script, or command, like "systemctl restart httpd.service" for the example above. Especially for a windows server. I am thinking of using ansible to do those…but a canned solution would be awesome.
Thanks!
-Matt
From: mlist@libero.it<mailto:mlist@libero.it> [mailto:mlist@libero.it]
Sent: Wednesday, March 15, 2017 2:56 PM
To: Daniele Delaria <Daniele.Delaria@michaelkors.com<mailto:Daniele.Delaria@michaelkors.com>>; Matthew Laub <mjlaub@mmm.com<mailto:mjlaub@mmm.com>>; checkmk-en@lists.mathias-kettner.de<mailto:checkmk-en@lists.mathias-kettner.de>
Subject: [EXTERNAL] R: Re: [Check_mk (english)] Triggering a script on a remote server
Hi Matt
Daniele did you a good suggestion but if you want a real step by step guide, please have a look at "check_mk beginner guide"
----Messaggio originale----
Da: "Daniele Delaria" <Daniele.Delaria@michaelkors.com<mailto:Daniele.Delaria@michaelkors.com>>
Data: 15/03/2017 16.06
A: "Matthew Laub"<mjlaub@mmm.com<mailto:mjlaub@mmm.com>>, "checkmk-en@lists.mathias-kettner.de<mailto:checkmk-en@lists.mathias-kettner.de>"<checkmk-en@lists.mathias-kettner.de<mailto:checkmk-en@lists.mathias-kettner.de>>
Ogg: Re: [Check_mk (english)] Triggering a script on a remote server
Hi Matt,
You can do this with “local checks”, performed by the agent.
What you need to do is:
1) Place the script in the directory monitored by the Check MK agent, you can find it with “cmk -d <host>” run on the Check MK server.
2) You need to play with the output provided by the script, it doesn’t work with a simple exit code and the output you want.
All the details on how to create the expected output can be found here:
https://mathias-kettner.de/checkmk_localchecks.html
Regards,
Daniele
From: checkmk-en [mailto:checkmk-en-bounces@lists.mathias-kettner.de] On Behalf Of Matthew Laub
Sent: mercoledì 15 marzo 2017 15:38
To: checkmk-en@lists.mathias-kettner.de<mailto:checkmk-en@lists.mathias-kettner.de>
Subject: [Check_mk (english)] Triggering a script on a remote server
Hi,
I know you can trigger a script on the CMK server via notifications. However, I want CMK to trigger a script on a remote server via the client on a remote server that is being monitored.
Is this possible? What am I missing?
I am using version 1.2.6p12
Thanks!
-Matt
The information and attachments contained in this electronic transmission are considered proprietary and confidential. Distribution of this material to anyone other than the addressed is prohibited. Any disclosure, copying,distribution or use of the contents of this transmission or any attachments for any reason other than their intended purpose is prohibited. If you have received this transmission in error, please contact the sender. All employees of Michael Kors and all affiliates in the United States and internationally are expressly required not to make defamatory statements, and not to infringe or authorize any infringement of copyright or any other legal right by email communications. Any such communication is contrary to company policy and outside the scope of employment of the individual concerned. The company will not accept any liability in respect of such communication and the employee responsible will be personally liable for any damages or other liability arising.
3M security scanners have not detected any malicious content in this message.
Click here<https://spam.mmm.com:443/pem/pages/digestProcess/digestProcess.jsf?content=aedaaa864ecbae94feabb75e960f807042eba66ebbd0b6730ba2aa65055515a7c6c4ff5fb22097b592aab29dac82584fe1eb9b4e09b45156155763787fc4d065b260a42b11f3a62c0c1c7347d342bafeb066babf3d01491bb05ac7742aec8c9504315a7134db51796fb756473cd57bc2696f8c095ce44441e17819bae73fb0d42f3935cdf41b2721> to report this email as spam
_______________________________________________
checkmk-en mailing list
checkmk-en@lists.mathias-kettner.de<mailto:checkmk-en@lists.mathias-kettner.de>
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en
--
Fortress Shield (by ParaTech, LLC)
This email, including any attachments, is confidential. If you are not the named recipient, please contact the sender and delete all copies of this email from your computer system(s).
_______________________________________________
checkmk-en mailing list
checkmk-en@lists.mathias-kettner.de
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en
--
Fortress Shield (by ParaTech, LLC)