2017-10-22 11 views
0

cron.yaml을 사용하여 매시간 pubsub에 (pubsub_v1을 통해) 퍼블리싱하는 Google App Engine Flask 앱과 this example과 비슷한 메시지를받는 Google Compute Engine이 있습니다. GCE 앱이 GAE 앱에서 보낸 메시지를 1 분마다 인쇄하지만 몇 분마다 GCE 로그에 'Google Compute Engine OS 로그인이 활성화되어 있지 않습니다'라는 메시지가 표시됩니다. 이것은 6-10 분 동안 발생하고, GCE 앱은 메시지를 다시 인쇄하기 시작합니다. 이 메시지는 무엇을 의미하며 어떻게 해결할 수 있습니까?Google Compute Engine OS 로그인이 활성화되어 있지 않습니다.

Google 검색 "Google Compute Engine OS 로그인이 활성화되어 있지 않습니다."라는 메시지가 나타나면 아무 것도 나타나지 않습니다. 어떤 오류가있는 것으로 보이는 것이 이상합니다.

편집 :

는 여기에 내가 대해 많이 찾을 수 없다는,

from google.cloud import pubsub_v1 
import time 
import os 
import sys 
import datetime 
import httplib2 
from oauth2client import client 
import string 


project = 'xxx' 
topic_name = 'my-new-topic' 

from google.cloud import logging 

logging_client = logging.Client() 
log_name = 'xxx' 
logger = logging_client.logger(log_name) 

engine = create_engine('xxx') 

# The data to log 
text = '################### STARTING GCE ###################' 

# Writes the log entry 
logger.log_text(text) 


print('Logged: {}'.format(text)) 

subscriber = pubsub_v1.SubscriberClient() 
topic_path = subscriber.topic_path(project, topic_name) 

for subscription in subscriber.list_subscriptions(topic_path): 
    print(subscription.name) 


def receive_messages(project, subscription_name): 
    """Receives messages from a pull subscription.""" 
    subscriber = pubsub_v1.SubscriberClient() 
    subscription_path = subscriber.subscription_path(project, subscription_name) 

    def callback(message): 
     print(str(datetime.datetime.now())) 
     print('Received message: {}'.format(message)) 
     message.ack() 

    subscriber.subscribe(subscription_path, callback=callback) 

    # The subscriber is non-blocking, so we must keep the main thread from 
    # exiting to allow it to process messages in the background. 
    print('Listening for messages on {}'.format(subscription_path)) 
    while True: 
     print('while loop: ', str(datetime.datetime.now())) 
     time.sleep(60) 



receive_messages(project, 'test') 
+0

GCE에서 실행중인 코드를 공유 할 수 있습니까? – David

+0

@David GCE 코드를 추가했습니다. 감사합니다! – howMuchCheeseIsTooMuchCheese

답변

2

OS 로그인 베타 기능입니다 GCE 스크립트입니다. 1, 23에는 몇 가지 정보가 있습니다. 선택적인 고급 사용자 관리 시스템 인 것 같습니다.

표시되는 메시지는 GCE 인스턴스를 실행하는 계정 관리 데몬에 의해 생성됩니다. 이 메시지는 단지 현재 상태를 인쇄하고 있기 때문에 문제가 없음을 나타내며 실제로는 recently removed이며 향후 이미지에 나타나지 않습니다.

OS 로그인 또는 계정 관리 데몬에 따라 스크립트의 내용이 다르므로 표시되는 문제와 관련되지 않을 수 있습니다.