This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Jackster's profile picture

Cable monitor

Started by Jackster, 09 July 2012 - 04:05 PM
Jackster #1
Posted 09 July 2012 - 06:05 PM
I made a Datacenter out of computers.
Yes I do hope we soon have half block server blades that we can use :)/>/>



Problem is a few services I am running would be nice to have a monitor.

But as you can see space is a premium.

What I would like is a remote monitor program or bit of code that will allow me to either have a Wifi monitor (Wifi also used for other things) or cable.

Just like to know if it is possible first B)/>/>

Thank you.
Lyqyd #2
Posted 09 July 2012 - 06:22 PM
Yep, definitely possible. I do something similar for my (IC2) nuke plant control room. I can toss you the code if you want, but it's dependent on the LyqydNet API.
Jackster #3
Posted 09 July 2012 - 06:30 PM
Yep, definitely possible. I do something similar for my (IC2) nuke plant control room. I can toss you the code if you want, but it's dependent on the LyqydNet API.

Please do.

The API from LyqydNet is a copy paste file job with editing of the startup file of all computers right?
Lyqyd #4
Posted 09 July 2012 - 07:13 PM
Indeed it is. I haven't tested it with other rednet traffic, though. It should just ignore non-LyqydNet transmissions, but I'm not sure. Once I get home tonight (17:00 Pacific or so), I'll upload the monitor program. Let me know if you have any trouble with setting up the LyqydNet API.
BigSHinyToys #5
Posted 10 July 2012 - 12:03 AM
it is definitely possible to do this. question is how complex you want it. Some options
A ) you sent each string that would normal be printed via rennet (cable or wire) to your reviver where it prints the continence on screen.
B ) you build a program that has a nice gui and is designed to receive packets formatted in a special way that the program understand. resulting in a nice looking screen with the information arranged nicely on it.
C ) same as b but with a remote login system allowing you to monitor all systems from one computer given the right authentication wold need to be built on top or some kind of Network protocol.and OS It would be dam cool.

D ) make a remote terminal program screen transfer program that takes all instructions meant for the screen and sends them exactly to another computer. then sends back all reply instructions.

A and B are simple C is insanely hard and D would be extremely useful for a lot of prepossess.

so witch of them would best describe what to are looking for.
Jackster #6
Posted 10 July 2012 - 12:41 AM
One of my suggestions is SSH type thing so we can remote control servers.


Would be great for this datacenter so people don't have to come in all the time.
Lyqyd #7
Posted 10 July 2012 - 01:21 AM
Okay, here's the code:


local monitor = peripheral.wrap("left")

function monPrint(text)
    term.redirect(monitor)
    print(text)
    term.restore()
end

while true do
    e, p1, p2, p3 = os.pullEvent("rednet_message")
    route, packetType, message = net.rednet_message(p1, p2, p3)
    if message then
        local action, data = string.match(message, "^(%a+):)/>/>[%w%s%p]+)")
        if action then
            if action == "alarm" then
                monPrint("A: "..data)
            elseif action == "clear" then
                monPrint("C: "..data)
            elseif action == "info" then
                monPrint("I: "..data)
            end
        end
    end
end

And an example of what gets sent to it:


net.packet_send("SP", displayControl, "info:Reactor is cool.")

This is the line that set up the displayControl variable:


local displayControl = net.routeFromName("reactordisplay")

As you can see, it uses three different display message types (which could easily be changed to just use one), and does rely on the LyqydNet API, but as far as I can tell, could rather easily be changed to use plain rednet.

Also, as far as the SSH is concerned, you might try nshd and the net program (as distinct from the API of the same name), which are the server and client respectively. Unfortunately, nshd runs in the foreground, so if your server apps do the same, it won't be compatible. I'm working on getting the background mode for nshd working properly, but that could be a little while. These two are heavily dependent on LyqydNet and wouldn't be nearly so simple as the display program to re-write for plain rednet.