You are not logged in.
Hi all,
I have two web server for my business, and i want to know if it's possible to show:
- Disk Space of my web server on conky
- And a ping solution (If the webserver responds to the ping: The server is UP, and if the server dont responds to the ping: The server have a problem.
I have a ssh access on both server.
I'm a beginner on conky, have u an idea for my project ?
Thx.
Offline
I am no expert on conky either, but I think it is possible to do that if you can connect to the servers without having to enter a password.
'Sector11' is our conky man.
I am sure he will be able to give you all the details.
Offline
Well, I've never had a webserver so this is just brainstorming.
@sato
Can you cd to your server(s)?
If yes, then you can use ${if_existing} - conky says it's for files - but Linux says directories are files.
Here's an example.
On my partition mounted at /media/5 I have a file CRIBBAGE.TXT
sooooooooooo option 1 fails the test and options 2 & 3 pass as well as option 4 as I have my external disk plugged in:
The server is: ${if_existing /media/5/CRIBBAGE.txt}UP${else}DOWN${endif}
The server is: ${if_existing /media/5/CRIBBAGE.TXT}UP${else}DOWN${endif}
The server is: ${if_existing /media/5/}UP${else}DOWN${endif}
The 'disk' is: ${if_existing /media/sector11/disk/}${else}Not ${endif}Connected
I unmount my ext HDD (same as option 1 where "CRIBBAGE.txt" doesn't exist) and see:
If you can get that working we have a place to start.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
UPDATE: I have this ... triple line if not up/connected to "maintain" the same height conky uses.
${alignc}${color7}Web Server: Disk${color}\
${if_existing /media/sector11/disk/}
${alignc}Size: ${fs_size /media/sector11/disk/}
Used: ${fs_used /media/sector11/disk/}${alignr}Free: ${fs_free /media/sector11/disk/}
${fs_bar /media/sector11/disk/}${else}
${color9}${alignc}Is
${alignc}Not
${alignc}UP${color}${endif}
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Ok,
Thx for this, but you mean if my webserver can CD, if i have understand, i mount my webserver in the same way to ma flash disk.
If i create a php file contain a script, conky can use this ?
Offline
Can you "cd" to your server and cd to it without having to enter a password as xaos50 mentioned.
The same way you would cd to any directory on your system?
- If yes, then you do not need another file you can use conky directly as shown just change the "cd /path/to/here/".
Not knowing what a php file is, I cannot answer that. Sorry.
Hmmmmmmmm looking at the OP (Opening Post) I see: ssh
and so went searching: Why does `cd` command not work via SSH? which means I may be wrong about the whole thing.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Hello friends,
I have no idea...
But what is this? conky webserver access log
Offline
^ A conky to read the logs of an nginx server. Interesting. Don't see any 'password' controls in there either.
The interesting part:
cat /srv/http/var/log/nginx/access.log
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
I don't know so much about the scripting side of things, but I'm going to throw some ideas into the soup and see if someone can brew them together. Let's say sato has a file on their server that they can target, is there a script that Conky could run to determine if it is responding or not? Check the response header for a 200 (OK) or otherwise.
A quick look suggests that curl might be able to do that.
Lenovo IdeaPad Yoga 13 | BunsenLabs Hydrogen (x64)
Intel Core i7-3537U | Intel HD4000 | 8GB DDR3 | 256GB SSD
Offline
Another stone for the soup...
Have the server run a cron job at regular intervals to get the disk space (or any other system information you want) and put the results in a file, still on the server. This would have the disadvantage that the general public might be able to read the file too, unless you password-protect it, but it should then be quite easy for your local computer to ask the server for that file and display its contents with conky.
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Offline
Alternative:
install package 'sshfs' and mount the server filesystem locally.
This would allow you to cd into any directory on the server, and Sector11 can guide you through the rest.
Proviso: I don't have any server running for myself either. So can not test this myself.
Offline
Or a php script on server (disk.php), like
<?php
echo passthru('df -hT /var/www');
?>
or http://php.net/manual/en/function.disk-free-space.php
and then just wget that somehow onto conky (some sort of "execi wget url" I guess).
p.s. This seems to be working on conky side
${execi 60 curl http://172.17.6.17/disk.php}
p.s.2. One could also use .htaccess style of dir protection and curl.
Last edited by brontosaurusrex (2016-05-30 13:04:09)
Offline
Thoughts - since I'm not sure how web servers work
If the server is online and not mounted the code I gave above in conky will give a false 'fail'
If the server is not online but is mounted the code above will give a false 'positive'
The curl - wget ideas are excellent, have a script that checks the online status.
- if the server is up create an empty file on the local HDD ie: server1-up or server2-up
- if the server is down check for server1-up and if existing remove it.
That should do it.
@brontosaurusrex - what is the output of ${execi 60 curl http://172.17.6.17/disk.php} on your system?
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
@Sector11
The output of that php script I posted, which is exactly(?) the same as output of "df -hT /var/www".
Just an example, one would probably want something prettier i imagine.
Last edited by brontosaurusrex (2016-05-30 13:02:24)
Offline
If you go the curl way, make sure to specify a sufficiently low --connect-time-out or curl may hang for a long time when the network is down or the server is overloaded - which I suppose will hang conky as well, waiting for the response.
Offline
Or a php script on server (disk.php), like
<?php echo passthru('df -hT /var/www'); ?>
or http://php.net/manual/en/function.disk-free-space.php
and then just wget that somehow onto conky (some sort of "execi wget url" I guess).p.s. This seems to be working on conky side
${execi 60 curl http://172.17.6.17/disk.php}
p.s.2. One could also use .htaccess style of dir protection and curl.
This the result, not bad, i try on conky.
https://www.thomasmayet.fr/space.php
UPDATE:
Its seems to be not work, screen:
http://www.plixup.com/pics_core3/146461 … 1conky.png
My conky:
Last edited by sato (2016-05-30 13:59:53)
Offline
@sato: double dollar sign on line 155.
Offline
@sato: double dollar sign on line 155.
Thinks, but have an other problem, i think its due to my https:
Offline
brontosaurusrex wrote:@sato: double dollar sign on line 155.
Thinks, but have an other problem, i think its due to my https:
Specify the -L switch to follow redirects.
Offline
sato wrote:brontosaurusrex wrote:@sato: double dollar sign on line 155.
Thinks, but have an other problem, i think its due to my https:
Specify the -L switch to follow redirects.
Where i put this in the line ?
Offline