erikng / Cacher

A python script for extracting macOS Caching Server data
Apache License 2.0
134 stars 40 forks source link

Receiving AttributeError: 'NoneType' object has no attribute 'group #25

Closed blackthroat closed 7 years ago

blackthroat commented 7 years ago

macOS 10.12.1 (Build 16B2659) Server 5.2 (Build 16S1195)

Cacher Last Updated: 01-04-2017 version = '3.0'

blackthroat commented 7 years ago

aus-od01:Cacher ladmin$ sudo python Cacher --serveralert Cacher did not retrieve any stats for 2017-01-09

aus-od01:Cacher ladmin$ sudo python Cacher --serveralert --targetdate "2017-01-09" Traceback (most recent call last): File "Cacher", line 819, in main() File "Cacher", line 802, in main cacherdata = cacher(rawLog.readlines(), targetDate, friendlyNames) File "Cacher", line 206, in cacher x).group(1).replace('OS X ', 'macOS/').split('/')[0] AttributeError: 'NoneType' object has no attribute 'group'

blackthroat commented 7 years ago

aus-od01:Cacher ladmin$ sudo python Cacher --serveralert --targetdate "2017-01-08" Password: Cacher has retrieved the following stats for 2017-01-08:

0.00 bytes of bandwith served to client devices. 0.00 bytes of bandwith requested from Apple 0.00 bytes of bandwith requested from other Caching Servers

0 IP Addresses hit the Caching Server yesterday consisting of: 0 Unique IP Addresses.

A total of 0 iOS downloads were requested from the Caching Server yesterday consisting of: A total of 0 Apple TV downloads A total of 0 iPad downloads A total of 0 iPhone downloads A total of 0 iPod downloads

A total of 0 OS downloads were requested from the Caching Server yesterday consisting of: 0 iOS downloads: 0 macOS downloads:

A total of 0 Applications were downloaded from Apple Configurator 2 devices

A total of 0 files were downloaded from the Caching Server yesterday consisting of:

A total of 0 unique files were downloaded from the Caching Server yesterday consisting of:

Cacher version: 3.0 Uptime: 13:46, 2

blackthroat commented 7 years ago

image

ekrizon commented 7 years ago

Same issue exactly for me.

macOS 10.12.2 (Build 16C67) Server 5.2 (Build 16S1195)

erikng commented 7 years ago

Hey guys, I'm really sorry, but I just haven't had time for this yet. @ekrizon could you upload your caching logs and the date you tried to generate the stats?

ekrizon commented 7 years ago

screen shot 2017-01-24 at 8 20 54 am export.txt Logs.zip

The txt file has the commands that I had tried running. Let me know if you need me to test anything further. We have 7 servers deployed so far and wish to use your script on all of them. They all error in the same way however.

andreeee commented 7 years ago

Running into the same issue, anyone have any idea what's causing it?

ekrizon commented 7 years ago

Any update on this?

erikng commented 7 years ago

I've been beyond swamped at work to the point where I'm working multiple after hours at home.

I'm pretty exhausted but when I get some time I will look into this. Thanks for providing the logs.

On Feb 9, 2017, at 5:22 PM, ekrizon notifications@github.com<mailto:notifications@github.com> wrote:

Any update on this?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/erikng/Cacher/issues/25#issuecomment-278828293, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFa_GFhgIc1w_MOKworqU8OyFjqQA6WFks5ra7jpgaJpZM4Lfu6U.

erikng commented 7 years ago

Guys,

Have either of you run sudo Cacher --configureserver ?

I'm looking at the logs @ekrizon posted and they aren't matching up with what I'm expecting to see.

erikng commented 7 years ago

As of https://github.com/erikng/Cacher/commit/616cdd219c30b848afc66d7c7f600d44a8724906 I am now checking if your caching server is properly configured and if it's not, it will exit and ask you to delete your logs and run sudo Cacher --configureserver.

As for this error, there may not be much I can do as I'm expecting the logs to look correctly and store the Identity data.

ekrizon commented 7 years ago

So this is weird.. I hadnt tried it or modified it since my above errors. Yes I did ensure that I ran --configureserver.

Now when I try (still have not modified anything since my original testing) it works like a charm using --targetdate. I ran "sudo python Cacher --targetdate "2017-02-17" and it retrieved 10 mb served, listed clients, the whole shebang.

However if I just run Cacher by itself it says "Cacher did not retrieve any stats for 2017-02-17"

Any thoughts? I thought those two are technically the same commands when talking about the previous day?

erikng commented 7 years ago

Interesting. Please send me your updated logs.

Also are you on macadmin Slack? if so message me @erik

erikng commented 7 years ago

Alright, I was able to figure out what the issue was: I have now written logic that should prevent this error from occurring and also some additional sanity checks.

You can git pull the latest or just download here.

https://github.com/erikng/Cacher/releases/tag/3.0.2