0

I'm writing a Nagios plugin for a Mumble server in Perl (for the experience- plenty are already available), and I've already run into a brick wall. What I'd like to do is use cURL to connect to the port Mumble binds itself to- if the connection is successful I'd like cURL to simply print a 0, and if it failed, it should print a 1. Looking through the man page I'm unable to find any flags that could replicate that sort of behavior. Any ideas? Could this be done in a more elegant way, or with a different utility?

Teja Kantamneni
  • 17,402
  • 12
  • 56
  • 86
jtb
  • 3
  • 2
  • You should use the [`LWP`](https://metacpan.org/module/LWP) module for Perl rather than shelling out to a command-line utility. – Borodin Mar 20 '13 at 19:32
  • If you just want to check the TCP port, just establish a TCP connection. You don't need an HTTP client. – ikegami Mar 20 '13 at 20:09
  • I don't think I'd need LWP, since it'd just be making a request to localhost:64738, but it is entirely possible that would be the better option. – jtb Mar 20 '13 at 19:40

1 Answers1

2

Why not use IO::Socket and check to see if you can connect that way? seems that that would be a touch more light weight than full on cURL.

ricecake
  • 71
  • 3