Module ntop
[frames] | no frames]

Module ntop

Module that provides basic function to interact to the ntop http server and to get info on the ntop state.

Others exposed functions allows to cycle through all the hosts currently monitored by ntop.

Functions
 
sendHTTPHeader(mime_type)
send an header back to the client
 
returnHTTPnotImplemented()
send http message code 501 back to the client
 
returnHTTPversionServerError()
send http message code 500 back to the client
 
printHTMLHeader(title, sectionTitle, refresh)
print the standard ntop header opening an html page to be filled with data
 
printHTMLFooter()
print the standard ntop footer closing an html page
 
sendString(msg)
send back to the client the message passed
 
printFlagedWarning(msg)
print a warning message and an image to instruct the users about the problem encountered
int
getFirstHost(actualDeviceId)
retrieve the first host of the list of hosts currently monitored by ntop
int
getNextHost(actualDeviceId)
retrieve the next host of the list of hosts currently monitored by ntop if no first host was previously retrieved get the first host of the list
 
findHostByNumIP(hostIpAddress, vlanId, actualDeviceId)
retrieve the host corresponding to the parameters passed (if any)
string @return the current version of ntop
version()
retrieve the version of this ntop release
string @return the name of the OS
os()
retrieve the operative system in witch ntop was build
string @return the time from witch ntop started sniffing
uptime()
the current uptime of ntop
string or None
getPreference(key)
get the ntop preference named key
 
setPreference(key, value)
set a preference in ntop, as if the user insert a new preference in the html interface
string
getDBPath()
get the current dbPath defined in ntop
string
getSpoolPath()
get the current spoolPath defined in ntop
 
updateRRDCounter()
update the counter of the RRDDatabase specified with the value passed
 
updateRRDGauge()
update the gauge of the RRDDatabase specified with the value passed
Variables
  __package__ = None
Function Details

sendHTTPHeader(mime_type)

 

send an header back to the client

Parameters:
  • mime_type (int) - the mime type of the http respons (check global-defines.h for defined types. ES. 1 for html 12 for json)

printHTMLHeader(title, sectionTitle, refresh)

 

print the standard ntop header opening an html page to be filled with data

Parameters:
  • title (string) - the title of the page
  • sectionTitle (int 0 false 1 true) - flag that indicates if the print should stop just before the sectionTitle of the page (no title will be printed)
  • refresh (int 0 false 1 true) - flag to inhibit the refresh for the current generated html page

sendString(msg)

 

send back to the client the message passed

Parameters:
  • msg (string) - the message to be printed back to the client

printFlagedWarning(msg)

 

print a warning message and an image to instruct the users about the problem encountered

Parameters:
  • msg (string) - the message to print

getFirstHost(actualDeviceId)

 

retrieve the first host of the list of hosts currently monitored by ntop

Parameters:
  • actualDeviceId (int) - the number of the device from witch get the list of hosts, None to get from all interfaces
Returns: int
1 indicates that the first host was found, 0 otherwise

getNextHost(actualDeviceId)

 

retrieve the next host of the list of hosts currently monitored by ntop if no first host was previously retrieved get the first host of the list

Parameters:
  • actualDeviceId (int) - the number of the device from witch get the list of hosts, None to get from all interfaces
Returns: int
1 indicates that the next host was found, 0 otherwise

findHostByNumIP(hostIpAddress, vlanId, actualDeviceId)

 

retrieve the host corresponding to the parameters passed (if any)

Parameters:
  • hostIpAddress (string) - the ip address in dotted notation for ipv4 or string notation for ipv6
  • vlanId (int) - the number representing the vlanId in witch to search for the ipAddress passed
  • actualDeviceId (int) - the number of the device from witch get the list of hosts, None to get from all interfaces
Returns:
1 indicates that the host was found, 0 otherwise

getPreference(key)

 

get the ntop preference named key

Parameters:
  • key (string) - the name of the preference from witch get the value
Returns: string or None
the value of the preference set in ntop if any, null otherwise

setPreference(key, value)

 

set a preference in ntop, as if the user insert a new preference in the html interface

Parameters:
  • key (string) - the key of the preference to set
  • value (string) - the value to associate to the key passed

getDBPath()

 

get the current dbPath defined in ntop

Returns: string
the db path defined in ntop

getSpoolPath()

 

get the current spoolPath defined in ntop

Returns: string
the spool path defined in ntop