Skip to content

Commit

Permalink
Adding auth and active
Browse files Browse the repository at this point in the history
Signed-off-by: Luis Felipe Domínguez Vega <[email protected]>
  • Loading branch information
lfdominguez committed Jun 27, 2019
1 parent fc2fa8c commit 28e379c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ fn main() {
"username",
"common_name",
"real_ip",
"vpn_ip"
"vpn_ip",
"active",
"auth"
];

// Create metric
Expand All @@ -102,7 +104,7 @@ fn main() {
access_counter.inc();

let mut statement = connection
.prepare("SELECT session_id, node, username, common_name, real_ip, vpn_ip, duration, bytes_in, bytes_out FROM log WHERE active = 1")
.prepare("SELECT session_id, node, username, common_name, real_ip, vpn_ip, duration, bytes_in, bytes_out, active, auth FROM log WHERE active = 1")
.unwrap();

while let State::Row = statement.next().unwrap() {
Expand All @@ -112,7 +114,9 @@ fn main() {
&statement.read::<String>(2).unwrap()[..],
&statement.read::<String>(3).unwrap()[..],
&statement.read::<String>(4).unwrap()[..],
&statement.read::<String>(5).unwrap()[..]
&statement.read::<String>(5).unwrap()[..],
&statement.read::<String>(6).unwrap()[..],
&statement.read::<String>(7).unwrap()[..]
];

duration.with_label_values(&label_values).set(statement.read::<f64>(5).unwrap());
Expand All @@ -124,4 +128,4 @@ fn main() {
// receive a response.
finished_sender.send(FinishedUpdate).unwrap();
}
}
}

0 comments on commit 28e379c

Please sign in to comment.