Raspberry PIã¨USBãã¤ã¯ã¨Mackerelãçµã¿åããã¦ã室å ã®é¨é³ã¬ãã«ãå¯è¦åãã
æè¿ãªãã®ã§ã§ãããã ã£ãã®ã§ãé£ä¼ã®åéã«ãã£ã¦ã¿ã¾ããã
Raspberry Piã®æºå
Raspberry PIã¯ãã§ã«æã£ã¦ããRaspberry Pi 2 Model Bã使ãã¾ãã
- åºç社/ã¡ã¼ã«ã¼: Raspberry Pi
- ã¡ãã£ã¢: ã¨ã¬ã¯ãããã¯ã¹
- ãã®ååãå«ãããã° (10件) ãè¦ã
USBãã¤ã¯ã¯ããã使ãã¾ããRaspberry Piã§ãã¤ã¯ã使ãã¨ãã¯ãã使ããããã®ã¿ããã§ããã
SANWA SUPPLY MM-MCUSB16 USBãã¤ã¯ããã³
- åºç社/ã¡ã¼ã«ã¼: ãµã³ã¯ãµãã©ã¤
- çºå£²æ¥: 2009/05/13
- ã¡ãã£ã¢: ã¨ã¬ã¯ãããã¯ã¹
- è³¼å ¥: 2人 ã¯ãªãã¯: 3å
- ãã®ååãå«ãããã° (6件) ãè¦ã
Raspberry Piã§USBãã¤ã¯ã使ãä¾ã¯ããããªãã«æ¤ç´¢ããã¨ã§ã¦ãã¾ããã以ä¸ã®è¨äºãåèã«ãã¾ããã
soundmeter
é³å£°ä¿¡å·å¦çã«ã¤ãã¦ã®ç¥è¦ããªãã®ã§ããã¾ãããã§æéããããããªãã®ã§soundmeterã¨ããã®ãã¤ãã£ã¦ã¿ã¾ããã
ã¤ã³ã¹ãã¼ã«ã¯READMEã«å¾ãã°ããã§ããããã¤ã³ã¹ãã¼ã«ããã¨soundmeter
ã³ãã³ãã使ç¨ã§ããããã«ãªãã¾ãã
ããã¤ããªãã·ã§ã³ããããRMSãåå¾ãããµã³ããªã³ã°æéããçµæã®åºåæ¹æ³ãªã©ãæå®ã§ãã¾ãã
ã¡ãªã¿ã«RMSã¯Root Mean Squareã®ç¥ã®ããã§ãããã£ããã¤ã¡ã¼ã¸ãæ´ããªã以ä¸ã®è¨äºãåèã«ãã¦ã¿ã¦ãã ããã
USBãã¤ã¯ã®GAIN調æ´
soundmeter
ã使ããããã«ãªã£ãããUSBãã¤ã¯ã®GAINã調æ´ãã¾ãã
è¨æ¸¬ãããå ´æã«Raspberry PIãããã¦ãsoundmeter
ãå®è¡ãã¦ããã¾ãã
ãªãã·ã§ã³ç¡ãã§å®è¡ããã¨ã0.5ç§ãã¨ã®RMSã表示ããã¾ãã
ããä¸ã¤ã¿ã¼ããã«ãéãã¦ãalsamixer
ã³ãã³ããå®è¡ãããã¤ã¯ã®GAINã調æ´ãã¾ãã
Mackerelã§å¯è¦å
ããã¾ã§ã§Raspberry Piã¨USBãã¤ã¯ã使ã£ã¦é¨é³ã¬ãã«ãåå¾ã§ããããã«ãªã£ãã®ã§ããã¨ã¯Mackerelã«ã¡ããªãã¯ãéä¿¡ããã ãã§ãã
Raspberry Piã¸ã®Mackerelå°å ¥ã«ã¤ãã¦ã¯å²æãã¾ããã以åQiitaã«è¨äºãæ¸ããã®ã§ãå¤å°ã¯åèã«ãªãããããã¾ããã
ã«ã¹ã¿ã ã¡ããªãã¯ã使ã
Mackerelã«ã¡ããªãã¯ãéä¿¡ããã«ã¯ãã«ã¹ã¿ã ã¡ããªãã¯ã®ä»æ§ã«ãããã¦ã¹ã¯ãªãããæ¸ãå¿ è¦ãããã¾ãã
ã°ã©ãå®ç¾©ã¨ã¡ããªãã¯ãåºåããã¹ã¯ãªããã§ããã°ãç£è¦å¯¾è±¡ã®ãã¹ãã§åãã°ã©ããªè¨èªã§æ¸ãã¦ãããã¨æãã¾ããã
ä»åã¯Raspberry Piãã¤ãã£ã¦ãããã¨ãããã®ã§ãç´ ç´ã«Pythonã§æ¸ãã¦ã¿ã¾ããã
ãããé©å½ãªãã£ã¬ã¯ããªã¼ã«ç½®ãã¾ããä»åã¯/opt/mackerel-check-scripts/soundmeter.py
ã«ç½®ããã®ã¨ãã¦ããã¾ãããã
mackerel-agent.confã«è¨å®ã追å ãã
[plugin.metrics.soundmeter] command = "/opt/mackerel-check-scripts/soundmeter.py"
ä¸è¨ã®è¨å®ã追å ããmackerel-agentãåèµ·åããã¨ãæ°åå¾ã«ã¯ä»¥ä¸ã®ãããªã°ã©ããæç»ã§ãã¦ããã¨æãã¾ãã
å®éã®ã°ã©ããè¦ãã¨éåãã¦ããç®æãããã¾ãããææsoundmeterã以ä¸ã®æ§ãªã¨ã©ã¼ãåºãã¦ãã¾ãã®ã§ããããããããåå ã ã¨æãã¾ãããå³å¯ã«è¨æ¸¬ãããããã§ããªãã®ã§ãããã¯ç¡è¦ãã¦ãã¾ãã
pi@raspberrypi:~ $ soundmeter 8 Traceback (most recent call last): File "/usr/local/bin/soundmeter", line 9, in <module> load_entry_point('soundmeter==0.1.3', 'console_scripts', 'soundmeter')() File "/usr/local/lib/python2.7/dist-packages/soundmeter/meter.py", line 311, in main m.start() File "/usr/local/lib/python2.7/dist-packages/soundmeter/meter.py", line 116, in start self.record() # Record stream in `AUDIO_SEGMENT_LENGTH' long File "/usr/local/lib/python2.7/dist-packages/soundmeter/meter.py", line 90, in record data = self.stream.read(FRAMES_PER_BUFFER) File "/usr/local/lib/python2.7/dist-packages/pyaudio.py", line 608, in read return pa.read_stream(self._stream, num_frames, exception_on_overflow) IOError: [Errno -9981] Input overflowed
ã¾ã¨ã
ãã§ã«Raspberry PiãUSBãã¤ã¯ãªã©ã®æ©å¨ãæå ã«ããåèã«ã§ããè¨äºãå¤ããMackerelã®æ±ãã«ãããç¨åº¦æ £ãã¦ããã®ã§ãé£ä¼ã®åéã«2æéã»ã©ä½æ¥ããã ãã§ã§ãã¾ããã
æè¿ã¯re:dashãAnsibleãAWS Lambdaãªã©ãPythonã§æ¸ããããã®/æ¸ããã®ã®ãä¸è©±ã«ãªãæ©ä¼ãå¢ãã¦ããã®ã§ããããããPythonãæ¸ããããã«ãªããããªã¨æã£ããããã¾ãã