Commit Graph

73 Commits

Author SHA1 Message Date
48bf9c008b calcglobalstats/deletestats: Improve duration logging and output
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-12-10 20:25:00 +01:00
80f20f4d0c routertools/deletestats: Split and improve netif stats deletion
This patch reorganizes the deletion of old stats:
- Commits are done after each step
- Netif stats deletion is split into UPDATE and DELETE
- Delays are added, to reduce locking

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-12-10 20:04:10 +01:00
f52af65c1c routertools/config: Add minimum time difference for router stats
This prevents errors due to the same router being sent twice in
the same second.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-12-10 19:52:02 +01:00
9e6e3c8dbf routertools/alfred: Minimize time without router_netif data
Rearrange queries to have a minimum time where netifs for router
are not present.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-12-10 19:51:49 +01:00
a994ec114a MySQL stats: Convert from datetime to int
DB scripts still need to be updated.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-12-10 19:49:46 +01:00
a1024baea0 routertools/alfred: Recognize MySQL lock as specific exception
This will not change the router status to unknown

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-12-10 19:44:33 +01:00
d0d173d935 Introduce debugging function
This adds a timestamp to all debug outputs

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-11-23 22:02:27 +01:00
846f66281e routertools: Don't delete old stats of offline routers
With this patch, router stats are only deleted if the router
is online or missing in the router table.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-11-23 22:01:44 +01:00
42c78f1079 routertools: Remove commented old code
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-11-23 22:01:29 +01:00
8f04e13c24 routertools/router.html: Display warning for lost coordinates
Warning: This requires a change of the MySQL table 'router'

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-11-23 21:59:30 +01:00
ebb4589301 routertools: Remember settings after router reset
This restores the behavior before the MySQL conversion: If a
router is reset, the new (empty) values are not written to
the variables, instead the old ones are kept.

In contrast to the old setting, however, we still do reset the
hood.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-11-23 21:56:35 +01:00
7f81bff24b routertools: Don't use old coordinates for hood assignment
If no lat/lng or hood is sent, the device should go to Default.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-11-23 21:56:18 +01:00
07208b6f5c routertools: Reorganize parsed data from router XML
Since we do not use MongoDB anymore, the structure of the parsed
data in router_update can be simplified to a less nested scheme.

In addition to that, directory keys have been adjusted to those
in MySQL. This prevents typos and errors.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-11-23 21:48:48 +01:00
e20d37edf9 routertools: Write exceptions for parsing routers to file
Since exceptions during parsing a router's alfred data are
caught, you do not learn about the reasons.

Thus, this writes some information to a file.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-11-20 11:48:55 +01:00
8ff508f211 routertools: Remove leftover from debugging
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-11-20 11:48:49 +01:00
5e75f9cad0 config: Move config to a single, separate file
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-11-19 15:30:39 +01:00
595810150c routertools: Reduce offline delay to 15 minutes
This is possible due to the optimized alfred proxy cron
triggers.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-11-19 15:26:35 +01:00
3fd731a5a2 Introduced orphaned state between offline and deletion
After 7 days of being offline, a router enters the orphaned
state with a grey icon. It is only deleted after a longer period
of 180 days.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-11-16 20:41:38 +01:00
39bf2032f4 routertools: Aggregate INSERT commands using executemany
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-11-16 20:37:26 +01:00
ece82c44f4 routertools: Remove direct references to mysql cursor
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-11-16 14:50:16 +01:00
003fcbcebe routertools/stattools: Implement default hood as str "Default"
If the default is NULL (as previously), we have ugly problems
with indexing and queries. To circumvent this, the hood is
set to "Default" right at the beginning.

For old data, we add an if to the hood stats calculation.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-11-16 00:05:48 +01:00
48cb9f0033 routertools: Remove lower() for hood name
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-11-16 00:04:47 +01:00
92cd0e00a8 routertools: Treat missing XML elements better
This particularly fixes the case of missing coordinates.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-11-16 00:02:03 +01:00
9a32c7bffd Delete old router events
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-11-16 00:01:26 +01:00
e3fe995407 MySQL: alpha3
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-11-16 00:00:07 +01:00
Dominik Heidler
058bed9a2e Implement loadavg graph data collection for #55 2017-09-11 16:31:57 +02:00
Dominik Heidler
f8c5913ad1 Commit unstaged changes from production instance 2017-08-21 11:49:26 +02:00
Adrian Schmutzler
0ac862411a Set WAN uplink based on new nodewatcher xml entry and for L2TP
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-06-17 21:48:08 +02:00
Steffen Pankratz
3318794d0f Added support for layer 3 links (fixes #38)
Signed-off-by: Steffen Pankratz <kratz00@gmx.de>
2017-04-17 13:31:31 +02:00
Steffen Pankratz
ff4b8ebd8f - deleted functionality to fetch data from Netmon
Signed-off-by: Steffen Pankratz <kratz00@gmx.de>
2017-03-22 18:14:54 +01:00
Dominik Heidler
b16199c8db Use Hood from Router XML if provided
Fixes #31
2017-03-21 10:06:59 +01:00
Steffen Pankratz
4b09731360
Added general exception handler for function 'import_nodewatcher_xml'
Signed-off-by: Steffen Pankratz <kratz00@gmx.de>
2017-01-28 18:20:36 +01:00
Dominik Heidler
d940526f79 Get chipset value only if XML key exists 2016-07-26 22:20:59 +02:00
Dominik Heidler
da42ef018c Add in memory router rate limit
This is some kind of tmp hack to reduce db load
2016-07-26 22:17:39 +02:00
Dominik Heidler
797b67ee40 Record smaller stat timespan to reduce db load 2016-07-26 22:16:33 +02:00
Dominik Heidler
3bf3445c51 Merge pull request #18 from kratz00/empty_mac
Added workaround for empty 'mac_addr' element in nodewatcher data.
2016-05-16 17:03:24 +02:00
Steffen Pankratz
45943a5246 Added workaround for empty 'chipset' element in nodewatcher data.
Signed-off-by: Steffen Pankratz <kratz00@gmx.de>
2016-05-16 12:20:03 +02:00
Steffen Pankratz
c42dc9b92f Added workaround for empty 'mac_addr' element in nodewatcher data.
Signed-off-by: Steffen Pankratz <kratz00@gmx.de>
2016-05-16 12:17:49 +02:00
Dominik Heidler
7921ac6d90 Move datetime.utcnow().replace(tz... into function 2016-03-10 14:22:23 +01:00
Dominik Heidler
95179df2c0 Handle IntOverflows and save unknown-status reason 2016-03-10 14:03:27 +01:00
Dominik Heidler
b7584486ff Small XML parsing performance optimisation 2016-03-10 14:01:54 +01:00
Dominik Heidler
179c403787 Don't ask netmon for WebUI router's position 2016-03-10 14:00:12 +01:00
Dominik Heidler
af2a80f5ee Delete routers with last_contact > 100 days ago 2016-03-10 13:55:15 +01:00
Dominik Heidler
5fee464680 Handle l2tp tunnels 2016-03-07 12:27:43 +01:00
Dominik Heidler
19329ef85c User Accounts, Legacy Routers, Delete Routers 2016-02-29 18:51:58 +01:00
Dominik Heidler
c34246f3a8 Let MongoClient be tz_aware
- output datetime objects from mongodb are now tz_aware with tzinfo=utc
- fixes #11
2016-02-15 18:51:40 +01:00
Dominik Heidler
688b90f3f6 Show ipv4 and ipv6 addresses 2016-01-30 14:48:48 +01:00
Dominik Heidler
44a50ecafb Reduce stat range to 2 Weeks (#3) 2016-01-22 20:33:41 +01:00
Dominik Heidler
c81e8328cd use description, position,... from nodewatcher XML 2016-01-07 23:08:23 +01:00
Dominik Heidler
e56336b106 rename position.comment to position_comment 2016-01-06 19:06:43 +01:00