Add monitoring flag for Digital Ocean droplets
Digital Ocean now has the functionality for more extensive monitoring of droplets, which includes the ability to set alerts for droplets. These new features only work if a monitoring script is run on the droplet upon startup, fortunately the Digital Ocean API allows for a flag to be passed through (similar to how `private networking` is switched on) that pre-installs the monitoring script allowing the more in-depth monitoring. I have simply added this flag to `docker-machine`. Signed-off-by: Steven Cooney <dev@stevenjamescooney.com>
This commit is contained in:
@@ -35,6 +35,7 @@ type Driver struct {
|
|||||||
Backups bool
|
Backups bool
|
||||||
PrivateNetworking bool
|
PrivateNetworking bool
|
||||||
UserDataFile string
|
UserDataFile string
|
||||||
|
Monitoring bool
|
||||||
Tags string
|
Tags string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,6 +116,11 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
|
|||||||
Name: "digitalocean-userdata",
|
Name: "digitalocean-userdata",
|
||||||
Usage: "path to file with cloud-init user-data",
|
Usage: "path to file with cloud-init user-data",
|
||||||
},
|
},
|
||||||
|
mcnflag.BoolFlag{
|
||||||
|
EnvVar: "DIGITALOCEAN_MONITORING",
|
||||||
|
Name: "digitalocean-monitoring",
|
||||||
|
Usage: "enable monitoring for droplet",
|
||||||
|
},
|
||||||
mcnflag.StringFlag{
|
mcnflag.StringFlag{
|
||||||
EnvVar: "DIGITALOCEAN_TAGS",
|
EnvVar: "DIGITALOCEAN_TAGS",
|
||||||
Name: "digitalocean-tags",
|
Name: "digitalocean-tags",
|
||||||
@@ -157,6 +163,7 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
|
|||||||
d.SSHPort = flags.Int("digitalocean-ssh-port")
|
d.SSHPort = flags.Int("digitalocean-ssh-port")
|
||||||
d.SSHKeyFingerprint = flags.String("digitalocean-ssh-key-fingerprint")
|
d.SSHKeyFingerprint = flags.String("digitalocean-ssh-key-fingerprint")
|
||||||
d.SSHKey = flags.String("digitalocean-ssh-key-path")
|
d.SSHKey = flags.String("digitalocean-ssh-key-path")
|
||||||
|
d.Monitoring = flags.Bool("digitalocean-monitoring")
|
||||||
d.Tags = flags.String("digitalocean-tags")
|
d.Tags = flags.String("digitalocean-tags")
|
||||||
|
|
||||||
d.SetSwarmConfigFromFlags(flags)
|
d.SetSwarmConfigFromFlags(flags)
|
||||||
@@ -232,6 +239,7 @@ func (d *Driver) Create() error {
|
|||||||
Backups: d.Backups,
|
Backups: d.Backups,
|
||||||
UserData: userdata,
|
UserData: userdata,
|
||||||
SSHKeys: []godo.DropletCreateSSHKey{{ID: d.SSHKeyID}},
|
SSHKeys: []godo.DropletCreateSSHKey{{ID: d.SSHKeyID}},
|
||||||
|
Monitoring: d.Monitoring,
|
||||||
Tags: d.getTags(),
|
Tags: d.getTags(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user