Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fortigate_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (
"github.com/prometheus/client_golang/prometheus/promhttp"

"github.com/prometheus-community/fortigate_exporter/internal/config"
fortiHTTP "github.com/prometheus-community/fortigate_exporter/pkg/http"
fortiHTTP "github.com/prometheus-community/fortigate_exporter/pkg/fortigatehttpclient"
"github.com/prometheus-community/fortigate_exporter/pkg/probe"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

package http
package fortigatehttpclient

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

package http
package fortigatehttpclient

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/http/main.go → pkg/fortigatehttpclient/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package http
package fortigatehttpclient

import (
"context"
Expand Down
6 changes: 3 additions & 3 deletions pkg/probe/bgp_neighbor_routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/prometheus/client_golang/prometheus"

"github.com/prometheus-community/fortigate_exporter/internal/config"
"github.com/prometheus-community/fortigate_exporter/pkg/http"
"github.com/prometheus-community/fortigate_exporter/pkg/fortigatehttpclient"
)

type BGPPath struct {
Expand All @@ -39,7 +39,7 @@ type PathCount struct {
VDOM string
}

func probeBGPNeighborPathsIPv4(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.Metric, bool) {
func probeBGPNeighborPathsIPv4(c fortigatehttpclient.FortiHTTP, meta *TargetMetadata) ([]prometheus.Metric, bool) {
savedConfig := config.GetConfig()
MaxBGPPaths := savedConfig.MaxBGPPaths

Expand Down Expand Up @@ -107,7 +107,7 @@ func probeBGPNeighborPathsIPv4(c http.FortiHTTP, meta *TargetMetadata) ([]promet
return m, true
}

func probeBGPNeighborPathsIPv6(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.Metric, bool) {
func probeBGPNeighborPathsIPv6(c fortigatehttpclient.FortiHTTP, meta *TargetMetadata) ([]prometheus.Metric, bool) {
savedConfig := config.GetConfig()
MaxBGPPaths := savedConfig.MaxBGPPaths

Expand Down
10 changes: 5 additions & 5 deletions pkg/probe/bgp_neighbors.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/prometheus/client_golang/prometheus"

"github.com/prometheus-community/fortigate_exporter/pkg/http"
"github.com/prometheus-community/fortigate_exporter/pkg/fortigatehttpclient"
)

type BGPNeighbor7_4 struct {
Expand All @@ -36,7 +36,7 @@ type BGPNeighborResponse7_4 struct {
Version string `json:"version"`
}

func probeBGPNeighborsIPv47_4(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.Metric, bool) {
func probeBGPNeighborsIPv47_4(c fortigatehttpclient.FortiHTTP, meta *TargetMetadata) ([]prometheus.Metric, bool) {
if meta.VersionMajor < 7 {
// not supported version. Before 7.0.0 the requested endpoint doesn't exist
return nil, true
Expand Down Expand Up @@ -65,7 +65,7 @@ func probeBGPNeighborsIPv47_4(c http.FortiHTTP, meta *TargetMetadata) ([]prometh
return m, true
}

func probeBGPNeighborsIPv67_4(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.Metric, bool) {
func probeBGPNeighborsIPv67_4(c fortigatehttpclient.FortiHTTP, meta *TargetMetadata) ([]prometheus.Metric, bool) {
if meta.VersionMajor < 7 {
// not supported version. Before 7.0.0 the requested endpoint doesn't exist
return nil, true
Expand Down Expand Up @@ -128,7 +128,7 @@ type BGPNeighborResponse struct {
Version string `json:"version"`
}

func probeBGPNeighborsIPv4(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.Metric, bool) {
func probeBGPNeighborsIPv4(c fortigatehttpclient.FortiHTTP, meta *TargetMetadata) ([]prometheus.Metric, bool) {
if meta.VersionMajor == 7 && meta.VersionMinor < 6 {
return probeBGPNeighborsIPv47_4(c, meta)
}
Expand Down Expand Up @@ -179,7 +179,7 @@ func probeBGPNeighborsIPv4(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus
return m, true
}

func probeBGPNeighborsIPv6(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.Metric, bool) {
func probeBGPNeighborsIPv6(c fortigatehttpclient.FortiHTTP, meta *TargetMetadata) ([]prometheus.Metric, bool) {
if meta.VersionMajor == 7 && meta.VersionMinor < 6 {
return probeBGPNeighborsIPv67_4(c, meta)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/probe/firewall_ippool.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

"github.com/prometheus/client_golang/prometheus"

"github.com/prometheus-community/fortigate_exporter/pkg/http"
"github.com/prometheus-community/fortigate_exporter/pkg/fortigatehttpclient"
)

type IPPool struct {
Expand All @@ -38,7 +38,7 @@ type IPPoolResponse struct {
Version string `json:"version"`
}

func probeFirewallIPPool(c http.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
func probeFirewallIPPool(c fortigatehttpclient.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
mAvailable := prometheus.NewDesc(
"fortigate_ippool_available_ratio",
"Percentage available in ippool (0 - 1.0)",
Expand Down
4 changes: 2 additions & 2 deletions pkg/probe/firewall_load_balance.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import (

"github.com/prometheus/client_golang/prometheus"

"github.com/prometheus-community/fortigate_exporter/pkg/http"
"github.com/prometheus-community/fortigate_exporter/pkg/fortigatehttpclient"
)

func probeFirewallLoadBalance(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.Metric, bool) {
func probeFirewallLoadBalance(c fortigatehttpclient.FortiHTTP, meta *TargetMetadata) ([]prometheus.Metric, bool) {
if meta.VersionMajor < 6 || (meta.VersionMajor == 6 && meta.VersionMinor < 4) {
// not supported version. Before 6.4.0 there is no real_server_id and therefore this will fail
return nil, true
Expand Down
4 changes: 2 additions & 2 deletions pkg/probe/firewall_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import (
"github.com/prometheus/client_golang/prometheus"

"github.com/prometheus-community/fortigate_exporter/internal/version"
"github.com/prometheus-community/fortigate_exporter/pkg/http"
"github.com/prometheus-community/fortigate_exporter/pkg/fortigatehttpclient"
)

func probeFirewallPolicies(c http.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
func probeFirewallPolicies(c fortigatehttpclient.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
var (
mHitCount = prometheus.NewDesc(
"fortigate_policy_hit_count_total",
Expand Down
4 changes: 2 additions & 2 deletions pkg/probe/license_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (

"github.com/prometheus/client_golang/prometheus"

"github.com/prometheus-community/fortigate_exporter/pkg/http"
"github.com/prometheus-community/fortigate_exporter/pkg/fortigatehttpclient"
)

func probeLicenseStatus(c http.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
func probeLicenseStatus(c fortigatehttpclient.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
var (
vdomUsed = prometheus.NewDesc(
"fortigate_license_vdom_usage",
Expand Down
4 changes: 2 additions & 2 deletions pkg/probe/log_current_disk_usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

"github.com/prometheus/client_golang/prometheus"

"github.com/prometheus-community/fortigate_exporter/pkg/http"
"github.com/prometheus-community/fortigate_exporter/pkg/fortigatehttpclient"
)

type LogResults struct {
Expand All @@ -31,7 +31,7 @@ type Log struct {
VDOM string `json:"vdom"`
}

func probeLogCurrentDiskUsage(c http.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
func probeLogCurrentDiskUsage(c fortigatehttpclient.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
var (
logUsed = prometheus.NewDesc(
"fortigate_log_disk_used_bytes",
Expand Down
4 changes: 2 additions & 2 deletions pkg/probe/log_fortianalyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

"github.com/prometheus/client_golang/prometheus"

"github.com/prometheus-community/fortigate_exporter/pkg/http"
"github.com/prometheus-community/fortigate_exporter/pkg/fortigatehttpclient"
)

type LogAnaResults struct {
Expand All @@ -32,7 +32,7 @@ type LogAna struct {
VDOM string `json:"vdom"`
}

func probeLogAnalyzer(c http.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
func probeLogAnalyzer(c fortigatehttpclient.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
var (
logAnaInfo = prometheus.NewDesc(
"fortigate_log_fortianalyzer_registration_info",
Expand Down
4 changes: 2 additions & 2 deletions pkg/probe/log_fortianalyzer_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

"github.com/prometheus/client_golang/prometheus"

"github.com/prometheus-community/fortigate_exporter/pkg/http"
"github.com/prometheus-community/fortigate_exporter/pkg/fortigatehttpclient"
)

type LogAnaQueueResults struct {
Expand All @@ -32,7 +32,7 @@ type LogAnaQueue struct {
VDOM string `json:"vdom"`
}

func probeLogAnalyzerQueue(c http.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
func probeLogAnalyzerQueue(c fortigatehttpclient.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
var (
logAnaConn = prometheus.NewDesc(
"fortigate_log_fortianalyzer_queue_connections",
Expand Down
4 changes: 2 additions & 2 deletions pkg/probe/managed_switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (

"github.com/prometheus/client_golang/prometheus"

"github.com/prometheus-community/fortigate_exporter/pkg/http"
"github.com/prometheus-community/fortigate_exporter/pkg/fortigatehttpclient"
)

func probeManagedSwitch(c http.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
func probeManagedSwitch(c fortigatehttpclient.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
var (
managedSwitchInfo = prometheus.NewDesc(
"fortigate_managed_switch_info",
Expand Down
4 changes: 2 additions & 2 deletions pkg/probe/network_dns_latency.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (

"github.com/prometheus/client_golang/prometheus"

"github.com/prometheus-community/fortigate_exporter/pkg/http"
"github.com/prometheus-community/fortigate_exporter/pkg/fortigatehttpclient"
)

func probeNetworkDNSLatency(c http.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
func probeNetworkDNSLatency(c fortigatehttpclient.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
dnsLatency := prometheus.NewDesc(
"fortigate_network_dns_latency_seconds",
"Network dns latency",
Expand Down
4 changes: 2 additions & 2 deletions pkg/probe/ospf_neighbors.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/prometheus/client_golang/prometheus"

"github.com/prometheus-community/fortigate_exporter/pkg/http"
"github.com/prometheus-community/fortigate_exporter/pkg/fortigatehttpclient"
)

type OSPFNeighbor struct {
Expand All @@ -35,7 +35,7 @@ type OSPFNeighborResponse struct {
Version string `json:"version"`
}

func probeOSPFNeighbors(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.Metric, bool) {
func probeOSPFNeighbors(c fortigatehttpclient.FortiHTTP, meta *TargetMetadata) ([]prometheus.Metric, bool) {
if meta.VersionMajor < 7 {
// not supported version. Before 7.0.0 the requested endpoint doesn't exist
return nil, true
Expand Down
2 changes: 1 addition & 1 deletion pkg/probe/probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (

"github.com/prometheus-community/fortigate_exporter/internal/config"
"github.com/prometheus-community/fortigate_exporter/internal/version"
fortiHTTP "github.com/prometheus-community/fortigate_exporter/pkg/http"
fortiHTTP "github.com/prometheus-community/fortigate_exporter/pkg/fortigatehttpclient"
)

type Collector struct {
Expand Down
6 changes: 3 additions & 3 deletions pkg/probe/probe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
"github.com/google/go-jsonnet"
"github.com/prometheus/client_golang/prometheus"

"github.com/prometheus-community/fortigate_exporter/pkg/http"
"github.com/prometheus-community/fortigate_exporter/pkg/fortigatehttpclient"
)

type preparedResp struct {
Expand Down Expand Up @@ -105,15 +105,15 @@ func (p *testCollector) Collect(c chan<- prometheus.Metric) {
func (p *testCollector) Describe(_ chan<- *prometheus.Desc) {
}

func testProbe(pf probeFunc, c http.FortiHTTP, r Registry) bool {
func testProbe(pf probeFunc, c fortigatehttpclient.FortiHTTP, r Registry) bool {
meta := &TargetMetadata{
VersionMajor: 7,
VersionMinor: 4,
}
return testProbeWithMetadata(pf, c, meta, r)
}

func testProbeWithMetadata(pf probeFunc, c http.FortiHTTP, meta *TargetMetadata, r Registry) bool {
func testProbeWithMetadata(pf probeFunc, c fortigatehttpclient.FortiHTTP, meta *TargetMetadata, r Registry) bool {
m, ok := pf(c, meta)
if !ok {
return false
Expand Down
4 changes: 2 additions & 2 deletions pkg/probe/system_available_certificates.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (

"github.com/prometheus/client_golang/prometheus"

"github.com/prometheus-community/fortigate_exporter/pkg/http"
"github.com/prometheus-community/fortigate_exporter/pkg/fortigatehttpclient"
)

func probeSystemAvailableCertificates(c http.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
func probeSystemAvailableCertificates(c fortigatehttpclient.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
var (
certificateInfo = prometheus.NewDesc(
"fortigate_certificate_info",
Expand Down
4 changes: 2 additions & 2 deletions pkg/probe/system_central_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (

"github.com/prometheus/client_golang/prometheus"

"github.com/prometheus-community/fortigate_exporter/pkg/http"
"github.com/prometheus-community/fortigate_exporter/pkg/fortigatehttpclient"
)

func probeSystemCentralManagementStatus(c http.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
func probeSystemCentralManagementStatus(c fortigatehttpclient.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
var (
mode = prometheus.NewDesc(
"fortigate_system_central_management_mode",
Expand Down
4 changes: 2 additions & 2 deletions pkg/probe/system_fortimanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

"github.com/prometheus/client_golang/prometheus"

"github.com/prometheus-community/fortigate_exporter/pkg/http"
"github.com/prometheus-community/fortigate_exporter/pkg/fortigatehttpclient"
)

type SystemFortimanagerResults struct {
Expand All @@ -32,7 +32,7 @@ type SystemFortimanagerStatus struct {
VDOM string `json:"vdom"`
}

func probeSystemFortimanagerStatus(c http.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
func probeSystemFortimanagerStatus(c fortigatehttpclient.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
var (
FortimanStatID = prometheus.NewDesc(
"fortigate_fortimanager_connection_status",
Expand Down
4 changes: 2 additions & 2 deletions pkg/probe/system_global_location.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (

"github.com/prometheus/client_golang/prometheus"

"github.com/prometheus-community/fortigate_exporter/pkg/http"
"github.com/prometheus-community/fortigate_exporter/pkg/fortigatehttpclient"
)

func probeSystemGlobalLocation(c http.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
func probeSystemGlobalLocation(c fortigatehttpclient.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
location := prometheus.NewDesc(
"fortigate_location_info",
"System geographic location (static metadata)",
Expand Down
4 changes: 2 additions & 2 deletions pkg/probe/system_ha_checksum.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

"github.com/prometheus/client_golang/prometheus"

"github.com/prometheus-community/fortigate_exporter/pkg/http"
"github.com/prometheus-community/fortigate_exporter/pkg/fortigatehttpclient"
)

type HAChecksumResults struct {
Expand All @@ -31,7 +31,7 @@ type HAChecksum struct {
Results []HAChecksumResults `json:"results"`
}

func probeSystemHAChecksum(c http.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
func probeSystemHAChecksum(c fortigatehttpclient.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
IsMaster := prometheus.NewDesc(
"fortigate_ha_member_has_role",
"Master/Slave information",
Expand Down
4 changes: 2 additions & 2 deletions pkg/probe/system_ha_peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (

"github.com/prometheus/client_golang/prometheus"

"github.com/prometheus-community/fortigate_exporter/pkg/http"
"github.com/prometheus-community/fortigate_exporter/pkg/fortigatehttpclient"
)

func probeSystemHaPeer(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.Metric, bool) {
func probeSystemHaPeer(c fortigatehttpclient.FortiHTTP, meta *TargetMetadata) ([]prometheus.Metric, bool) {
info := prometheus.NewDesc(
"fortigate_ha_peer_info",
"Information about the ha peer.",
Expand Down
4 changes: 2 additions & 2 deletions pkg/probe/system_ha_statistics.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (

"github.com/prometheus/client_golang/prometheus"

"github.com/prometheus-community/fortigate_exporter/pkg/http"
"github.com/prometheus-community/fortigate_exporter/pkg/fortigatehttpclient"
)

func probeSystemHAStatistics(c http.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
func probeSystemHAStatistics(c fortigatehttpclient.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
var (
memberInfo = prometheus.NewDesc(
"fortigate_ha_member_info",
Expand Down
Loading