我正在尝试通过shell cmds下载报告,在我得到一些教程之后:
wget -v –user 'nagUser' –password '.C|n#q.U$#r' –no-check-certificate -O report.html "http://[IP]/nagios/cgi-bin/avail.cgi?show_log_entries=&hostgroup=all&timeperiod=lastweek"
但我收到以下错误:
--2017-04-27 09:23:05-- http://xn--user-z86a/
Resolving –user (xn--user-z86a)... failed: Name or service not known.
wget: unable to resolve host address ‘xn--user-z86a’
--2017-04-27 09:23:05-- http://xn--user-z86a/
Resolving –user (xn--user-z86a)... failed: Name or service not known.
wget: unable to resolve host address ‘xn--user-z86a’
--2017-04-27 09:23:05-- http://nagUser/
Resolving nagUser(nagUser)... failed: Name or service not known.
wget: unable to resolve host address ‘nagUser’
--2017-04-27 09:23:05-- http://xn--password-rn3d/
Resolving –password (xn--password-rn3d)... failed: Name or service not known.
wget: unable to resolve host address ‘xn--password-rn3d’
--2017-04-27 09:23:05-- http://xn--password-rn3d/
Resolving –password (xn--password-rn3d)... failed: Name or service not known.
wget: unable to resolve host address ‘xn--password-rn3d’
--2017-04-27 09:23:05-- http://.c%7Cn/
Resolving .c|n (.c|n)... failed: Name or service not known.
wget: unable to resolve host address ‘.c|n’
--2017-04-27 09:23:05-- http://xn--no-check-certificate-2t2l/
Resolving –no-check-certificate (xn--no-check-certificate-2t2l)... failed: Name or service not known.
wget: unable to resolve host address ‘xn--no-check-certificate-2t2l’
--2017-04-27 09:23:05-- http://xn--no-check-certificate-2t2l/
Resolving –no-check-certificate (xn--no-check-certificate-2t2l)... failed: Name or service not known.
wget: unable to resolve host address ‘xn--no-check-certificate-2t2l’
--2017-04-27 09:23:05-- http://[IP]/nagios/cgi-bin/avail.cgi?show_log_entries=&hostgroup=all&timeperiod=lastweek
Connecting to [IP]:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-04-27 09:23:05 ERROR 404: Not Found.
也许我错过了一个论点?
答案 0 :(得分:0)
经过几个小时的痛苦,我设法按照以下步骤下载报告:
[IP] [URL Name]
wget -q --user='nagiosUser' --password='nagiosPassword' --no-check-certificate -O [fileName.ext] "[report link]"
http://[URL]/nagios/cgi-bin/avail.cgi?show_log_entries=&host=all&timeperiod=[TIMEPERIOD]&rpttimeperiod=&assumeinitialstates=yes&assumestateretention=yes&assumestatesduringnotrunning=yes&includesoftstates=no&initialassumedhoststate=0&initialassumedservicestate=0&backtrack=4&csvoutput=
注意'
封装用户和密码,--user='user'
密码之间也没有空格,不需要特殊字符。并"
为链接。我也使用-q
作为安静模式,否则使用-v
verbouse。
我希望输出报告为csv文件,因此请在链接中注明&csvoutput=
,否则会将其下载为HTML
这些是有效的时间段: 今天=>今天
last24hours => Last 24 hours
yesterday => Yesterday
thisweek => This week
last7days => Last 7 days
lastweek => Last week
thismonth => This month
last31days => Last 31 days
lastmonth => Last month (default)
thisyear => This year
lastyear => Last year