As I already discussed in thread http://support.nagios.com/forum/viewtop ... it=+action, My webbrowser (Firefox) hangs when executing actions that take a while to finish. See screenshot. As you can see the top left webpage hangs while my quick action to update all Windows hosts is running. So at this time I'm preferring to start longer quick actions from cli, as they make the browser unusable while the script is running.
I thought it was solved, by using the last version of the action component, but noticed this week it is not solved. The nagios XI webpage hangs untill the quick action stops running.
In order to use the actions component instead of the Nagios XI cli for scripts that take longer then 5 seconds, I would need some solution for this. Any tips?
Long actions make browser hang
Long actions make browser hang
You do not have the required permissions to view the files attached to this post.
Nagios XI 5.8.1
https://outsideit.net
https://outsideit.net
Re: Long actions make browser hang
How important is it that you see the output? I'm thinking this is a combination of PHP timeouts, AJAX handling, and the script itself. If the script forked itself and exited, the upgrade might still run in the background and the page can "complete", then you could maybe save the output to a file and view that in the web interface later.
Former Nagios employee
Re: Long actions make browser hang
Hmm it's important to see the final output, so if you would have some way to display the output in the browser when the script ends, that would be ok for me. The script is already outputting to a logfile to. I'm not really sure how I should proceed in doing what you propose.
Grtz
Willem
Grtz
Willem
Nagios XI 5.8.1
https://outsideit.net
https://outsideit.net
Re: Long actions make browser hang
What if the output appeared down in the footer as a "notice", would that be ok?
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.
"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.
Re: Long actions make browser hang
Hey Andy,
Thanks for your input. I'm not exactly sure what you mean with the footer, as at this time it's just one blank page. But I think it would be ok, as long as I can see or during the script execution or when the script end, if all hosts updates went fine. I will edit my script to summarize at the end how many have failed.
Grtz
Thanks for your input. I'm not exactly sure what you mean with the footer, as at this time it's just one blank page. But I think it would be ok, as long as I can see or during the script execution or when the script end, if all hosts updates went fine. I will edit my script to summarize at the end how many have failed.
Grtz
Nagios XI 5.8.1
https://outsideit.net
https://outsideit.net
Re: Long actions make browser hang
The way I would do this is have the action link to a second page that kicks off/forks the script in the background which logs to a file. Then some AJAX could periodically refresh a view of the log for output.
http://stackoverflow.com/questions/1455 ... ess-issues
http://stackoverflow.com/questions/1455 ... ess-issues
Former Nagios employee
Re: Long actions make browser hang
Hmmm Trevor,
You kind of made my head spin... The action is linking to a Bash script at this time that will get all the members of a hostgroup and then call three or four Powershell scripts, one optional to install the NSClient latest allowed version, one to update the NSClient scripts folder, one to generate the nsclient.ini and one to push the downtime tool to the desktop of the server.
The output I get comes from the error handling of the Powershell script and some of the Bash scripts.
So i'm not really sure where to link to the second page that would kick off or fork the scripts in the background. I would also prefer to not have two tabs opened for each action I click.
Grtz
Willem
You kind of made my head spin... The action is linking to a Bash script at this time that will get all the members of a hostgroup and then call three or four Powershell scripts, one optional to install the NSClient latest allowed version, one to update the NSClient scripts folder, one to generate the nsclient.ini and one to push the downtime tool to the desktop of the server.
The output I get comes from the error handling of the Powershell script and some of the Bash scripts.
So i'm not really sure where to link to the second page that would kick off or fork the scripts in the background. I would also prefer to not have two tabs opened for each action I click.
Grtz
Willem
Nagios XI 5.8.1
https://outsideit.net
https://outsideit.net
Re: Long actions make browser hang
I guess "second page" wasn't the right phrase. It could all be done on the same "page" but kick off the bash process in the background. The link I posted should work for backgrounding in this manner, but I would have to test it myself to know for sure. If it does work that way, then having the scripts write to a single logfile would work then the action component could have the AJAX that displays the logfile in realtime.
Former Nagios employee
Re: Long actions make browser hang
So I would have to call my update script like this from a wrapper script?
And how would I enable AJAX to display this log with the actions component?
Grtz
Willem
Code: Select all
file=/user/local/nagios/libexec/naf/tempfile.log
exec("naf_mass_update_host_windows_01.sh $file > /dev/null &");Grtz
Willem
Nagios XI 5.8.1
https://outsideit.net
https://outsideit.net
Re: Long actions make browser hang
Well, as you are piping it to /dev/null, I don't think you see the output anywhere. You could create one quick action script to run the action in the background and write the output to a file. Then write another quick action to display that file.
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.
"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.