S3 Buckets in Maximo Automation Scripts - Cloud Object Storage (COS)
Automation script to run reports and store as an attachment within an S3 bucket
Within this article we will expand on this article by Bruno Portaluri to run and store reports as Maximo attachments within an S3 bucket.
Using the Cloud Object Storage (COS) API within a Maximo automation script is a powerful way to extend the functionality of your Maximo environment and automate tasks related to storage, data retrieval, and external integrations. The COS API allows you to interact with cloud-based object storage systems, such as Amazon S3 or IBM Cloud Object Storage, directly from your Maximo environment.
1. Storage and Retrieval of Attachments:
Automatically store attachments associated with Maximo records, such as work orders, assets, or service requests, in a COS bucket.
Retrieve attachments from COS and associate them with Maximo records when needed.
2. Integration with External Systems:
You can upload data files generated by Maximo processes to COS and make them accessible to other applications or departments.
Maximo automation scripts can download data from COS for further processing or analysis, allowing you to integrate Maximo with data analytics or reporting tools.
3. Data Backup and Archiving:
Using the COS API, you can automate the process of backing up critical Maximo data to a secure cloud storage environment. This ensures data durability and simplifies disaster recovery efforts.
Maximo Automation Script Example - Storing Reports in COS (S3 Bucket)
Once your Maximo system is configured for S3 storage, you can initialise an instance of the COSApi class within your automation scripts. The below example uses the uploadFile() method to store a new file within our S3 bucket.
from com.ibm.tivoli.maximo.report.birt.admin import ReportAdminServiceRemote as ReportAdmin
from com.ibm.tivoli.maximo.report.birt.runtime import ReportParameterData
from psdi.server import MXServer
from com.ibm.tivoli.maximo.cos import COSApi
# ----------------------------------------
# Initialise paramters for runReport call
## report
## app
## params
## file
#-----------------------------------------
userInfo=MXServer.getMXServer().getSystemUserInfo()
try:
bytes = ReportAdmin.runReport(userInfo, report, app, params, file, ReportAdmin.OUTPUT_FORMAT_PDF)
# write the output to S3 bucket
cos=COSApi()
cos.uploadFile(BUCKET_NAME,file,'application/pdf',bytes)
except Exception as e:
# Handle error
# ----------------------------------------
# Code for creation of DOCLINKS object
#-----------------------------------------


