Can we implement a custom ambari actions for upload/download purpose - ambari

Right now, we are using ambari to manager some custom serveices. we have followed the rules,like "add custom service/stacks" in ambari. we also read the info: "how to add custom actions" beside the routined life cycle actions, such as: "install, configure, start and stop"
However, our design need some special actions, for examples, Dowloading log/thread dumps from the server, or upload special key files to use in ssh/key auth. Have seached the web many days ,but find no clues.
Is it possible to do so?
Thanks

#stdanley
It sounds like some of the functionality you are describing could be done with a custom Ambari View. For example, the hdfs/files view allows uploading files to hdfs. You should investigate Ambari Views. The Smartsense view would be good one to take a look at as an example.
It would be also possible to create a custom service which provides a UI on top of ambari. You can then build the functionality you are looking for in the custom service's UI. Those actions would be outside of the scope of ambari UI, in other words, not found in ambari drop downs, tabs, etc.
It is possible to add some custom functions into ambari service Action menus. But you may find those are simple interaction triggers, not feature ads.

Related

How to start a VM instance using Cloud Scheduler

Background and Goal
I have a Debian/Linux VM on GCP which I manually start every morning and after it runs, it shuts down by itself using a Linux command. I want to automate the start of the VM by using the Cloud Scheduler. The question asked in GCP auto shutdown and startup using Google Cloud Schedulers has several answers and I am interested in pursuing the answer (https://stackoverflow.com/a/65062924/10322004) proposed by #nikelone because it seems to be simple and also it has been endorsed by #Damien and #RayFoss as being easy. I am a neophyte in these matters and I could not comprehend their replies fully. So this post was created to elicit more clear answers for a person like me.
What I have tried
I have gone to https://cloud.google.com/compute/docs/reference/rest/v1/instances/start (call this page A) and tried the API and was able to successfully start my already stopped VM when I clicked on the execute button. I presume that this means that my entries were fine and can be used in conjunction with appropriate software like Cloud Scheduler to perform the start function on a predefined schedule. But the problem is that I do not know or understand how to proceed from here. I give below my questions.
My Questions
On page A, the last three paragraphs are titled Authorization Scopes, IAM permissions, and Examples, and none of them say anything specific about what the user should do. Is it correct to assume that they have nothing to do with the Cloud Scheduler, but related to other methods to achieve the same goal? If this is not correct then my next question is what should I be doing to follow the statements in these three paragraphs?
Assuming that the answer to question 1 is "yes", meaning I can now start scheduling with the Cloud Scheduler, I next looked at the quickstart for Cloud Scheduler at https://cloud.google.com/scheduler/docs/quickstart (call this page B). The list of items to do is quite large including installing Cloud SDK, running a quite a few commands on the console, enabling some features, set up Pub/Sub, create a job, run the job and verify the results in Pub/Sub. This looks like a daunting set of tasks and I could not understand why it is necessary to jump through the hoops to use something that has already been achieved with just a few keystrokes earlier. So are these steps all necessary? Or is there a way to use the Cloud Scheduler directly without going through so many intermediate steps?
Now assume that the answer to question 2 is that I have to perform all steps stated on page B. If I run into some problem while accomplishing the tasks outlined on page B, my VM may get messed up irretrievably. Is there a way in which the Cloud Platform or its components can be used to reset my VM to its current state as of today, which is working fine? I really do not want to end up with something worse than what I have now.
To answer your questions:
Auth Scopes and IAM permissions are required for you to call the Compute Engine API methods such as instance.start & instance.stop. You need to set the right scope and the right IAM permission on your job or else it will fail. They are indeed related to the method that you're interested to call so you must keep them in mind. What you see on the examples are the ways to call the {API} using different programming languages so you don't need to pay attention to them as you will create the job through the Cloud Console. To further address this part, see the full steps I included below.
The answer that you're trying to follow uses HTTP target while the quickstart you've linked uses Pub/Sub and they are different with each other because they have separate use cases. This link shows a proper instruction how to create a scheduler job with an HTTP target. You can create this kind of job straight from the Cloud Console or a one-liner gcloud command. If your config is incorrect, the trigger will not execute the endpoint URL and you will see an error that you must fix.
Addressed on answer #2
Basically, you just need to follow the instructions to the link you've sent. However, I'll post it here as well along with my explanation:
Go to https://cloud.google.com/scheduler. Click on Go to Console. Click on Create Job. Fill up the required fields (those with red asterisks) when creating a Scheduler Job.
Select HTTP as target type.
Enter this as your URL (modify the capitalized words).
https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/INSTANCE_ZONE/instances/INSTANCE_NAME/start
Choose HTTP method POST.
Click show more and choose Auth Header "Add OAuth Token"
Enter your service account. This is used to pass an OAuth Token when your scheduler job calls the Compute API. Make sure that the service account you will use have the "Compute Instance Admin" role because this role contains the permissions to start/stop your instance. See this instruction how to grant access on a service account. If you're not sure what service account to use, feel free to use the Compute Engine default service account.
Add this on Scope:
https://www.googleapis.com/auth/cloud-platform
The description of this scope:
See, edit, configure, and delete your Google Cloud Platform data.
Repeat for Stop instance job and change URL in #3.

creating movie template "on the fly"

i want to develop a site where user selects various videos and site will render a single video containing all videos in a pre-built template.
what would be the way to go about this (in order to create the movie dynamically from site) ?
what would be the server side framework to use ?
can i use after-effects and have site use it to generate such templates (optional - as i have a friend who works with after effects and can create templates) ?
as i am fairly new to the field any additional information is welcomed.
I'm no expert, but I'm pretty sure you can't do what you described.
Rendering a video consumes huge resources (really huge), so a server park that could
handle this is just not worth it.
However, what you can do is to play the selected videos consecutively. That way, no rendering is necessary.
Also, forget about After Effects, for the same reasons described above.
You can achieve what you want by using a new plugin for After Effects called Templater Bot. From Dataclay's site:
Templater Bot is an enterprise solution for custom video on demand. It works as an automated system. Use it to periodically check for incoming data, pull new data in, and render video as a background process. Or use the command line interface to push data in to create new renders. Once your AE project is prepared, use Bot to customize and render it without operating the After Effects user interface. Developers can create front end applications, such as web or mobile apps, that feed data into Templater's data source, offering a collaborative, custom video content creation solution.

IBM Worklight - Can we create a custom dialog for Direct Update?

How can we use custom dialog box for direct update in worklight 6.0?
Is there any option in wlclient.js? I don't know where it should be customized in the application.
Worklight 6.0 does not provide developers the ability to create a "custom dialog box" for Direct Update.
You can submit a feature request: http://www.ibm.com/developerworks/mobile/worklight/connect.html
So Idan already answered, but I did a lot of digging prior to his answer and I thought I'd share my findings just because I spent so much time on it.
Sifting through the code, through all the checks it does to see if a Direct Update is needed, it calls an update method for the app. It utilizes a Cordova plugin called 'WebResourcesDownloader'. In turn it calls the necessary native components and that's how you get a native handler for the downloader (it is in the worklight-android.jar for Android). So, long story short, you can't customize the box itself because its rendered via the plugin/native components and you can't modify the plugin directly (not that I know of at least).
However, you can at least update all the notification messages surrounding the update in the messages.js within the wlclient folders. =)

Sitefinity, intercepting page events

Sitefinity has some documentation on how to create a page programmatically, but what I really want to do is to perform some additional logic when the "Create Page" event is fired.
From a high-level, how would one go about doing this? Is there certain interface to implement, or a class to extend?
I'm using SiteFinity 4 (4.4)
If you download SDK, you will find Utilities class which contains sample code for creating pages, templates etc.
You can create pages by using PageManager or a fluent API - everything is in the SDK.
Disclaimer: I work on the Sitefinity team at Telerik.
I'm talking from memory here, but usually you can subscribe to the Executed event of each manager in Sitefinity. It is fired on each action you perform from that manager and passes you arguments about the current command being executed. You'll have to debug and inspect what is the name of the command when creating pages, and if so do what you need.
Another alternative is to implement custom workflow and include your coded step somewhere. More info here: http://www.sitefinity.com/documentation/documentationarticles/developers-guide/sitefinity-essentials/modules/workflow-for-content-modules/custom-workflow
If you open a support ticket or write in the forums with more details, we would be glad to help.
Maybe this post "Automatically create other language versions of the page using Sitefinity API" will help...

Changing provided services based on user preferences in OSX?

I would like to be able to change the OSX services that my application provides based on the current user's preferences (like adding more, changing the name,...). This basically means modifying the Info.plist (NSService key), but I don't think it is a good practice when an application modifies its own Info.plist while running, right? (At least based on few searches here). Is there any other option how to get this functionality?
I guess it should always be an external entity who does modify the Info.plist? So far I can only think about providing a system preference bundle which will do the modification in the actual app? Do you have any ideas?
Thank you
One way would be to install a service in ~/Library/Services that provides the services, and edit that application's Info.plist from your main application.
Of course, that should be an explicit action, so the user (hopefully) knows to delete the service if they delete your application. And you should document that procedure on your product's support web page, just in case they don't.
Here's a small twist to the previous recommendations, create a separate app that handles the service and bundle it within your Resources. When you want to enable the service, instead of copying the file over to ~/Library/Services, create a symbolic link within the ~/Library/Services folder that points to the app you bundled in your Resources.
This way if the user deletes your application, all that will be left behind is a symbolic link pointing to an invalid location. Does less arm than actually leaving the app behind and will have the added benefit that the service will no longer be available (since the info.plist will have been removed when the user deleted your app).