Skip to content

Commit

Permalink
gokrconfig: added rsync so grafana displays info
Browse files Browse the repository at this point in the history
This is useful and is easier since now I can see the written data in Grafana
  • Loading branch information
BrunoTeixeira1996 committed Sep 15, 2023
1 parent 75b9757 commit c59c851
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
2 changes: 2 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ instance = "brun0:monitoring"

[[targets]]
name = "gokr_config"
host = "192.168.30.99"
keypath = "/root/.ssh/id_ed25519_gkconfig"
instance = "brun0:gokr_config"
20 changes: 14 additions & 6 deletions targets/gokrconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ import (
"github.com/BrunoTeixeira1996/gbackup/internal"
)

/*
Here I only copy from external hard drive to HDD because my laptop
is running the rsync command to copy the gokrazy folder to the proxmox
instance
I rather run a cronjob in my laptop than open a ssh connection
*/
// Function that backups gokrazy config
// to external hard drive
func backupGokrConfToExternal(cfg internal.Config) error {
rCmd := []string{"-av", "-e", "ssh","gkconfig:/root/gokrazy/brun0-pi", "/mnt/pve/external/gokrazy_backup/"}
if err := internal.ExecCmdToProm("rsync", rCmd, "rsync", cfg.Targets[5].Instance, cfg.Pushgateway.Host); err != nil {
return err
}

return nil
}

// Function that copies the backed up gokrazy file
// that holds all useful information about brun0-pi instance
Expand All @@ -26,6 +30,10 @@ func backupGokrConfToHDD(cfg internal.Config) error {

// Function that handles both backups
func ExecuteGokrConfBackup(cfg internal.Config) error {
if err := backupGokrConfToExternal(cfg); err != nil {
return err
}

if err := backupGokrConfToHDD(cfg); err != nil {
return err
}
Expand Down

0 comments on commit c59c851

Please sign in to comment.