summaryrefslogtreecommitdiff
path: root/lib/oxidized/pfsense.rb
blob: 67a1a49aae8d2158d6eba37b80c6887d1fe66850 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
class PfSense < Oxidized::Model
  
  prompt /^\e\[0;1;33m\[\S*\e\[0;1;33m\]\e\[0;1;33m\e\[\S*\e\[0;1;31m@\S*\e\[0;1;33m\]\S*\e\[0;1;31m:\e\[0;0;0m\s$/
  comment  '# '
  
  
  #add a comment in the final conf
  def add_comment comment
    "\n###### #{comment} ######\n" 
  end

  cmd :all do |cfg|
    cfg.each_line.to_a[1..-2].join
  end
  
  #show the persistent configuration
  pre do
    cfg = add_comment 'Configuration'
    cfg += cmd 'cat /cf/conf/config.xml'    
  end
  

  cfg :telnet do
    username /^Username:/
    password /^Password:/
  end

  cfg :telnet, :ssh do
    pre_logout 'exit'
  end
 

end