diff --git a/stackstorm-morpheus/CHANGES.md b/stackstorm-morpheus/CHANGES.md new file mode 100644 index 00000000..5f5874b5 --- /dev/null +++ b/stackstorm-morpheus/CHANGES.md @@ -0,0 +1,3 @@ +Current status : Alpha +Version : 0.1.0 +-initial release diff --git a/stackstorm-morpheus/LICENSE b/stackstorm-morpheus/LICENSE new file mode 100644 index 00000000..261eeb9e --- /dev/null +++ b/stackstorm-morpheus/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/stackstorm-morpheus/README.md b/stackstorm-morpheus/README.md new file mode 100644 index 00000000..ed9f820a --- /dev/null +++ b/stackstorm-morpheus/README.md @@ -0,0 +1,67 @@ +# Morpheus Integration Pack +This pack allows you to integrate with Morpheus + +## Configuration +Copy the example configuration in [morpheus.yaml.example](./morpheus.yaml.example) to +`/opt/stackstorm/configs/morpheus.yaml` and edit as required. + +It must contain: + +``` +ipaddress - Your Morpheus Appliance IP address +username - Morpheus User name +password - Morpheus Password +dbuser - Mongo database username +dbpass - Mongo database password +``` + +You can also use dynamic values from the datastore. See the +[docs](https://docs.stackstorm.com/reference/pack_configs.html) for more info. + +Example configuration: + +```yaml +--- + ipaddress: "10.10.10.10" + username: "Administrator" + password: "password" + dbuser: "appUser" + dbpass: "passwordForAppUser" +``` +You can also run `st2 pack config morpheus` and answer the prompts + +**Note** : When modifying the configuration in `/opt/stackstorm/configs/` please + remember to tell StackStorm to load these new values by running + `st2ctl reload --register-configs` + + +## Actions + +###Action naming conventions: + +Individual actions: Action names will have an underscore after the HTTP method +* ``get_volumes`` +* ``get_logs`` +* ``get_networks`` +* ``get_alerts`` + +Orquestra Workflows: will have a dash. + +## Mongo considerations + +If your mongo instance does not have auth enabled, then you don't need to +provide a dbuser and dbpass. If it is you can set the dbuser and dbpass +in the StackStorm GUI by navigating to the packs management page. + +If the default mongoDB is used and it has authentication enabled, you will +need to create a new user and a database. + +This can be done by logging in as admin using the following example. + +mongo -u admin -p admin + +### Then create a new user +db.createUser({user: "appUser",pwd: "passwordForAppUser",roles: [ { role: "readWrite", db: "app_db" } ]}) + +### Then if necessary you can check the mongo database records by +mongo -u appUser -p passwordForAppUser admin diff --git a/stackstorm-morpheus/actions/get-mongo-logs.py b/stackstorm-morpheus/actions/get-mongo-logs.py new file mode 100644 index 00000000..1cd5ec0e --- /dev/null +++ b/stackstorm-morpheus/actions/get-mongo-logs.py @@ -0,0 +1,58 @@ + + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0. + +# Unless required by applicable law. or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# __author__ = "@netwookie" +# __credits__ = ["Rick Kauffman"] +# __license__ = "Apache2.0" +# __maintainer__ = "Rick Kauffman" +# __email__ = "rick#rickkauffman.com" + +from lib.actions import MongoBaseAction +import json + +__all__ = [ + 'GetDb' +] + + +class GetDb(MongoBaseAction): + def run(self): + + mydb = self.dbclient["app_db"] + known = mydb["morpheuslogs"] + + list_to_process = [] + log = {} + + myquery = {"u_process": 'no'} + records = list(known.find(myquery)) + + for r in records: + log['u_typeCode'] = r['u_typeCode'] + log['u_ts'] = r['u_ts'] + log['u_level'] = r['u_level'] + log['u_sourceType'] = r['u_sourceType'] + log['u_message'] = r['u_message'] + log['u_hostname'] = r['u_hostname'] + log['u_title'] = r['u_title'] + log['u_logSignature'] = r['u_logSignature'] + log['u_objectId'] = r['u_objectId'] + log['u_seq'] = r['u_seq'] + log['u_id'] = r['u_id'] + log['u_signatureVerified'] = r['u_signatureVerified'] + log = json.dumps(log) + list_to_process.append(log) + log = {} + + return (list_to_process) diff --git a/stackstorm-morpheus/actions/get-mongo-logs.yaml b/stackstorm-morpheus/actions/get-mongo-logs.yaml new file mode 100644 index 00000000..f8ac1986 --- /dev/null +++ b/stackstorm-morpheus/actions/get-mongo-logs.yaml @@ -0,0 +1,7 @@ +--- +name: get-mongo-logs +pack: morpheus +description: Get Morpheus logs from mongo db +runner_type: python-script +entry_point: get-mongo-logs.py +enabled: true diff --git a/stackstorm-morpheus/actions/get_logs.py b/stackstorm-morpheus/actions/get_logs.py new file mode 100644 index 00000000..236adefa --- /dev/null +++ b/stackstorm-morpheus/actions/get_logs.py @@ -0,0 +1,54 @@ + + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# __author__ = "@netwookie" +# __credits__ = ["Rick Kauffman"] +# __license__ = "Apache2.0" +# __maintainer__ = "Rick Kauffman" +# __email__ = "rick@rickkauffman.com" + +import urllib3 +from lib.actions import MorpheusBaseAction +from pypheus.logs import Logs +urllib3.disable_warnings() + +__all__ = [ + 'LogData' +] + + +class LogData(MorpheusBaseAction): + def run(self): + log_list = [] + logs = Logs(self.client[0], self.client[1], self.client[2]) + log_data = logs.get_all_logs() + + for i in log_data['data']: + info = [ + i['typeCode'], + i['ts'], + i['level'], + i['sourceType'], + i['message'], + i['hostname'], + i['title'], + i['logSignature'], + i['objectId'], + i['seq'], + i['_id'], + i['signatureVerified']] + + log_list.append(info) + info = [] + return log_list diff --git a/stackstorm-morpheus/actions/get_logs.yaml b/stackstorm-morpheus/actions/get_logs.yaml new file mode 100644 index 00000000..c4853367 --- /dev/null +++ b/stackstorm-morpheus/actions/get_logs.yaml @@ -0,0 +1,7 @@ +--- +name: get_logs +pack: morpheus +description: Get an array of all logs from Morpheus +runner_type: python-script +entry_point: get_logs.py +enabled: true diff --git a/stackstorm-morpheus/actions/lib/__init__.py b/stackstorm-morpheus/actions/lib/__init__.py new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/stackstorm-morpheus/actions/lib/__init__.py @@ -0,0 +1 @@ + diff --git a/stackstorm-morpheus/actions/lib/actions.py b/stackstorm-morpheus/actions/lib/actions.py new file mode 100644 index 00000000..413da624 --- /dev/null +++ b/stackstorm-morpheus/actions/lib/actions.py @@ -0,0 +1,56 @@ + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# __author__ = "@netwookie" +# __credits__ = ["Rick Kauffman"] +# __license__ = "Apache2.0" +# __maintainer__ = "Rick Kauffman." +# __email__ = "rick@riickkauffman.com" + +from pymongo import MongoClient +from st2common.runners.base_action import Action + +__all__ = [ + 'MorpheusBaseAction' +] + + +class MorpheusBaseAction(Action): + def __init__(self, config): + super(MorpheusBaseAction, self).__init__(config=config) + self.client = self._get_client() + + def _get_client(self): + host = self.config['host'] + username = self.config['username'] + password = self.config['password'] + + client = [host, username, password] + + return client + + +class MongoBaseAction(Action): + def __init__(self, config): + super(MongoBaseAction, self).__init__(config=config) + self.dbclient = self._get_db_client() + + def _get_db_client(self): + if self.config['dbuser']: + dbuser = self.config['dbuser'] + dbpass = self.config['dbpass'] + dbclient = MongoClient('mongodb://%s:%s@localhost:27017/' % + (dbuser,dbpass)) + else: + dbclient = MongoClient('mongodb://mongo:27017/') + return dbclient diff --git a/stackstorm-morpheus/actions/load-morpheus-logs.py b/stackstorm-morpheus/actions/load-morpheus-logs.py new file mode 100644 index 00000000..779880f4 --- /dev/null +++ b/stackstorm-morpheus/actions/load-morpheus-logs.py @@ -0,0 +1,60 @@ + + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0. + +# Unless required by applicable law. or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# __author__ = "@netwookie" +# __credits__ = ["Rick Kauffman"] +# __license__ = "Apache2.0" +# __maintainer__ = "Rick Kauffman" +# __email__ = "rick#rickkauffman.com" + +from lib.actions import MongoBaseAction + +__all__ = [ + 'LoadDb' +] + + +class LoadDb(MongoBaseAction): + def run(self, logs): + + mydb = self.dbclient["app_db"] + known = mydb["morpheuslogs"] + + new_log = {} + + for log in logs: + myquery = {"u_id": logs[10]} + records = known.find(myquery).count() + if records == 0: + new_log['u_typeCode'] = log[0] + new_log['u_ts'] = log[1] + new_log['u_level'] = log[2] + new_log['u_sourceType'] = log[3] + new_log['u_message'] = log[4] + new_log['u_hostname'] = log[5] + new_log['u_title'] = log[6] + new_log['u_logSignature'] = log[7] + new_log['u_objectId'] = log[8] + new_log['u_seq'] = log[9] + new_log['u_id'] = log[10] + new_log['u_signatureVerified'] = log[11] + new_log['u_process'] = 'no' + write_record = known.insert_one(new_log) + print(write_record) + new_log = {} + + else: + records = 'Fail to write mongo record, possible duplicate' + # write_record = process.insert_one(alarm) + return (records) diff --git a/stackstorm-morpheus/actions/load-morpheus-logs.yaml b/stackstorm-morpheus/actions/load-morpheus-logs.yaml new file mode 100644 index 00000000..3e3557aa --- /dev/null +++ b/stackstorm-morpheus/actions/load-morpheus-logs.yaml @@ -0,0 +1,11 @@ +--- +name: load-morpheus-logs +pack: morpheus +description: load Morpheus logs into the mongo db +runner_type: python-script +entry_point: load-morpheus-logs.py +enabled: true +parameters: + logs: + required: true + type: array diff --git a/stackstorm-morpheus/actions/mongo-logs-2-splunk.yaml b/stackstorm-morpheus/actions/mongo-logs-2-splunk.yaml new file mode 100644 index 00000000..dcd3be52 --- /dev/null +++ b/stackstorm-morpheus/actions/mongo-logs-2-splunk.yaml @@ -0,0 +1,6 @@ +--- +name: mongo-logs-2-splunk +description: A workflow for sending morpheus logs from mongo to splunk. +runner_type: orquesta +entry_point: workflows/mongo-logs-2-splunk.yaml +enabled: true diff --git a/stackstorm-morpheus/actions/morpheus-logs-2-mongo.yaml b/stackstorm-morpheus/actions/morpheus-logs-2-mongo.yaml new file mode 100644 index 00000000..a9cfc778 --- /dev/null +++ b/stackstorm-morpheus/actions/morpheus-logs-2-mongo.yaml @@ -0,0 +1,6 @@ +--- +name: morpheus-logs-2-mongo +description: A workflow for getting morpheus logs into a mongo database. +runner_type: orquesta +entry_point: workflows/morpheus-logs-2-mongo.yaml +enabled: true diff --git a/stackstorm-morpheus/actions/process_logs.py b/stackstorm-morpheus/actions/process_logs.py new file mode 100644 index 00000000..3ddf1167 --- /dev/null +++ b/stackstorm-morpheus/actions/process_logs.py @@ -0,0 +1,37 @@ + + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0. + +# Unless required by applicable law. or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# __author__ = "@netwookie" +# __credits__ = ["Rick Kauffman"] +# __license__ = "Apache2.0" +# __maintainer__ = "Rick Kauffman" +# __email__ = "rick@rickkauffman.com" + +from lib.actions import MongoBaseAction + +__all__ = [ + 'LoadDb' +] + + +class LoadDb(MongoBaseAction): + def run(self, logs): + + mydb = self.dbclient["app_db"] + col = mydb["morpheus-logs"] + + for log in logs: + col.updateOne({"_id": log['_id']}, {"$set": {"u_process": "yes"}}) + + return () diff --git a/stackstorm-morpheus/actions/process_logs.yaml b/stackstorm-morpheus/actions/process_logs.yaml new file mode 100644 index 00000000..f4589c35 --- /dev/null +++ b/stackstorm-morpheus/actions/process_logs.yaml @@ -0,0 +1,11 @@ +--- +name: process_logs +pack: morpheus +description: Set the process flag in the mongo database for logs to yes +runner_type: python-script +entry_point: process_logs.py +enabled: true +parameters: + logs: + required: true + type: array diff --git a/stackstorm-morpheus/actions/workflows/mongo-logs-2-splunk.yaml b/stackstorm-morpheus/actions/workflows/mongo-logs-2-splunk.yaml new file mode 100644 index 00000000..5deda8e8 --- /dev/null +++ b/stackstorm-morpheus/actions/workflows/mongo-logs-2-splunk.yaml @@ -0,0 +1,23 @@ +version: 1.0 + +description: A workflow to copy Morpheus logs from mongo and into splunk.. + +tasks: + gettoken: + action: splunk.get_hec_token instance="prod" + next: + - when: <% succeeded() %> + publish: + - token: <% result().result %> + do: getlogs + getlogs: + action: morpheus.get-mongo-logs + next: + - when: <% succeeded() %> + publish: + - logs: <% result().result %> + do: sendsplunk + + sendsplunk: + with: <% ctx().logs %> + action: splunk.send_log instance="prod" index="main" token=<% ctx().token %> event='<% item() %>' diff --git a/stackstorm-morpheus/actions/workflows/morpheus-logs-2-mongo.yaml b/stackstorm-morpheus/actions/workflows/morpheus-logs-2-mongo.yaml new file mode 100644 index 00000000..4d1e223b --- /dev/null +++ b/stackstorm-morpheus/actions/workflows/morpheus-logs-2-mongo.yaml @@ -0,0 +1,15 @@ +version: 1.0 + +description: A workflow to copy hpe nimble alarms into a mongo database. + +tasks: + getalarms: + action: morpheus.get_logs + next: + - when: <% succeeded() %> + publish: + - logs: <% result().result %> + do: sendmongo + + sendmongo: + action: morpheus.load-morpheus-logs logs=<% ctx().logs %> diff --git a/stackstorm-morpheus/config.schema.yaml b/stackstorm-morpheus/config.schema.yaml new file mode 100644 index 00000000..0632bbb9 --- /dev/null +++ b/stackstorm-morpheus/config.schema.yaml @@ -0,0 +1,25 @@ +--- +host: + description: "IP address of the Morpheus (e.g.: 'fqdn.to.device' or '10.10.10.10')" + type: "string" + secret: false + required: true +username: + description: "Username for Morpheus" + type: "string" + required: true +password: + description: "Password for Morpheus" + type: "string" + secret: true + required: true +dbuser: + description: "Username for user database" + type: "string" + secret: false + required: false +dbpass: + description: "Password for user database" + type: "string" + secret: true + required: false diff --git a/stackstorm-morpheus/icon.png b/stackstorm-morpheus/icon.png new file mode 100644 index 00000000..fd390ef4 Binary files /dev/null and b/stackstorm-morpheus/icon.png differ diff --git a/stackstorm-morpheus/morpheus.yaml.example b/stackstorm-morpheus/morpheus.yaml.example new file mode 100644 index 00000000..dfc7b2aa --- /dev/null +++ b/stackstorm-morpheus/morpheus.yaml.example @@ -0,0 +1,4 @@ +--- +host: "172.18.1.66" +username: "Administrator" +password: "Ch@ng3Me!" diff --git a/stackstorm-morpheus/pack.yaml b/stackstorm-morpheus/pack.yaml new file mode 100644 index 00000000..1f0df683 --- /dev/null +++ b/stackstorm-morpheus/pack.yaml @@ -0,0 +1,12 @@ +--- +ref: morpheus +name: morpheus +description: Morpheus Integration Pack +keywords: + - Morpheus + - Automation +version: 0.1.0 +python_versions: + - "3" +author: Rick Kauffman +email: rick@rickkauffman.com diff --git a/stackstorm-morpheus/requirements.txt b/stackstorm-morpheus/requirements.txt new file mode 100644 index 00000000..8af23078 --- /dev/null +++ b/stackstorm-morpheus/requirements.txt @@ -0,0 +1,3 @@ +urllib3 +requests +pypheus diff --git a/stackstorm-morpheus/rules/mongo-logs-2-splunk.yaml b/stackstorm-morpheus/rules/mongo-logs-2-splunk.yaml new file mode 100644 index 00000000..ea0de38f --- /dev/null +++ b/stackstorm-morpheus/rules/mongo-logs-2-splunk.yaml @@ -0,0 +1,13 @@ +--- +name: "mongo-logs-2-splunk" +description: "Get mongo logs and send to splunk." +enabled: false + +trigger: + type: "core.st2.IntervalTimer" + parameters: + delta: 5 + unit: minutes + +action: + ref: "morpheus.mongo-logs-2-splunk" diff --git a/stackstorm-morpheus/rules/morpheus-logs-2-mongo.yaml b/stackstorm-morpheus/rules/morpheus-logs-2-mongo.yaml new file mode 100644 index 00000000..4567df36 --- /dev/null +++ b/stackstorm-morpheus/rules/morpheus-logs-2-mongo.yaml @@ -0,0 +1,13 @@ +--- +name: "morpheus-logs-2-mongo" +description: "Get morpheus logs and send to mongo." +enabled: false + +trigger: + type: "core.st2.IntervalTimer" + parameters: + delta: 5 + unit: minutes + +action: + ref: "morpheus.morpheus-logs-2-mongo"