Projet

Général

Profil

Révision 5d5651ca

ID5d5651ca0940af39fcd422e502db915f5e4567ac
Parent 99123efb
Enfant f1afd73f

Ajouté par Pierre-Alain TORET il y a plus de 7 ans

Change variables names to more readable ones in syncthing_

Signed-off-by: Pierre-Alain TORET <>

Voir les différences:

plugins/syncthing/syncthing_
22 22
configuration
23 23
[syncthing_*]
24 24

  
25
env.ST_APIKEY myapikey0123456789
26
env.ST_HOST 127.0.0.1
27
env.ST_PORT 8384
28
env.ST_PROTO http
25
env.syncthing_apikey myapikey0123456789
26
env.syncthing_host 127.0.0.1
27
env.syncthing_port 8384
28
env.syncthing_proto http
29 29

  
30 30
=head1 AUTHOR
31 31
Pierre-Alain TORET <pierre-alain.toret@protonmail.com>
......
47 47
            exit 0;;
48 48
        *)
49 49
            printf "syncthing_cpu.value "
50
            $CURL -s -X GET -H "X-API-Key: $ST_APIKEY" $ST_PROTO://$ST_HOST:$ST_PORT/rest/system/status | $JQ '.cpuPercent'
50
            $CURL -s -X GET -H "X-API-Key: $syncthing_apikey" $syncthing_proto://$syncthing_host:$syncthing_port/rest/system/status | $JQ '.cpuPercent'
51 51
    esac
52 52
}
53 53

  
......
67 67
EOM
68 68
            exit 0;;
69 69
	*)
70
            ALL=$($CURL -s -X GET -H "X-API-Key: $ST_APIKEY" $ST_PROTO://$ST_HOST:$ST_PORT/rest/system/status | $JQ '.alloc')
71
            SYS=$($CURL -s -X GET -H "X-API-Key: $ST_APIKEY" $ST_PROTO://$ST_HOST:$ST_PORT/rest/system/status | $JQ '.sys')
70
            ALL=$($CURL -s -X GET -H "X-API-Key: $syncthing_apikey" $syncthing_proto://$syncthing_host:$syncthing_port/rest/system/status | $JQ '.alloc')
71
            SYS=$($CURL -s -X GET -H "X-API-Key: $syncthing_apikey" $syncthing_proto://$syncthing_host:$syncthing_port/rest/system/status | $JQ '.sys')
72 72
            printf "syncthing_mem_all.value $ALL\nsyncthing_mem_sys.value $SYS\n"
73 73
    esac
74 74
}
......
85 85
            exit 0;;
86 86
        *)
87 87
            printf "syncthing_uptime.value "
88
            $CURL -s -X GET -H "X-API-Key: $ST_APIKEY" $ST_PROTO://$ST_HOST:$ST_PORT/rest/system/status | $JQ '.uptime'
88
            $CURL -s -X GET -H "X-API-Key: $syncthing_apikey" $syncthing_proto://$syncthing_host:$syncthing_port/rest/system/status | $JQ '.uptime'
89 89
    esac
90 90
}
91 91

  
......
101 101
            exit 0;;
102 102
        *)
103 103
            printf "syncthing_goroutine.value "
104
            $CURL -s -X GET -H "X-API-Key: $ST_APIKEY" $ST_PROTO://$ST_HOST:$ST_PORT/rest/system/status | $JQ '.goroutines'
104
            $CURL -s -X GET -H "X-API-Key: $syncthing_apikey" $syncthing_proto://$syncthing_host:$syncthing_port/rest/system/status | $JQ '.goroutines'
105 105
    esac
106 106
}
107 107

  
......
125 125
EOM
126 126
            exit 0;;
127 127
	*)
128
            IBT=$($CURL -s -X GET -H "X-API-Key: $ST_APIKEY" $ST_PROTO://$ST_HOST:$ST_PORT/rest/system/connections | $JQ '.total | .inBytesTotal')
129
            OBT=$($CURL -s -X GET -H "X-API-Key: $ST_APIKEY" $ST_PROTO://$ST_HOST:$ST_PORT/rest/system/connections | $JQ '.total | .outBytesTotal')
128
            IBT=$($CURL -s -X GET -H "X-API-Key: $syncthing_apikey" $syncthing_proto://$syncthing_host:$syncthing_port/rest/system/connections | $JQ '.total | .inBytesTotal')
129
            OBT=$($CURL -s -X GET -H "X-API-Key: $syncthing_apikey" $syncthing_proto://$syncthing_host:$syncthing_port/rest/system/connections | $JQ '.total | .outBytesTotal')
130 130
            printf "syncthing_transfer_up.value $IBT\nsyncthing_transfer_down.value $OBT\n"
131 131
    esac
132 132
}

Formats disponibles : Unified diff