here에 나열된 모든 단계를 수행하여 aws 스크립트를 설정하여 시스템의 메모리 사용량을 수집하고이를 cloudwatch에보고합니다. 내가 겪고있는 문제는 Cloudwatch 콘솔에서 문제가 발생하지 않는다는 것입니다. 내가Cloudwatch 사용자 정의 메트릭 - 메모리 사용률 --from-cron이 작동하지 않습니다.
$ ~/aws-scripts-mon/mon-put-instance-data.pl --mem-util --verbose
을 수행 할 때
메트릭이 성공적으로 CloudWatch를 전송됩니다. 나는 콘솔에서 데리러 간다.
그러나 나는 cron 작업을 통해 똑같이하려고 할 때, Cloudwatch 콘솔에서 선택하지 않는다.
는 설정하려면 크론, 나는
$ sudo crontab -e
를하고 저장이 줄
*/5 * * * * ~/aws-scripts-mon/mon-put-instance-data.pl --mem-util --from-cron
을 추가하고 종료. 내가/var/log/syslog를 검사 할 때 메트릭이 성공적으로 전송되었다고하지만, 어떤 이유인지는 모르겠지만 클라우드 감시 콘솔에서는이를 잡아 내지 않습니다. 내가 여기서 무엇을 놓치고 있니? (IP가 마스크와)
시스템 로그 파일은
Jan 18 22:55:01 ip-xxx-xx-xx-xx CRON[22536]: (root) CMD (~/aws-scripts-mon/mon-put-instance-data.pl --mem-util --from-cron)
Jan 18 22:55:01 ip-xxx-xx-xx-xx postfix/pickup[22530]: 7FF494449A: uid=0 from=<root>
Jan 18 22:55:01 ip-xxx-xx-xx-xx postfix/cleanup[22540]: 7FF494449A: message-id=<[email protected]>
Jan 18 22:55:01 ip-xxx-xx-xx-xx postfix/qmgr[21671]: 7FF494449A: from=<[email protected]>, size=673, nrcpt=1 (queue active)
Jan 18 22:55:01 ip-xxx-xx-xx-xx postfix/local[22542]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Jan 18 22:55:01 ip-xxx-xx-xx-xx postfix/local[22542]: 7FF494449A: to=<[email protected]>, orig_to=<root>, relay=local, delay=0.03, delays=0.02/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Jan 18 22:55:01 ip-xxx-xx-xx-xx postfix/qmgr[21671]: 7FF494449A: removed
참고 참조를 위해 다음과 같습니다 : 크론 작업의 절대 경로가 트릭을했다. 다양한 딸꾹질을 문서화했습니다 here.
감사 wjordan. 절대 경로가 트릭을했습니다! –