Beispiel #1
0
func (self *Routerboard) RouterboardResource(ip, user, passwd string) (err error, code uint8, res mikrotik.Resource) {
	// res := mikrotik.Resource{}
	// h := mikrotik.Host{Ip: "178.151.111.129", Name: "kievhleb032", Adress: "Харківське шосе, 144-б 2254709", Ping: true, Username: "******", Passwd: "1AzRss53"}
	// h := mikrotik.Host{Ip: "178.150.65.139", Name: "kievhleb032", Adress: "Харківське шосе, 144-б 2254709", Ping: true, Username: "******", Passwd: "1AzRss53"}
	c, err := apim.New(fmt.Sprintf("%s:8728", ip))
	if err != nil {
		return err, 1, res
	}
	err = c.Connect(user, passwd)
	if err != nil {
		return err, 2, res
	}
	defer c.Close()
	res, err = mikrotik.GetResource(c)
	if err != nil {
		return err, 3, res
	}
	// if self.Verbose {
	// fmt.Printf("%s [ %s ] cpu load %s\n", h.Name, h.Ip, res.CpuLoad)

	// }
	// _, err = mikrotik.GetEthernet("ether1-gateway", c)
	// if err != nil {
	// 	return err
	// }
	return nil, 200, res

}
Beispiel #2
0
func (self *Routerboard) RouterboardFirewallFilter(ip, user, passwd string) (err error, code uint8) {
	c, err := apim.New(fmt.Sprintf("%s:8728", ip))
	if err != nil {
		return err, 1
	}
	err = c.Connect(user, passwd)
	if err != nil {
		return err, 2
	}
	defer c.Close()
	// res, err = mikrotik.GetResource(c)
	// if err != nil {
	// 	return err, 3
	// }
	return nil, 200
}