Category Archives: computer

Setting up Prometheus and Grafana on Windows

Ever since I stumbled on Grafana and Prometheus several months ago while looking at creating a comprehensive smart home dashboard, I’ve always wanted to set one up.

After a friend introduced me to Stable Diffusion a few weeks ago, I wanted to be able to run generation from anywhere, so I got my instance of Stable set up with AUTOMATIC1111/stable-diffusion-webui: Stable Diffusion web UI (github.com) by following How to Run Stable Diffusion Locally with a GUI on Windows (howtogeek.com).

This was all well and good, and I can now create AI art from anywhere, but I wanted to be able to see my system’s performance stats as well, so I started looking up webui’s for monitoring and stumbled across Grafana again.

Let’s get this going. Note: This does not follow any best practices, so reader beware. #musicfueledlatenightcomputeradventures

Exporter Installation and Configuration

Step 1 – Download and Install Windows_Exporter

Download the latest release of windows_exporter Releases · prometheus-community/windows_exporter (github.com)
As of writing: windows_exporter-0.20.0-amd64.msi

Unzip and move this file to an easy to access path such as C:\Monitoring\

Open up cmd or PowerShell as admin.
cd to the directory housing your msi file and install using msiexec as demonstrated:

> cd C:\Monitoring
> msiexec /i windows_exporter-0.20.0-amd64.msi --LISTEN_ADDR=127.0.0.1 --LISTEN_PORT=9182

This will install windows_exporter as a Windows service, so you will not need to worry about starting it or creating a task in Task Scheduler.

To verify it is working, open a new tab and navigate to http://127.0.0.1:9182/metrics

Step 2 – Download and Install OhmGraphite

Download the latest release of OhmGraphite Releases · nickbabcock/OhmGraphite (github.com)
As of writing: OhmGraphite-0.27.0.zip

Unzip and move this file to an easy to access path such as C:\Monitoring\

Edit the OhmGraphite.exe.config file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="type" value="prometheus" />
    <add key="prometheus_port" value="4445" />
    
    <!-- This is the host that OhmGraphite listens on.
         `*` means that it will listen on all interfaces.
         Consider restricting to a given IP address -->
    <add key="prometheus_host" value="127.0.0.1" />
  </appSettings>
</configuration>

Open cmd or PowerShell as admin and cd to the folder housing OhmGraphite:

> cd C:\Monitoring\OhmGraphite
> .\OhmGraphite.exe install
> .\OhmGraphite.exe start

To verify it is working, open a new tab and navigate to http://127.0.0.1:4445/metrics

Prometheus – Installation and Configuration

Step 1 – Download and Installation

Download the latest release of Prometheus Releases · prometheus/prometheus (github.com)
As of writing: prometheus-2.40.0.windows-amd64.zip

Extract the contents with your preferred unzipping application and choose an easily accessible path such as C:\Monitoring\ and if desired, rename the folder to just prometheus-2.40.0.

Next, open up the default YAML config file, prometheus.yml, we will add scraper targets to this file.

# my global config
global:
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
#alerting:
  #alertmanagers:
  #  - static_configs:
 #       - targets:
          # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  - job_name: 'fractal'
    metrics_path: '/metrics'
    # scheme defaults to 'http'.
    static_configs:  
      - targets: ['127.0.0.1:9182', '127.0.0.1:4445']

Open cmd or PowerShell as admin and cd to the folder housing Prometheus and start Prometheus with the config file specified:

> cd C:\Monitoring\prometheus-2.40.0
> .\prometheus.exe --config.file="prometheus.yml"

As long as you don’t see any funky errors like the following, you should be able to access Prometheus at http://localhost:9090 to test queries.

ts=2022-11-08T04:00:07.855Z caller=main.go:468 level=error msg="Error loading config (--config.file=prometheus.yml)" file=C:\Monitoring\prometheus-2.40.0\prometheus.yml err="parsing YAML file prometheus.yml: yaml: line 28: did not find expected key"

Test it out by entering cpu into the search bar, then picking a query from the dropdown and pressing enter again.

The instance and job fields as seen above are pulled from the prometheus.yml configuration file.

Grafana Setup

Step 1 – Download and Install

Head on over to Grafana get started | Cloud, Self-managed, Enterprise. Click Download and then choose your OS (Windows for this tutorial).
Download Grafana | Grafana Labs

Run the installer.

Step 2 – Configure Grafana

Once Grafana is installed, open up your web browser and navigate to http://localhost:3000 to complete first-time setup.

Step 3 – Import Dashboard

At this point, you can choose to create a new dashboard from scratch or do what I did and use an existing dashboard to learn how to make the queries work once the exporters are set up.

Manage dashboards | Grafana documentation

Learn Version: Windows Desktop Overview | Grafana Labs

TLDR Version: Stable Diffusion Monitor-1667965231420.json

As long as all this works, you should be able to use the TLDR dashboard out of the box.

I recommend creating a few panels from scratch just to learn the Grafana interface.

That’s all she wrote, folks!

Budget Digital DarkRoom Pt 2

In my last post I stated that the budget was under $500. However, as this machine will be used by my girlfriend once I have built my main rig (in the fall/winter), I decided that it could use a little extra budget. I am happy that I was able to stay within the $500-$550 range that I mentally anticipated.

I was able to pick up a used Cooler Master ML240L RGB liquid cooler for $65, as well as a used EVGA G5 650W fully-modular power supply for $100 incl. taxes on eBay. As it stands, the build is currently as follows:

PCPartPicker Part List
Type Item Price
CPU Intel Core i5-10400 2.9 GHz 6-Core Processor Purchased For $182.00
CPU Cooler Cooler Master MasterLiquid ML240L RGB 66.7 CFM Liquid CPU Cooler Purchased For $60.00
Motherboard Gigabyte B460M DS3H Micro ATX LGA1200 Motherboard Purchased For $76.64
Memory GeIL EVO X II 16 GB (2 x 8 GB) DDR4-3600 CL18 Memory Purchased For $74.75
Storage Kingston A2000 500 GB M.2-2280 NVME Solid State Drive Purchased For $0.00
Case Cooler Master MasterBox Q300L MicroATX Mini Tower Case Purchased For $53.38
Power Supply EVGA G5 650 W 80+ Gold Certified Fully Modular ATX Power Supply Purchased For $100.74
Prices include shipping, taxes, rebates, and discounts
Total $547.51
Generated by PCPartPicker 2020-07-29 15:36 EDT-0400

Budget Digital DarkRoom

I recently purchased an NEC EA244UHD-BK from a friend who was switching careers. This is a high-end 4K business monitor from NEC’s EA series, that is able to be hardware calibrated and covers 99.3% of the Adobe RGB color space.

I tried using my current computer, a refurbished Dell Latitude E7440 (i7-4600U dual core) to drive the display and Lightroom, however there is so much lag on the monitor you can’t do squat. Thus, I decided it was time for an upgrade.

Initially I was going to purchase an 8th gen Intel NUC, powered by an i5-8259U. However, after purchasing this from B&H I consulted with a coworker who spends lots of time on Tom’s Hardware and he said I could easily buy a cheap PC that is more powerful.

I used PCPartPicker to spec out a new custom build, going as small as possible but also to fit under a $500 budget. Unfortunately, that ruled out Mini ITX. I came up with the following build and currently I don’t need a GPU, but in case I do I can always add on a 1050Ti for around $150 new.

PCPartPicker Part List
Type Item Price
CPU Intel Core i5-10400 2.9 GHz 6-Core Processor $182.00 @ B&H
Motherboard Gigabyte B460M DS3H Micro ATX LGA1200 Motherboard $73.98 @ Newegg
Memory GeIL EVO SPEAR Phantom Gaming 16 GB (2 x 8 GB) DDR4-3200 CL16 Memory $58.99 @ Newegg
Storage Kingston A2000 500 GB M.2-2280 NVME Solid State Drive Purchased For $0.00
Case Cooler Master MasterBox Q300L MicroATX Mini Tower Case $53.98 @ Newegg
Power Supply Rosewill 600 W 80+ Gold Certified Semi-modular ATX Power Supply $79.99 @ Newegg
Prices include shipping, taxes, rebates, and discounts
Total $448.94
Generated by PCPartPicker 2020-07-22 19:43 EDT-0400

Seeing how inexpensive the i5-10400 CPU is, I did some hefty research into its performance and it turns out that it is more powerful than my previous Intel build, which ran an i7-4790k. Naturally it is also more powerful than my most recent build which was on an FX-9370 (comparison here).

For funding this new hardware I will be relinquishing one of my Synology NAS devices, a DS214play, along with 2x 3TB WD Red NAS drives. I will also be selling my E7440 once the build is complete. I expect that I should be able to break about even, given $250 for the laptop and around $200 for the NAS and drives.

Portable Gaming Rig

I’ve had an Intel motherboard and a Core 2 Duo sitting around for a while, and recently upgraded the graphics card in my main computer from a GTX 670 2GB to a GTX 770 4GB, so I decided I would build a portable gaming computer, as my main system weighs in at around 45 pounds and is not the easiest to transport.

Specs:

Case: Cooler Master HAF XB Evo

Motherboard: Intel DG35EC – microATX

PSU: Corsair CX600 600W

RAM: 4GB Crucial PC2-6400

CPU: Intel Core 2 Duo E8300 – 2.83GHz

CPU Cooler: ARCTIC Freezer 11LP

GPU: EVGA GTX 670 2GB GDDR5

The motherboard does not natively support USB 3.0, so I also ordered a USB 3.0 host card with 20-pin internal connector.

I might add the anti-dust AC filter foam if I find it necessary.

 

NZXT Phantom 820 Dust Reduction Mod — More Filters!

So I kind of got carried away with making my case dust resistant, and added more dust filters to the case. See below:

 Put this one in to keep dust from building up on the hard drivespic01pic02

This one keeps any extraneous dust from entering the 5.25″ bays

pic03

pic04

And that’s all for now. I might go crazy and buy some more filter material and make more filters for the PSU intake and bottom fan.

NZXT Phantom 820 Dust Reduction Mod

So a few weeks ago, I noticed quite a bit of dust buildup on the outside of my case side panel, right on the mesh around where the fan is. I opened up the case and found more dust on the inside than I would have liked to see. Then again, my system was running 24/7 for about 5 months; however I expected the fan filters to keep the dust out. Not the case here. After doing some research into the cause of the dust leaking in, it comes down to the negative pressure setup of the fans in the case causing dust to come in around the fan filters, wherever there is open, unfiltered mesh.  I searched around for a solution, which came down to foam filter media which I originally found on ModDIY, however after looking into that site, I found out they are in Hong Kong and shipping would take 2 weeks by Registered Air Mail. So I searched some more, and came across a post on Overclock.net where a guy was asking where to find some thin foam filters, and turns out Lowe’s carries some.

Did some searching by walking down to the A/C filters aisle, and took a gander at some of the adjustable electrostatic filters made by Filtrete, but they were too thick, and I didnt exactly like the word “electrostatic” when thinking about where this filter was going to be.
So I downloaded the Lowe’s iPhone app and searched “foam filter” and it took me over to the window air conditioner section.

I wound up finding this 4.76mm filter media, for $1.58

pic1

I also picked up 2 cans of “dust remover” aka canned air,  to spray out all the dust that was built up inside the case, and clean out my Corsair H80i radiator, which was already filled with dust.

To prevent more dust buildup on my radiator fins, I bought a Rosewill 120mm fan filter off Newegg, which should arrive sometime this week.

And so here is how I wound up modding the case side panel, mostly in pictures.

I first laid out the entire piece of filter media over the side panel (interior side up), then marked where the mesh was, then cut it down to size and marked where the fan mount holes are.

pic2

I then applied 1/2 inch strips of Scotch 3M Extreme Mounting Tape (rated for 20lbs) around the outline of the mesh.

pic3

Then I installed the fan, along with the NZXT fan filter that came with the case, and removed the backing on the adhesive to hold the foam down to prevent dust leakage.

pic5

And viola! Almost looks factory installed, and no change to the outside of the panel, except you cant see the fan. However, the only thing I care about is good airflow, minimal dust, and being able to see through the window.

pic6