Skip to content

Commit

Permalink
Adjust readme
Browse files Browse the repository at this point in the history
  • Loading branch information
zadjadr committed Jul 14, 2024
1 parent a25e0da commit 5852138
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
40 changes: 21 additions & 19 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,9 @@ Prometheus CVE Exporter is a Golang application that scans your system for all i

## Building

You can use the provided packages from the releases of this project.

If you wish to build it yourself, here is how to do it:

### Prerequisites

- Go 1.22 or higher
- Prometheus server

### Steps

Expand All @@ -41,42 +36,49 @@ If you wish to build it yourself, here is how to do it:
2. **Build the application**:

```sh
go build -o prometheus-cve-exporter .
go build -o ./bin/ ./...
```

3. **Run the application**:

```sh
./prometheus-cve-exporter
./bin/prometheus-cve-exporter -help
```

Alternatively, you can download the precompiled package from the releases section on GitHub.

## Usage

The Prometheus CVE Exporter will start a web server on port 8080 by default and expose the metrics at the `/metrics` endpoint.
The Prometheus CVE Exporter will start a web server on port `10250` by default and expose the metrics at the `/metrics` endpoint.

To customize the settings, use the following flags:

To customize the port or other settings, use the following flags:
- `-config string`: Path to config file
- `-nvd-feed-url string`: URL for the NVD feed (default: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-recent.json.gz")
- `-port int`: Port to run the server on (default: 8080)
- `-severity string`: Comma-separated list of minimum severity level for vulnerabilities (default: "CRITICAL")
- `-update-interval duration`: Update interval duration (default: 24h0m0s)
- `--help`: Show help message
```
-config string
path to config file
-nvd-feed-url string
URL for the NVD feed (default "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-recent.json.gz")
-port int
Port to run the server on (default 10250)
-severity string
Comma separated list of severity levels for vulnerabilities (default "CRITICAL")
-update-interval duration
Update interval duration (default 24h0m0s)
```
Example:
```sh
./prometheus-cve-exporter -port 9090 -severity "HIGH,CRITICAL" -update-interval 12h
./bin/prometheus-cve-exporter -port 9090 -severity "HIGH,CRITICAL" -update-interval 12h
```

Example with config file:

```json
{
"nvd_feed_url": "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-recent.json.gz",
"update_interval": "24h",
"port": 10250,
"update_interval": "12h",
"port": 9090,
"severity": [
"HIGH",
"CRITICAL"
Expand All @@ -85,5 +87,5 @@ Example with config file:
```

```sh
./prometheus-cve-exporter -config config.json
./bin/prometheus-cve-exporter -config config.json
```
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func Load() (*Config, error) {
flag.IntVar(&cfg.Port, "port", defaultPort, "Port to run the server on")

var severity string
flag.StringVar(&severity, "severity", defaultSeverity, "Comma separated list of minimum severity level for vulnerabilities")
flag.StringVar(&severity, "severity", defaultSeverity, "Comma separated list of severity levels for vulnerabilities")

flag.Parse()

Expand Down Expand Up @@ -133,6 +133,6 @@ func prettyPrintCfg(cfg *Config) {
fmt.Println("Current configuration:")
fmt.Printf(" NVD Feed URL: %s\n", cfg.NVDFeedURL)
fmt.Printf(" Update Interval: %s\n", cfg.UpdateInterval.String())
fmt.Printf(" Minimum Severity: %v\n", cfg.Severity)
fmt.Printf(" Severity Levels: %v\n", cfg.Severity)
fmt.Printf(" Port: %d\n", cfg.Port)
}

0 comments on commit 5852138

Please sign in to comment.