[ZBXNEXT-97] ability to test an action in frontend Created: 2009 Oct 06  Updated: 2022 Jun 24

Status: Open
Project: ZABBIX FEATURE REQUESTS
Component/s: Frontend (F)
Affects Version/s: None
Fix Version/s: None

Type: New Feature Request Priority: Minor
Reporter: Christoph Haas Assignee: Unassigned
Resolution: Unresolved Votes: 181
Labels: actions, patch, usability
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by ZBXNEXT-2704 create ability to re-trigger alert Closed
is duplicated by ZBX-9287 Possibility to try Triggers Closed
Sub-task
depends on ZBXNEXT-3939 Support negation in custom expression... Closed
depends on ZBX-12945 Action was performed, but the conditi... Closed

 Description   

I have seen several people (including me) asking for a way to test actions from the web interface.

That would help find out if sending an SMS/Jabber message/email to a certain user works or if a certain action is run as intended.



 Comments   
Comment by Steve mushero [ 2010 May 22 ]

We would love this - we have numerous complex (lots of macros) emails and SMS messages that link to other systems and need a way to test them, though of course one problem is how to get valid data in the macros for the action, but just getting any action to send email and SMS, etc. would be nice.

Comment by Andy Shinn [ 2011 Feb 16 ]

Maybe another form that has fields for the macros in the action messages to be replaced? This would let you fill in test data for each of the macros used in the messages for the actions. Maybe this form could also have check boxes for which action steps to perform (for example, maybe you don't want to actually run scripts and just want to send messages).

Comment by Gertjan Awater [ 2011 May 30 ]

I'd love this as well, being able to test those action, if possible being able to see the log of what happened.

Comment by mof [ 2011 Nov 01 ]

I would also appreciate this very much. Not just for testing of actions, but this feature would also make users of Zabbix able to execute actions on a host "on demand" not necessarily issued by a trigger.

Comment by richlv [ 2011 Nov 01 ]

manually running commands on hosts may be achieved with frontend/global scripts (see administration -> scripts)

Comment by Christoph Haas [ 2011 Nov 02 ]

@richlv: It's not about running scripts or commands on hosts. The problem is that we cannot run actions manually. Let's say I have just set up an SMS gateway and want to try it. Or see if the right group of people is getting an email. Currently we are doomed to fire dummy triggers (e.g. if /tmp/test exists) and wait for the next check cycle. But that's too much trial and error for my taste. I'd just like to make an action start on demand.

Comment by richlv [ 2011 Nov 02 ]

please note that the script suggestion was only for the previous poster and a response to "...this feature would also make users of Zabbix able to execute actions on a host "on demand" not necessarily issued by a trigger."

Comment by mof [ 2011 Nov 02 ]

@richlv: for what I know administration -> scripts is for scripts on the Zabbix server - not remote commands, please correct me if I'm wrong.
I also agree that it would be useful to be able to test actions eg. for sending out notifications, and my point is just that an action can also be a remote command, which I think would be very useful to be able to fire off manually from the website and perhaps through the API.

Comment by richlv [ 2011 Nov 02 ]

in 1.8 scripts are executed on server, in 2.0 you will be able to choose server/agent. they all also can be used as action targets. but let's keep discussions on irc or elsewhere

Comment by mof [ 2011 Nov 02 ]

@richlv Thanks, I have not testet 2.0 yet, but thanks.
Still 1 vote for test of actions.

Comment by Volker Fröhlich [ 2012 Dec 26 ]

Proof of concept patch and screenshots for a 2.0.4 action simulator:

http://www.geofrogger.net/review/actionsim/v2/
http://www.geofrogger.net/review/actionsim/action_sim.txt

Comment by Volker Fröhlich [ 2013 Jan 02 ]

Vastly improved:

http://www.geofrogger.net/review/actionsim/v3/

Comment by Volker Fröhlich [ 2013 Apr 24 ]

Another round of improvements:

http://www.geofrogger.net/review/actionsim/v4/

Comment by Andrew [ 2013 Jun 19 ]

This would make an excellent addition to the product.

Comment by Michael H [ 2013 Jul 19 ]

Volker Fröhlich's actionsim patch is incredibly useful to assist in determining why actions aren't notifying, and I would love to see it in the mainstream codebase.

Comment by Volker Fröhlich [ 2013 Sep 07 ]

Way advanced, but still at an alpha stage:

http://www.geofrogger.net/review/actionsim/action_sim.txt
http://www.geofrogger.net/review/actionsim/v5/

Comment by yayo [ 2013 Sep 09 ]

Volker Fröhlich: All the url to the actionsim you have posted return a 403 error ... Please Fix!

zabbix team: please include the simulation to the official release! We need it!!!

Comment by Volker Fröhlich [ 2013 Sep 09 ]

Solved in the meantime, thank you for reporting!

Comment by Volker Fröhlich [ 2013 Nov 21 ]

I solved a few bugs in v5 and also released a draft patch for 2.2 that does exactly the same thing. At least it's supposed to.

Comment by Mikkel Nielsen [ 2014 Feb 24 ]

I cannot get it working on Zabbix 2.2.2 - maybe I'm missing something

I downloaded the patch file http://www.geofrogger.net/review/actionsim/v5/zabbix-2.2/action_simv5.1.1-zabbix2.2.patch

Then I'm getting the following error:

# patch -p0 < /tmp/action_simv5.1.1.patch 
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/frontends/php/api/classes/CAction.php b/frontends/php/api/classes/CAction.php
|index bf23c18..f61dba7 100644
|--- a/frontends/php/api/classes/CAction.php
|+++ b/frontends/php/api/classes/CAction.php
--------------------------
File to patch:
Comment by Volker Fröhlich [ 2014 Feb 24 ]

-p1

Comment by Harald Stowasser [ 2014 Apr 28 ]

Zabbix was not installed in "/frontends/php/". I found the files in /usr/share/zabbix/api/classes/CAction.php

After I edited the Filenames
patch --strip=1 < ~/action_simv5.1.1-zabbix2.2.patch
was running well.

System:
Zabbix 2.2.3
Debian GNU/Linux 7.4 (wheezy)

Comment by Gene Liverman [ 2014 Sep 15 ]

I have installed this on Zabbix 2.2.6 and when I click the Actions? link all I get is a blank popup. The title of the popup seems to be set correctly but the body is empty. When looking at the headers I see that it is getting a 500 response code (headers below) with the following error in the Apace log:

[Mon Sep 15 07:48:30 2014] [error] [client 10.10.10.222] PHP Fatal error:  Cannot redeclare CAction::run() in /usr/local/share/zabbix_actionsim/api/classes/CAction.php on line 951, referer: https://zabbix.example.edu/actionsim/triggers.php?groupid=11&hostid=10497&switch_node=0




https://zabbix.example.edu/actionsim/popup_action.php?dstfrm=action&triggerid=20508

GET /actionsim/popup_action.php?dstfrm=action&triggerid=20508 HTTP/1.1
Host: zabbix.example.edu
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Referer: https://zabbix.example.edu/actionsim/triggers.php?groupid=11&hostid=10497&switch_node=0
Cookie: zbx_sessionid=161f1ecd9f1c1c6b068d4a7acdd6ac5f; cb_triggers_10497_parts=0; PHPSESSID=jbj0fp9n123717qmhsi5q4efu0; __utma=185289903.1639910548.1400466195.1409946373.1409947173.10; __utmz=185289903.1400466195.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
Connection: keep-alive
Cache-Control: max-age=0

HTTP/1.0 500 Internal Server Error
Date: Mon, 15 Sep 2014 11:42:27 GMT
Server: Apache/2.2.15 (Red Hat)
X-Powered-By: PHP/5.3.3
Set-Cookie: zbx_sessionid=161f1ecd9f1c1c6b068d4a7acdd6ac5f; expires=Thu, 16-Oct-2014 11:42:27 GMT; secure
Content-Length: 1397
Connection: close
Content-Type: text/html; charset=UTF-8
Comment by Volker Fröhlich [ 2014 Sep 15 ]

This is a community patch. Please contact me through the means listed on http://zabbix.org/wiki/Docs/action_simulator#Intention_of_this_development, preferably IRC.

I'll try to figure out what that is in the meantime.

Comment by richlv [ 2014 Sep 30 ]

given that "testing an action" (as opposed to a media type) would not be that feasible, maybe action simulator approach is the best to solve this issue

Comment by James Sperry [ 2014 Oct 02 ]

I agree with richlv, the action simulator is the best approach.

So my question is whether there is another ZBX issue for that, or is this the one I should be watching and voting for. ??

Thanks.

Comment by Ebonweaver [ 2015 Jan 31 ]

Running 2.4.3, still looking for this feature. Not sure why this has not been added. Seemingly simple addition, just a button for the action that is "Test" or "Simulate" or the like so it fakes the flipping of one of the included trigger conditions to make the action fire. Without this, there is no way to know your action will function as desired, which seems like a serious deficiency in using the product.

Comment by Marco Hegenberg [ 2015 Feb 05 ]

This would be a useful feature!

Comment by Felix Wong [ 2015 Feb 10 ]

very much +1

Comment by Doug Irvine [ 2015 Sep 16 ]

Yes please +1

Comment by Alexander Bergolth [ 2015 Sep 18 ]

+1

Comment by Oleksii Zagorskyi [ 2015 Sep 18 ]

Please, do not spam here with such messages
There is a buton to vote, top of the page.

Comment by Oleksii Zagorskyi [ 2015 Sep 30 ]

Maybe wort also mention that it has been posted here as well http://blog.zabbix.com/why-on-earth-was-i-not-notified/2027/

Comment by Micha Slezak [ 2016 Jun 09 ]

Here is nice page http://www.zabbix.com/development_services.php where on the bottom of this page is possibility to Contribute on specific feature. I think that it can be way how to promote some feature requests and to do something like crowdfunding on specific feature. Zabbix dev setup price and we can contribute on this feature I think it can be good way how to pay for each feature and to to pay whole development by one customer.

Comment by Volker Fröhlich [ 2016 Sep 09 ]

A new and greatly improved version for 3.0 is available now.

Comment by Christoph Haas [ 2017 Mar 08 ]

Has this feature requests really be pushed around the todo list for 7 years now? I'm close to giving up and deleting the request…

Comment by James Sperry [ 2017 Mar 08 ]

NO DON'T DELETE IT. One of the first things I do with EVERY Zabbix installation is install the Action Simulator. I have 3 other people I work with and help support their Zabbix environment, and every single one tells me how useful this feature is.

It really needs to be apart of Zabbix.

Comment by Pratick Rajbhandari [ 2017 Dec 05 ]

Hi guys, anyone got this working on Zabbix 3.2 / 3.4 ? Tried to install the patch on both 3.2 and 3.4, result:

root@zabbix-3:/usr/share/zabbix# patch -p1 < /tmp/action_simv5.2.0-zabbix-3.0.patch
patching file include/actions.inc.php
patching file include/classes/actions/ActionSimulation.php
patching file include/classes/api/services/CAction.php
Hunk #1 succeeded at 777 (offset 62 lines).
patching file include/classes/core/ZBase.php
patching file include/defines.inc.php
Hunk #1 succeeded at 574 (offset 39 lines).
Hunk #2 succeeded at 1069 (offset 65 lines).
Hunk #3 succeeded at 1112 (offset 65 lines).
patching file include/html.inc.php
Hunk #1 succeeded at 726 (offset 32 lines).
patching file include/menu.inc.php
Hunk #1 succeeded at 211 (offset -1 lines).
patching file include/views/configuration.triggers.actions.php
patching file include/views/configuration.triggers.list.php
Hunk #1 succeeded at 82 (offset 7 lines).
Hunk #2 FAILED at 105.
Hunk #3 succeeded at 212 (offset 3 lines).
Hunk #4 FAILED at 241.
2 out of 4 hunks FAILED – saving rejects to file include/views/configuration.triggers.list.php.rej
patching file popup_action.php
patching file styles/blue-theme.css
Hunk #1 succeeded at 405 with fuzz 2 (offset 13 lines).
Hunk #2 succeeded at 2206 (offset 150 lines).
patching file styles/dark-theme.css
Hunk #1 succeeded at 428 with fuzz 2 (offset 21 lines).
Hunk #2 succeeded at 2229 (offset 158 lines).
patching file triggers.php
Hunk #1 FAILED at 491.
1 out of 1 hunk FAILED – saving rejects to file triggers.php.rej

Comment by Mikhail Okhotin [ 2018 Jan 09 ]

Patch with my fixes for Zabbix 3.4.4 https://nofile.io/f/2EBV4Hs3uTb/zbx344.5.action.patch

Comment by Alexei Vladishev [ 2018 Jul 23 ]

I hope that this functionality might be implemented in Zabbix 4.2 if everything goes well. It should cover testing of media types like sending of a test message as well as testing of actions, which is a more complex topic.

Comment by Volker Fröhlich [ 2018 Jul 23 ]

So it will be in the server code?

Comment by Alexei Vladishev [ 2019 Mar 16 ]

> So it will be in the server code?

Sorry, Volker, I missed your question. This functionality is included into roadmap of 4.2, now I see clearly that it won't be implemented due to lack of time. Planned release date is approaching fast.

I am afraid I can hardly answer any implementation related questions about testing of actions since we didn't start any real work on high level design documentation yet.

Note that testing of media types is already implemented and will be available in 4.2.

Comment by Jonny [ 2019 Mar 18 ]

Puh, in Oct. this important feature request becomes 10 Years old.
I think i will drink a beer on 10th Birthday 

Comment by dimir [ 2019 Mar 18 ]

Ability to test media type: ZBXNEXT-1238

Comment by Inetov [ 2019 Oct 02 ]

@Volker Fröhlich, do you plan to make the patch version for 4.x?
 

Comment by dimir [ 2019 Oct 02 ]

FYI, the issues of making a patch for 4.x:

  • createDateSelector() function is gone
  • popup implementation changed a lot (PopUp() method), e. g.
    • parameters
    • data expected in json format instead of html
Comment by thjl [ 2019 Oct 31 ]

Already a time ago Volker Fröhlich wrote about it at http://www.zabbixbook.com/2018/03/23/still-wondering-where-the-action-simulator-is-in-2018/. A pity that this feature is still not yet implemented altough in the roadmap of 4.2. Hopefully it will come with 5.0?

Comment by Michael H [ 2021 Jan 16 ]

Volker's action simulator was an indispensable tool to me while I was using 2.2.  Now that I am running 4.0, I am disappointed than not only has the functionality not been added, but there is no longer a working patch.  Any possibility of seeing one in 2021?

Comment by Volker Fröhlich [ 2021 Jan 16 ]

If you are willing and able to contribute to the frontend part, see comment above, I'm still willing to work on it.

(Volter and Volker are fine)

Comment by Mickael Martin (Cyres) [ 2021 Feb 12 ]

Hello,

volter can you package your simulator as a plugin please ? It's really usefull !

Comment by thjl [ 2022 Jun 14 ]

Apparently it was forgotten, as it was already planned for version 4.2. The roadmap shows planned features marked as top voted, for example, with only 20 votes as it seems. I wonder if this feature with 175 votes will ever make it.

Generated at Thu Apr 25 17:48:03 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.