Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using graph template 'Cacti Stats - User Logins', an incorrect count of invalid users can be seen #3287

Closed
netniV opened this issue Feb 23, 2020 · 5 comments
Assignees
Labels
bug Undesired behaviour resolved A fixed issue templates Issues related to templating
Milestone

Comments

@netniV
Copy link
Member

netniV commented Feb 23, 2020

Describe the bug
The graph constantly reports all invalid logins before the polling time. In my case, the invalid login occurred a year ago, not within the polling interval.

To Reproduce
Steps to reproduce the behavior:

  1. Attempt to login incorrectly
  2. Wait an hour or two
  3. Visit the Cacti Stats - User Login graph
  4. See invalid logins stays at the same level

Expected behavior
The invalid login attempts should be graphed as per the valid ones.

@netniV netniV added bug Undesired behaviour templates Issues related to templating labels Feb 23, 2020
@netniV netniV added this to the 1.2.10 milestone Feb 23, 2020
@netniV
Copy link
Member Author

netniV commented Feb 23, 2020

I patched my version by changing the invalid query to match the valid one in cacti_user_stats.php:

$user_logins_invalid = db_fetch_cell("SELECT COUNT(*) AS user_logins
        FROM user_log
        WHERE UNIX_TIMESTAMP(`time`) BETWEEN UNIX_TIMESTAMP() - $active_interval AND UNIX_TIMSTAMP()
        AND user_id = 0
        AND `result` IN (0, 3)");

Need to find out how we package those so we can get this fix pushed with the next update.

@netniV netniV changed the title Cacti Stats - User Logins Cacti Stats - User Logins - Incorrect count of invalid users Feb 23, 2020
@netniV
Copy link
Member Author

netniV commented Feb 23, 2020

This can be manually tested by running cacti_user_stats.php before and after running the following query:

insert into user_log values ('admin',1,'2019-01-01 01:01:01',0,'1.2.3.4');

Before:

$ sudo -u www-data php -q cacti_user_stats.php
valid:0 invalid:1 active:U sleeping:U garbage:U uactive:U usleeping:U

After:

mysql> insert into user_log values ('admin',1,'2019-01-01 01:01:01',0,'1.2.3.4');
Query OK, 1 row affected (0.00 sec)

mysql> quit
$ sudo -u www-data php -q cacti_user_stats.php
valid:0 invalid:2 active:U sleeping:U garbage:U uactive:U usleeping:U

That last invalid:2 should be :0 as both failed login records are for a year ago.

@cigamit
Copy link
Member

cigamit commented Feb 23, 2020

Going to patch this, in github, but we need to also repackage the stats package too.

cigamit added a commit that referenced this issue Feb 23, 2020
This will require a package update too.
@cigamit
Copy link
Member

cigamit commented Feb 23, 2020

Step 1 of 2 done.

cigamit added a commit that referenced this issue Feb 23, 2020
* Cacti Stats - User Logins - Incorrect count of invalid users
@cigamit
Copy link
Member

cigamit commented Feb 23, 2020

Package updated.

@cigamit cigamit added the resolved A fixed issue label Feb 23, 2020
@cigamit cigamit closed this as completed Feb 23, 2020
@netniV netniV changed the title Cacti Stats - User Logins - Incorrect count of invalid users When using graph template 'Cacti Stats - User Logins', an incorrect count of invalid users can be seen Mar 1, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jun 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour resolved A fixed issue templates Issues related to templating
Projects
None yet
Development

No branches or pull requests

3 participants