To end this nicely let me say what I did, so others might be able to use it too.
As Javier pointed out I added an extra Field to the TCP Port type:
- "Polling & Discovery"->"Interface Types",
- click on "Fields" left of "TCP Ports".
I added a field called "Port Connect Message" (internal name: 'port_conn_mesg',
pos: '29', FieldType: 'Other', 'Not In Discovery').
The place where the connection during polling is made is in the file:
'/jffnms/engine/pollers/tcp_status.php'. The array '$options' contains a lot of
keys/values of which now 'port_conn_mesg' is one.
Since I only inserted a few lines of code in once place i'll just paste that
here with some context around it..
------------------------------------------------------------------
if (!$fp) {
if (!empty($errstr)) logger ("$errstr ($errno):");
$status = "closed";
} else {
socket_set_blocking($fp,FALSE); //try to read for 1 second
sleep(3);
$data = addslashes( trim (fgets ($fp,100)));
// NEW send message from/depending on $options['port_conn_mesg']
// this way a connection can be closed according to the applicable
protocols
if ( isset($options['port_conn_mesg']) &&
(strlen($options['port_conn_mesg']) >
0) ) {
fputs($fp, $options['port_conn_mesg']."\n");
}
// END NEW
fclose ($fp);
$status = "open";
}
------------------------------------------------------------------
Now you just have to set the 'Port Connect Message' field if you want a string
to be send over the connection.
For my sshd that is "SSH-2.0-OpenSSH", but you'll just have to see what to send
depending on the protocol, or your situation.
Ps. the relevant code did not change for 0.7.9 -> 0.8.0pre2 (yet), and I hope it
won't either ;) .
Alex
Quoting [EMAIL PROTECTED]:
> Quoting Javier Szyszlican <[EMAIL PROTECTED]>:
>
> > Alex:
> >
> > >>Interface Type fields, are per-interface type fields.
> > >
> > >
> > > Yes, depending on the Interface type one would have to do different
> things.
> > > So far I've encountered 3 different behaviours:
> > > HTTP: simply close the connection
> > > SSH: the sshd sends an identification/version string, it expects an
> > > identification string as reply. So here we simply 'bounce' the string the
> > sshd
> > > send. Though I guess we could set a hard-copy string here too, depending
> on
> > the
> > > server we connect to.
> > > SMTP: the server we use wants a message; sending 'QUIT' here simply
> works.
> > >
> > > This all can be different (I assume) for each specific service you
> connect
> > to.
> > > So it has to be set per interface, not per interface type (since it would
> > be a
> > > shame to implement it per type and then encounter a new service of that
> > type
> > > requiring other behaviour).
> > >
> > > So simply adding a column for each TCP(/UDP) interface with a message to
> > send
> > > before disconnecting should indeed work.
> > > I haven't figured out where and how to do that. Though I have the idea it
> > goes
> > > all the way to the database.
> > > I could put the message to be send in the "Port Description" for now.
> >
> > Right, Interface Type Fields are per-interface type fields that can be
> > changed
> > per-interface of the same type.
> >
> > So thats the way to go, when you get to the Interface Types screen click on
> > Fields over TCP Interfaces (UDP is no good). And you will see the fields
> > regarding that interface type.
> >
> > Please read the manual section on how this works.
> >
> > Javier
>
> Ok, i misunderstood you first, about the 'per interface type' thing. But this
> is
> exactly what I needed.
> I did read that part of the manual before. But it doesn't mean anything when
> you
> don't understand what it is all about.
>
> Thank you for all the fast replies, Alex.
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> Tool for open source databases. Create drag-&-drop reports. Save time
> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> jffnms-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jffnms-users
>
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
jffnms-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jffnms-users