murano-apps/ZabbixAgent/package/Classes/ZabbixAgent.yaml

73 lines
2.2 KiB
YAML

# 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.
Namespaces:
=: com.example
std: io.murano
res: io.murano.resources
sys: io.murano.system
Name: ZabbixAgent
Extends: std:Application
Properties:
hostname:
Contract: $.string().notNull()
probe:
Contract: $.string().notNull()
server:
Contract: $.class(ZabbixServer).notNull()
Methods:
.init:
Body:
- $._environment: $.find(std:Environment).require()
deploy:
Body:
- $._environment.reporter.report($this, 'Zabbix Agent is ready to be configured.')
setUpAgent:
Arguments:
instance:
Contract: $.class(res:Instance).notNull()
Body:
- $.server.deploy()
- $resources: new(sys:Resources)
- $securityGroupIngress:
- ToPort: 10050
FromPort: 10050
IpProtocol: tcp
External: true
- $._environment.securityGroupManager.addGroupIngress($securityGroupIngress)
- $template: $resources.yaml('DeployZabbixAgent.template').bind(dict(
server => $.server.instance.ipAddresses[0],
hostname => $.hostname
))
- $._environment.reporter.report($this, 'Deploying Zabbix Agent')
- $instance.agent.call($template, $resources)
- $._environment.reporter.report($this, 'Zabbix Agent is installed')
- $template: $resources.yaml('ConfigureProbe.template').bind(dict(
probe => $.probe,
server => $.server.instance.ipAddresses[0],
hostname => $.hostname,
instanceIp => $instance.ipAddresses[0]
))
- $instance.agent.call($template, $resources)
- $._environment.reporter.report($this, 'Configuring monitoring')