Is there a way I can monitor whether multiple ubuntu systems are powered up and online, and also set automatic shutdown times?

I'm very new to Linux and looked into nagios, but from what I can tell it comes with many features that I would not need and is also a paid service which I can't invest in for the time being.

  • You can monitor multiple ubuntu systems using system monitor.Second method is using saidar – Alina Bell Feb 26 at 12:00
up vote 1 down vote accepted

There's many ways to do this, for checking if the computers are on, you could use ping to see if the machine responds:

ping -c1 ipadress

or if you want it more convenient, make a script and add all of of them.

Since you said you are new to linux, i am assuming you don't know how to make a bash script. Just make a new text file (say you call it check-if-up.sh), with the following content:

#!/bin/bash

# machine 1
ping -c1 ipadress &> /dev/null && echo "machine 1 is up" || echo "machine 1 is down"

# machine 2
ping -c1 ipadress &> /dev/null && echo "machine 2 is up" || echo "machine 2 is down"
# ..

The command there will ping the ip, and echo one of the 2 answers depending if up or down. You need to give it permissions to run with

chmod +x check-if-up.sh

then you can run it with

./check-if-up.sh 

It should output something like

machine 1 is up
machine 2 is down
...

For shutting down the system the shutdown command itself supports a time already.

To shutdown at a specific time (using 24h time)

sudo shutdown -h 8:15

or after a certain amnount of time (say, in 10 minutes)

sudo shutdown -h +10

You could also add this command to the crontab to be repeated every day, in case it never changes. I believe there are also graphical shutdown timer apps in the software center, so if you prefer that try a search there.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.