'전체 글'에 해당되는 글 93건

https://github.com/djacobs/PyAPNs

Problem 1. Push notification Failed right after sending invalid token

APNS uses socket to send notification object. and if it use invalid token, that connection will be disconnected. you can overcome this by re-generating APNs Object.

But there is one more problem. If you use for loop with same APNs Object, and there is an invalid token, the tokens right after sending invalid token will be failed. 

So, there is an option named enhanced=True, it will check each tokens if it succeeded. and It uses non-blocking ssl socket, and check error using another thread. So I think there is no critical waiting. In the function "_resend_notification_by_range" It sends only notifications after invalid token.

They also provide "send_notification_multiple" function. This function doesn't check error and discard all tokens after invalid token.


Issue 1. FeedbackConnection

https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW3

- connection method and how many tokens you can receive?

they use socket. and It reads data using streaming until there is no data. see below


Once you are connected, transmission begins immediately; you do not need to send any command to APNs. Read the stream from the feedback service until there is no more data to read.

... 

The feedback service’s list is cleared after you read it. Each time you connect to the feedback service, the information it returns lists only the failures that have happened since you last connected.


'분류없음' 카테고리의 다른 글

[cpp] std::move는 단지 캐스팅일 뿐이라고?  (0) 2017.02.08
Same string but different length  (0) 2016.10.28
JIT vs Interpreter  (0) 2016.10.25
git pushed merge cancel  (0) 2015.04.13
[encoding] javascript write to csv  (0) 2015.04.11
블로그 이미지

시간을 거스르는자

,

nginx log ratation

nginx 2015. 4. 6. 11:15

nginx설정을 따로 안하면 미친듯이 로그를 쌓아서 10기가나 차지하고 있는것을 볼수 있다.

weekly로 쌓는 로그를 가능하면 daily로 바꿔주거나 로그가 필요하면 디스크용량을 충분히 갖춰야!

설정법

http://www.nginxtips.com/how-to-rotate-nginx-logs/

'nginx' 카테고리의 다른 글

Loadbalancer를 통해서 올때 client ip가 전달되도록하는 방법  (0) 2018.01.12
ssl setting  (0) 2015.03.12
mac 에서 nginx 설치 및 설정 하기  (0) 2014.10.24
블로그 이미지

시간을 거스르는자

,

Approach1. Using awscli (you don't have to make codes)

1. before collecting some metrics from your instance, your instance must be lauched with CloudWatchFullAccess IAM role.

ref: http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/UsingIAM.html

Amazon CloudWatch integrates with AWS Identity and Access Management (IAM) so that you can specify which CloudWatch actions a user in your AWS Account can perform. For example, you could create an IAM policy that gives only certain users in your organization permission to use GetMetricStatistics. They could then use the action to retrieve data about your cloud resources. 

* in my  case, I made new role(named cloudwatch_test) on IAM service with CloudWatchFullAccess, CloudWatchLogsFullAccess policies. and launch ec2 instance with this IAM role. 


2. follow this. to install cloudwatch tool stuffs

http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/mon-scripts-perl.html


3. After installing perl stuffs and finishing role settings, you can use perl command like this.

$ sudo mv aws-scripts-mon /usr/local/bin/aws-scripts-mon

$ echo "* * * * * ubuntu /usr/local/bin/aws-scripts-mon/mon-put-instance-data.pl --mem-used --mem-avail --disk-path=/dev/xvda1 --disk-space-used --dis-space-avail --from-cron" | sudo tee /etc/cron.d/aws-monitor-mem-disk-usage

* "ubuntu" is user name 

now you can check your custom metric in Ec2 monitoring->View all CloudWatch metrics->Metrics-> Linux System Metrics

if you want to monitor your existing ec2 instance, unfortunately there is no way. I tried below, but it was not working.

(you should install awscli tool first, just type $sudo apt-get install awscli, $aws configure)

1. aws iam create-instance-profile --instance-profile-name CloudWatchProfile

2. aws iam add-role-to-instance-profile --instance-profile-name CloudWatchProfile --role-name cloudwatch_test


Approach2. Using Boto (you have to do some works, but could be more flexible)

http://arr.gr/blog/2013/08/monitoring-ec2-instance-memory-usage-with-cloudwatch/

followed record.

1. make t2 micro ec2 instance (ubuntu)

2. install prerequisites

$sudo apt-get update

$sudo apt-get install python-pip

$sudo pip install boto

3. setup boto config file

$sudo vim /etc/boto.cfg

[Credentials]
aws_access_key_id = <your_access_key_here>
aws_secret_access_key = <your_secret_key_here>

4. get source code and set to cron job

$ curl https://gist.githubusercontent.com/shevron/6204349/raw/cw-monitor-memusage.py | sudo tee /usr/local/bin/cw-monitor-memusage.py

$ sudo chmod +x /usr/local/bin/cw-monitor-memusage.py

$ echo "***** ubuntu /usr/local/bin/cw-monitor-memusage.py" | sudo tee /etc/cron.d/cw-monitor-memusage

* "ubuntu" is user name 

5. check it in AWS management console

Ec2 monitoring->View all CloudWatch metrics->Metrics-> Custom Metrics (it will take a time, wait until this menu created)




'aws' 카테고리의 다른 글

AWS lambda 삽질 일기  (0) 2017.03.17
kinesis firehose 삽질일기  (0) 2017.03.16
elasticache dump to file  (1) 2015.03.23
[ubuntu server instance] mytoon setting  (0) 2014.10.24
HTTP 505: HTTP Version Not Supported  (0) 2014.07.09
블로그 이미지

시간을 거스르는자

,