Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HELP] How to install Scrunity on Proxmox #534

Closed
AuthorShin opened this issue Oct 25, 2023 · 9 comments
Closed

[HELP] How to install Scrunity on Proxmox #534

AuthorShin opened this issue Oct 25, 2023 · 9 comments

Comments

@AuthorShin
Copy link

Hello
Thank you very much for creating and maintaining this awesome and critical app
I know it's not a right place to ask for this but I couldn't find a discussion section or a Discord server to ask for guidance regarding installing Scrunity on Proxmox.
The approach I'm looking forward to is since the collector and DB and WebUI are separated, install the collector on the Proxmox host without docker and then have WebUI and DB via docker on a VM that's getting the data from the collector, but reading and trying with the documents I couldn't quite understand the procedure and hence I'm opening this issue.
Thanks in advance

@AnalogJ
Copy link
Owner

AnalogJ commented Nov 17, 2023

https://github.com/AnalogJ/scrutiny/blob/master/docs/INSTALL_HUB_SPOKE.md might be a good guide for you

I'm going to close this issue, but feel free to reopen/comment if that doesnt help.

@AnalogJ AnalogJ closed this as completed Nov 17, 2023
@AuthorShin
Copy link
Author

Thank you very much for the link, with that guide I was able to setup Scrutiny on 2 of my Proxmox servers and it's just been awesome experience using it.
Hope it grow more and more during time and get the attention it actually deserves.

@AuthorShin
Copy link
Author

@AnalogJ However there seems to be a problem with cronjob part of that guide that with cronjob it's not getting the data and the chart it's not getting update but when I manually execute the command it's updating the info on Scrutiny.

Like the guide said I just added the following line to the crontab -e

*/15 * * * * /opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 run --api-endpoint "http://192.168.11.99:8714"

Output of service cron status

● cron.service - Regular background program processing daemon
     Loaded: loaded (/lib/systemd/system/cron.service; enabled; preset: enabled)
     Active: active (running) since Sun 2023-11-05 12:23:22 UTC; 2 weeks 1 day ago
       Docs: man:cron(8)
   Main PID: 1659 (cron)
      Tasks: 1 (limit: 38038)
     Memory: 804.0K
        CPU: 4.110s
     CGroup: /system.slice/cron.service
             └─1659 /usr/sbin/cron -f

Nov 21 09:15:01 InfinityGauntlet CRON[2579269]: pam_unix(cron:session): session closed for user root
Nov 21 09:17:01 InfinityGauntlet CRON[2580346]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Nov 21 09:17:01 InfinityGauntlet CRON[2580347]: (root) CMD (cd / && run-parts --report /etc/cron.hourly)
Nov 21 09:17:01 InfinityGauntlet CRON[2580346]: pam_unix(cron:session): session closed for user root
Nov 21 09:30:01 InfinityGauntlet CRON[2586441]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Nov 21 09:30:01 InfinityGauntlet CRON[2586442]: (root) CMD (/opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 run --api-endpoint "http://192.168.11.99:8714")
Nov 21 09:30:01 InfinityGauntlet CRON[2586441]: pam_unix(cron:session): session closed for user root
Nov 21 09:45:01 InfinityGauntlet CRON[2593746]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Nov 21 09:45:01 InfinityGauntlet CRON[2593747]: (root) CMD (/opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 run --api-endpoint "http://192.168.11.99:8714")
Nov 21 09:45:01 InfinityGauntlet CRON[2593746]: pam_unix(cron:session): session closed for user root

@AuthorShin
Copy link
Author

@AnalogJ Also I added the COLLECTOR_RUN_STARTUP=true and COLLECTOR_RUN_STARTUP_SLEEP=10 as environment variables which was pointed in https://github.com/AnalogJ/scrutiny/blob/master/docs/TROUBLESHOOTING_DEVICE_COLLECTOR.md but still didn't work for me.

@ushio75
Copy link

ushio75 commented Nov 24, 2023

@AnalogJ However there seems to be a problem with cronjob part of that guide that with cronjob it's not getting the data and the chart it's not getting update but when I manually execute the command it's updating the info on Scrutiny.

Like the guide said I just added the following line to the crontab -e

*/15 * * * * /opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 run --api-endpoint "http://192.168.11.99:8714"

Output of service cron status

● cron.service - Regular background program processing daemon
     Loaded: loaded (/lib/systemd/system/cron.service; enabled; preset: enabled)
     Active: active (running) since Sun 2023-11-05 12:23:22 UTC; 2 weeks 1 day ago
       Docs: man:cron(8)
   Main PID: 1659 (cron)
      Tasks: 1 (limit: 38038)
     Memory: 804.0K
        CPU: 4.110s
     CGroup: /system.slice/cron.service
             └─1659 /usr/sbin/cron -f

Nov 21 09:15:01 InfinityGauntlet CRON[2579269]: pam_unix(cron:session): session closed for user root
Nov 21 09:17:01 InfinityGauntlet CRON[2580346]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Nov 21 09:17:01 InfinityGauntlet CRON[2580347]: (root) CMD (cd / && run-parts --report /etc/cron.hourly)
Nov 21 09:17:01 InfinityGauntlet CRON[2580346]: pam_unix(cron:session): session closed for user root
Nov 21 09:30:01 InfinityGauntlet CRON[2586441]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Nov 21 09:30:01 InfinityGauntlet CRON[2586442]: (root) CMD (/opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 run --api-endpoint "http://192.168.11.99:8714")
Nov 21 09:30:01 InfinityGauntlet CRON[2586441]: pam_unix(cron:session): session closed for user root
Nov 21 09:45:01 InfinityGauntlet CRON[2593746]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Nov 21 09:45:01 InfinityGauntlet CRON[2593747]: (root) CMD (/opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 run --api-endpoint "http://192.168.11.99:8714")
Nov 21 09:45:01 InfinityGauntlet CRON[2593746]: pam_unix(cron:session): session closed for user root

confermo ,anche a me non funziona...soluzioni?

@AuthorShin
Copy link
Author

@ushio75 I used systemd instead of cronjob and it's been working that way.

@shaftspanner
Copy link

I also had problems with the collector running flawlessly when triggered manually, but failing to run using cron. I switched to Systemd timers using this guide (https://www.howtogeek.com/replace-cron-jobs-with-systemd-timers/) and it's worked without issue ever since.

@phcreery
Copy link
Contributor

phcreery commented Jul 18, 2024

I also had problems with cron. It would execute but only print the SCRUTINY title. I switched to systemd timers and it works now. Below is how I did it.

sudo nano /root/scrutiny/scrutiny.sh

#!/bin/bash

/opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 run --api-endpoint "http://192.168.1.xxx:8080" | tee /var/log/scrutiny.log

sudo nano /etc/systemd/system/scrutiny.service

[Unit]
Description="Scrutiny Collector"
Requires=scrutiny.timer

[Service]
Type=simple
ExecStart=/root/scrutiny/scrutiny.sh
User=root

sudo nano /etc/systemd/system/scrutiny.timer

[Unit]
Description="Timer for the scrutiny.service"

[Timer]
Unit=scrutiny.service
OnBootSec=5min
OnUnitActiveSec=1min

[Install]
WantedBy=timers.target

sudo systemctl enable scrutiny.timer
sudo systemctl start scrutiny.timer

@hoggatt
Copy link

hoggatt commented Aug 23, 2024

I also had problems with cron. It would execute but only print the SCRUTINY title. I switched to systemd timers and it works now. Below is how I did it.

sudo nano /root/scrutiny/scrutiny.sh

#!/bin/bash

/opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 run --api-endpoint "http://192.168.1.xxx:8080" | tee /var/log/scrutiny.log

...

FYI, this only worked for me when I made the scrutiny.sh script executable:

chmod +x /root/scrutiny/scrutiny.sh

For those who are interested, here is my whole script that automates this:

#!/bin/bash

# change as needed
API_ENDPOINT="http://192.168.1.xx:8081"


####################################
# Install Scrutiny Collector

# Installing dependencies
apt install smartmontools -y 

# Define variables
INSTALL_DIR="/opt/scrutiny"
BIN_DIR="$INSTALL_DIR/bin"
LATEST_RELEASE_URL=$(curl -s https://api.github.com/repos/AnalogJ/scrutiny/releases/latest | grep "browser_download_url.*scrutiny-collector-metrics-linux-amd64" | cut -d '"' -f 4)

# Create the installation directory if it doesn't exist
mkdir -p $BIN_DIR

# Download the latest release
curl -L $LATEST_RELEASE_URL -o $BIN_DIR/scrutiny-collector-metrics-linux-amd64

# Make the binary executable
chmod +x $BIN_DIR/scrutiny-collector-metrics-linux-amd64


#####################################
# Install Scrutiny Service

# Create the directory if it doesn't exist
mkdir -p /root/scrutiny

# Write the script to /root/scrutiny/scrutiny.sh
cat << EOF > /root/scrutiny/scrutiny.sh
#!/bin/bash

/opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 run --api-endpoint "$API_ENDPOINT" 2>&1 | tee /var/log/scrutiny.log
EOF

# Make the script executable
chmod +x /root/scrutiny/scrutiny.sh

# Write the service file to /etc/systemd/system/scrutiny.service
cat << 'EOF' > /etc/systemd/system/scrutiny.service
[Unit]
Description="Scrutiny Collector"
Requires=scrutiny.timer

[Service]
Type=simple
ExecStart=/root/scrutiny/scrutiny.sh
User=root
EOF

# Write the timer file to /etc/systemd/system/scrutiny.timer
cat << 'EOF' > /etc/systemd/system/scrutiny.timer
[Unit]
Description="Timer for the scrutiny.service"

[Timer]
Unit=scrutiny.service
OnBootSec=5min
OnUnitActiveSec=15min

[Install]
WantedBy=timers.target
EOF

# Reload the systemd manager configuration
systemctl enable scrutiny.timer
systemctl start scrutiny.timer

# show status to prove it's running
systemctl status scrutiny.timer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants