As part of this series of Oracle Enterprise Manager blogs we thought it would be useful to give a quick overview of how Oracle Enterprise Manager 13c users can create, initate or schedule .js jobs against mongoDB.
Why would we do this?
Possible use cases could be:
- manually run a data fixup or schema creation in a consistent and reproducable manner using stored code
- schedule nightly batch update jobs
- store reusable scripts in a jobs library and run against multiple targets
- reuse stored credentials or provision access to these to other OEM accounts (thus enforcing a high level of security)
Setting things up
Ok, a quick overview of what’s required to set this up.
As a starting point we have the mongoDB target created in OCI, described in our earlier blog.
We also have mongoDB installed on our OEM agent machine – this is called by the job.
We next created a ‘testUser’ acccount, with appropriate rights on a new database, ‘test’:
Next, within OEM 13c, we’ll head to the job activity page:
We can then click ‘Create Job’ and choose the ‘Execute mongoDB .js file’ job type:
Next, we supply the relevant job parameters:
And we configure the job to do a simple insert of 3 records into a new collection. We then return the rows to the job output:
Job .js script details in larger font…
For job credentials, we use :
- the agent os user for Host Credentials, ‘oracle’ in this case
- the mongoDB account created earlier for mongoDB Credentials, testUser
Note: OEM can store the credentials for reuse – this is fully encrypted within the repository.
Choose Schedule/Access options as required, then ‘Submit’:
The job runs. We can see that it has succeeded, very quickly – 4 seconds.
Output can be obtained from the ‘Output Log’ section, or downloaded from the browser and examined in Notepad:
The job can easily be saved to the jobs library for reuse (as can the credentials needed by the job).
Running custom .js based jobs against mongoDB is really easy when combined with the AIDEV mongoDB plugin for Oracle EM13c.
The plugin’s integration with the OEM13c job framework allows for simple job creation, execution, scheduling and reuse.
Integration with OEM’s credential management framework allows for the reuse of named credentials and the granting of encrypted named credentials to other OEM accounts.
The plugin datasheet can be found here.
If you’re interested in testing it for your site, let us know.
For more info on the mongoDB plugin, jump over to http://www.aidev.uk/s1/mongo.html or drop us a comment here and we’ll get back to you.
AIDEV have the following plugins available and listed on the Oracle Extensibility Exchange:
- SSL certificate
- REDIS data store
For more information on our OEM plugins or how we can create plugins for your applications, reach out to us.
Subscribe to receive notification of updates to our blog posts…