mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 11:37:01 -07:00
Add goroutine to info collect
Signed-off-by: David J. Allen <allend@lanl.gov>
This commit is contained in:
parent
2edb9fdbb0
commit
c5a6d2a2be
10 changed files with 326 additions and 100 deletions
|
|
@ -16,10 +16,11 @@ func InsertProbeResults(path string, states *[]magellan.BMCProbeResult) error {
|
|||
// create database if it doesn't already exist
|
||||
schema := `
|
||||
CREATE TABLE IF NOT EXISTS magellan_scanned_ports (
|
||||
host TEXT PRIMARY KEY NOT NULL,
|
||||
port INTEGER,
|
||||
host TEXT NOT NULL,
|
||||
port INTEGER NOT NULL,
|
||||
protocol TEXT,
|
||||
state INTEGER
|
||||
state INTEGER,
|
||||
PRIMARY KEY (host, port)
|
||||
);
|
||||
`
|
||||
db, err := sqlx.Open("sqlite3", path)
|
||||
|
|
@ -52,7 +53,7 @@ func GetProbeResults(path string) ([]magellan.BMCProbeResult, error) {
|
|||
}
|
||||
|
||||
results := []magellan.BMCProbeResult{}
|
||||
err = db.Select(&results, "SELECT * FROM magellan_scanned_ports ORDER BY host ASC")
|
||||
err = db.Select(&results, "SELECT * FROM magellan_scanned_ports ORDER BY host ASC, port ASC;")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not retrieve probes: %v", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue